Skip to content

Expose STARBackend._iswap_rotate_both_joints_in_increments for parallelised, smooth motion#1016

Merged
rickwierenga merged 15 commits intoPyLabRobot:mainfrom
BioCam:expose-rotate-both-joints
Apr 28, 2026
Merged

Expose STARBackend._iswap_rotate_both_joints_in_increments for parallelised, smooth motion#1016
rickwierenga merged 15 commits intoPyLabRobot:mainfrom
BioCam:expose-rotate-both-joints

Conversation

@BioCam
Copy link
Copy Markdown
Collaborator

@BioCam BioCam commented Apr 28, 2026

"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 STARBackend that enables parallel motion of both iSWAP SCARA joints.

Why private + _in_increments suffix

_iswap_rotate_both_joints_in_increments is intentionally:

  • private (leading _) — user-facing methods should not take encoder/motor increment values

Conservative defaults

Default speeds are set to ~50% of the firmware maximum - which creates much smoother motion - overrideable by the caller:

Param Default Spec max
rotation_speed 25_000 75_000
wrist_speed 20_000 65_000

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 PA firmware command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py Outdated
Comment on lines +10154 to +10165
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}",
)
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
BioCam and others added 3 commits April 28, 2026 19:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ents

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rickwierenga rickwierenga merged commit b9f956b into PyLabRobot:main Apr 28, 2026
20 of 21 checks passed
@BioCam BioCam deleted the expose-rotate-both-joints branch April 28, 2026 21:32
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.

3 participants