Skip to content

Commit 1e7e1bd

Browse files
Feature/tactile sensing (#69)
* Add tactile sensing integration with OrcaHandTouch subclass * Created constants file, moved sensor clients into hardware folder and moved constants into new constants file * Major refactor of MockSensorClient to reduce duplication with base class, removed hardware version methods * Extract protocol codec layer and harden contracts Introduce protocol.py as a pure-function codec for the sensor wire format (frame building, parsing, decoding). Tighten validation (header checks, meta size guards, strict KeyError on missing taxels), move wire-format constants to constants.py, and reduce protocol knowledge leaking into sensor_client.py. * Remove tactile sensing UI to separate orca_ui repository Moves the web-based sensor visualization (Flask/SocketIO) out of orca_core per reviewer feedback on separation of concerns. The UI now lives in its own repo and depends on orca_core as an external package. * Add MockOrcaHandTouch and modernize type annotations Add MockOrcaHandTouch class backed by mock motor and sensor clients for testing hand+sensor workflows without hardware. Extract _create_sensor_client factory method from OrcaHandTouch to mirror the existing _create_motor_client pattern. Update sensor client type annotations to use PEP 604 union syntax. * Address review feedback on tactile sensing API - Clarify get_tactile_forces/get_tactile_taxels docstrings to show string-keyed dict access pattern and list valid finger keys - Remove unused taxel_coordinates module: 3D coordinate data is only consumed by the visualization UI, which now lives in orca_ui. Taxel counts remain in constants.py where the mock client uses them. * Simplify auto-stream error handling and reconfiguration * Address review feedback: rename stats fields, narrow excepts, remove dead code * Add wait_for_first_frame and taxel_counts to MockSensorClient Lets tests synchronize on auto-stream startup without polling, and configure per-finger taxel counts via the constructor instead of mutating private state. * Refactor tactile sensor tests to flat parametrized style Replace class-based tests with module-level functions, parametrize where it tightens coverage, and use wait_for_first_frame() instead of the polling helpers. * Fix resultant decoder to read low byte only Mock now round-trips through the real codec so wire-format bugs surface in tests. * Add tactile sensor port cascade and bring-up helpers OrcaHandTouch.connect() now mirrors the motor cascade: configured port first, then USB-VID auto-detection, with a successful auto-detect persisted to config.yaml. Adds connect_sensors_only() for motor-less sensor testing and makes get_auto_stats() return a snapshot copy so callers can diff values across calls. * Add tactile sensor health-check script * Remove dead reconfiguration code and simplify health-check zeroing * Rename SensorClient to TactileClient and add combined-data accessor * -Revert .gitignore chagnes unrelated to tactile sensing * Tighten tactile-sensing comments, drop unused mock kwarg, add pyserial * Add FingerName Literal type and consolidate test_protocol.py * Drop name-restating docstrings, add pyserial dep --------- Co-authored-by: Fabrice Bourquin <fabrice.bourquin@protonmail.ch>
1 parent b06cd40 commit 1e7e1bd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

orca_core/hardware_hand.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,18 @@ def _create_motor_client(
14771477
class MockOrcaHandTouch(OrcaHandTouch):
14781478
"""Drop-in :class:`OrcaHandTouch` with in-memory mock motor + sensor clients (no serial I/O)."""
14791479

1480-
def _create_motor_client(self) -> MotorClient:
1480+
def _resolve_port(self) -> str:
1481+
return self.config.port or "/dev/null"
1482+
1483+
def _trial_probe(self, port: str) -> tuple[str, int]:
1484+
return "dynamixel", 1_000_000
1485+
1486+
def _create_motor_client(
1487+
self,
1488+
motor_type: str,
1489+
port: str,
1490+
baudrate: int,
1491+
) -> MotorClient:
14811492
from .hardware.mock_dynamixel_client import MockDynamixelClient
14821493

14831494
return MockDynamixelClient(

0 commit comments

Comments
 (0)