Skip to content

v1: Brooks PF400: read gripper width limits from the controller; restrict freedrive default to installed axes#1072

Merged
BioCam merged 1 commit into
PyLabRobot:v1b1from
BioCam:pf400-freedrive-gripper-limits
Jun 5, 2026
Merged

v1: Brooks PF400: read gripper width limits from the controller; restrict freedrive default to installed axes#1072
BioCam merged 1 commit into
PyLabRobot:v1b1from
BioCam:pf400-freedrive-gripper-limits

Conversation

@BioCam
Copy link
Copy Markdown
Collaborator

@BioCam BioCam commented Jun 4, 2026

Two defects in the v1b1 pylabrobot.brooks PreciseFlex driver, both from hardcoding values the controller reports. Verified on a physical no-rail PreciseFlex 400. Closes #1071.

Freedrive frees a non-existent axis. start_freedrive_mode() defaulted to [BASE, SHOULDER, ELBOW, WRIST, RAIL]; on a no-rail arm freemode <rail> returns -2800, so entering freedrive fails. It now frees the four always-present axes and adds the rail only when has_rail is set; passing an explicit free_axes is unchanged.

Gripper width checked against hardcoded limits. move_gripper validated against min/max_gripper_width hardcoded to 60/145, but the gripper's real soft limits (gripper-axis DataIDs 16078/16077) differ - so an accepted width can map to units the controller then rejects with a late -1012. _on_setup now reads those soft limits (best-effort, falling back to the defaults) and move_gripper validates the computed units with a clear ValueError before sending.

…rict freedrive default to installed axes

Two defects in the v1b1 brooks PreciseFlex driver, both from hardcoding values the controller reports.

- start_freedrive_mode default no longer frees the rail on a no-rail arm (was BASE/SHOULDER/ELBOW/WRIST/RAIL, and freemode on the absent rail returns -2800); the rail is appended only when has_rail is set.
- move_gripper validates the computed firmware units against the gripper-axis soft limits read at setup (DataIDs 16078/16077), raising a clear ValueError instead of a late -1012; falls back to the previous 60/145 defaults if the read fails.

Closes PyLabRobot#1071.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BioCam BioCam requested a review from rickwierenga June 4, 2026 20:14
Comment on lines +377 to +392
# Read the gripper-axis soft limits so width validation reflects this arm
# rather than the hardcoded defaults (the servo gripper's real range differs).
try:
soft_min = [float(v) for v in (await self.request_parameter(16078)).split(",")]
soft_max = [float(v) for v in (await self.request_parameter(16077)).split(",")]
gripper_index = int(Axis.GRIPPER) - 1
self._gripper_soft_min = soft_min[gripper_index]
self._gripper_soft_max = soft_max[gripper_index]
self.min_gripper_width = soft_min[gripper_index]
self.max_gripper_width = soft_max[gripper_index]
except Exception as exc: # best-effort; fall back to the class defaults
logger.warning(
"[PreciseFlex %s] could not read gripper soft limits, using defaults: %s",
self.driver.io._host,
exc,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this go into a config object?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely should - follow up PR with responsibility if introducing this will be up in minutes (but out of scope for this bug fix)

Comment thread pylabrobot/brooks/precise_flex.py
BioCam added a commit to BioCam/pylabrobot that referenced this pull request Jun 4, 2026
…roller

WIP (draft). Reads what the controller already stores instead of hardcoding it:
PreciseFlexConfiguration (identity, axes, soft/hard limits, motion envelope) via
a named DataID enum, device-read link lengths (16050) and tool transform (16051),
derived has_rail / is_dual_gripper / reach_class, and a joint-limit working-envelope
sweep. The freedrive and gripper-limit fixes now read from the cached config.

Builds on PyLabRobot#1072.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BioCam BioCam merged commit 106cf99 into PyLabRobot:v1b1 Jun 5, 2026
1 of 19 checks passed
@BioCam BioCam deleted the pf400-freedrive-gripper-limits branch June 5, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants