Python driver for TouchTronix tactile sensors.
Install
cd sensx_python pip install --upgrade pip setuptools wheel pip install -e .
Serial Permissions (Linux)
sudo chmod a+rw /dev/ttyUSB0
Run Example
# Print sensor grid (default: 5x5) python examples/stream_one.py # Specify sensor size python examples/stream_one.py --rows 20 --cols 8 # Measure frame rate python examples/stream_one.py --benchmark # Hub with two sensors python examples/stream_hub.py --port /dev/ttyUSB0 --baud 1500000 --rows 16 --cols 12
Supported Sensors
Quick Start
Blocking read:
from sensx import SensX sensor = SensX(port="/dev/ttyUSB0") while True: frame = sensor.read_frame() print(frame)
Callback:
from sensx import SensX sensor = SensX(port="/dev/ttyUSB0") sensor.on_frame = lambda frame, ts: print(frame.max()) sensor.start()
Callback with context manager:
from sensx import SensX import time with SensX(port="/dev/ttyUSB0") as sensor: sensor.on_frame = lambda frame, ts: print(frame.max()) sensor.start() time.sleep(5)
API
SensX(port, baud_rate=15_000_000, rows=16, cols=12, init_cmd=DEFAULT_INIT_CMD)
| Method / Property | Description |
|---|---|
start() |
Start background reader thread |
stop() |
Stop the reader thread |
close() |
Stop and close the serial port |
read_frame() |
Blocking read -- returns one frame (no threading) |
latest_frame |
Thread-safe copy of the most recent frame |
latest_timestamp |
time.perf_counter() of the most recent frame |
on_frame |
Callback: fn(frame: np.ndarray, ts: float) |
SensXHub(port, baud_rate=15_000_000, num_sensors=2, rows=16, cols=12, init_cmd=DEFAULT_INIT_CMD)
Supports up to 5 sensors (headers 0xAAAA, 0xBBBB, 0xCCCC, 0xDDDD, 0xEEEE).
Performance
When testing on windows OS, in the case of Frequency drop:
- Open device manager.
- Navigate to the Ports and select the device, right click and open properties.
- go to advanced under the Port Settings.
- Change the Latency Timer (msec) to 1 and click OK.







