Expose STARBackend._iswap_rotate_both_joints_in_increments for parallelised, smooth motion#1016
Conversation
…tion/wrist/gripper sections
…rientation classifiers
…dicts - Keys now match the RotationDriveOrientation / WristDriveOrientation enum names (left/front/right, right/straight/left/reverse) instead of opaque firmware indices (w1/w2/w3, t1..t4) - Link-length values now in mm (link_1_len, link_2_len), not raw increments
There was a problem hiding this comment.
Pull request overview
Adds a new private STAR backend command to drive iSWAP SCARA Joint 1 (rotation/W) and Joint 2 (wrist/T) in parallel using absolute encoder increments, to support smoother/parallelised motion for upcoming kinematics/safety work.
Changes:
- Introduces
STARBackend._iswap_rotate_both_joints_in_increments()with conservative default speed/accel/current-limit parameters. - Adds input validation for joint positions, speed, acceleration, and current limits before emitting an
R0 PAfirmware command.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| await self.send_command( | ||
| module="R0", | ||
| command="PA", | ||
| wa=f"{rotation_position:+06}", | ||
| wv=f"{rotation_speed:05}", | ||
| wr=f"{rotation_acceleration:03}", | ||
| ww=f"{rotation_current_limit}", | ||
| ta=f"{wrist_position:+06}", | ||
| tv=f"{wrist_speed:05}", | ||
| tr=f"{wrist_acceleration:03}", | ||
| tw=f"{wrist_current_limit}", | ||
| ) |
There was a problem hiding this comment.
This new command-building logic (range checks + string formatting for wa/ta/wv/etc.) isn’t covered by unit tests. The repo already uses STAR_tests.py to assert exact firmware command strings for iSWAP-related operations; please add a focused test that calls _iswap_rotate_both_joints_in_increments (via a command-catcher/mocked backend) and asserts the assembled R0PA... command, including sign/zero-padding and boundary conditions.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ents Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
"Tame the iSWAP" - Part 5
With PLR's upcoming advanced kinematics and iSWAP safety system, the iSWAP no longer needs to sequence one drive at a time.
This PR adds one command to
STARBackendthat enables parallel motion of both iSWAP SCARA joints.Why private +
_in_incrementssuffix_iswap_rotate_both_joints_in_incrementsis intentionally:_) — user-facing methods should not take encoder/motor increment valuesConservative defaults
Default speeds are set to ~50% of the firmware maximum - which creates much smoother motion - overrideable by the caller:
rotation_speedwrist_speed