feat(mit): firmware-band MIT torque limits and wire scaling#85
feat(mit): firmware-band MIT torque limits and wire scaling#85JafarAbdi wants to merge 1 commit into
Conversation
mit_torque_limits returns per-joint (physical limit, wire divisor) for the <=1.8-2, 1.8-3..1.8-7, and >=1.8-8 bands. MitJointPositionController clamps physical torque then divides by the wire divisor before commanding. Gear ratios are injectable and default to the base Piper arm.
Greptile SummaryThis PR adds firmware-aware MIT torque conversion. The main changes are:
Confidence Score: 4/5The v1.8-8 command path and custom ratio configuration can fail during hardware control.
src/piper_control/piper_control.py Important Files Changed
Reviews (1): Last reviewed commit: "feat(mit): firmware-band MIT torque limi..." | Re-trigger Greptile |
| if parsed is not None and parsed >= _MIT_12BIT_FRAME_VERSION: | ||
| raise NotImplementedError( | ||
| f"Firmware {firmware_version} uses the 12-bit / no-CRC MIT torque " | ||
| "frame (S-V1.8-8+). This driver only encodes the 8-bit + CRC frame, " | ||
| "which this firmware misdecodes. Add the 12-bit codec before " | ||
| "commanding torques on this firmware." | ||
| ) | ||
| return 8.0 | ||
| return [16.0] * 6, [1.0] * 6 |
There was a problem hiding this comment.
For firmware >= 1.8-8, this replaces the former safe rejection with wire values up to 16 Nm, but both command paths still pass the value directly to piper_sdk.JointMitCtrl. The installed dependency is not pinned to a codec that emits the required 12-bit, no-CRC frame; an SDK still using the documented 8-bit [-8, 8] encoding can send invalid or rejected frames for values above 8 Nm, causing torque commands to be ignored or applied incorrectly on affected arms.
| rest_position: ( | ||
| Sequence[float] | None | ||
| ) = ArmOrientations.upright.rest_position, | ||
| joint_torque_gear_ratios: Sequence[float] = _PIPER_MIT_GEAR_RATIOS, |
There was a problem hiding this comment.
Invalid Ratio Reaches Control Loop
The new injectable ratio sequence is not checked before its values become per-joint limits and divisors. On pre-1.8-3 or unknown firmware, a sequence shorter than six raises IndexError while commanding a later joint, and a zero entry raises ZeroDivisionError in _to_wire_torque; either failure occurs during active torque control and can stop the command loop.
mit_torque_limits returns per-joint (physical limit, wire divisor) for the <=1.8-2, 1.8-3..1.8-7, and >=1.8-8 bands. MitJointPositionController clamps physical torque then divides by the wire divisor before commanding. Gear ratios are injectable and default to the base Piper arm.
Depends on Reimagine-Robotics/piper_sdk#7