v1: Brooks PF400: read gripper width limits from the controller; restrict freedrive default to installed axes#1072
Merged
Conversation
…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>
rickwierenga
reviewed
Jun 4, 2026
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, | ||
| ) |
Member
There was a problem hiding this comment.
should this go into a config object?
Collaborator
Author
There was a problem hiding this comment.
It definitely should - follow up PR with responsibility if introducing this will be up in minutes (but out of scope for this bug fix)
rickwierenga
reviewed
Jun 4, 2026
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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two defects in the v1b1
pylabrobot.brooksPreciseFlex 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 armfreemode <rail>returns-2800, so entering freedrive fails. It now frees the four always-present axes and adds the rail only whenhas_railis set; passing an explicitfree_axesis unchanged.Gripper width checked against hardcoded limits.
move_grippervalidated againstmin/max_gripper_widthhardcoded 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_setupnow reads those soft limits (best-effort, falling back to the defaults) andmove_grippervalidates the computed units with a clearValueErrorbefore sending.