Python driver for TouchTronix tactile sensors.
cd sensx_python
pip install --upgrade pip setuptools wheel
pip install -e .sudo chmod a+rw /dev/ttyUSB0# Print sensor grid (default: 5x5)
python examples/stream_example.py
# Specify sensor size
python examples/stream_example.py --rows 20 --cols 8
# Measure frame rate
python examples/stream_example.py --benchmark
# All options
python examples/stream_example.py --port /dev/ttyUSB0 --baud 921600 --rows 5 --cols 5Blocking 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)| 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) |


