Skip to content

Expose iSWAP rotation drive request/set angle#1022

Open
rickwierenga wants to merge 1 commit intomainfrom
expose-iswap_rotation_drive_angle
Open

Expose iSWAP rotation drive request/set angle#1022
rickwierenga wants to merge 1 commit intomainfrom
expose-iswap_rotation_drive_angle

Conversation

@rickwierenga
Copy link
Copy Markdown
Member

Summary

  • Adds STARBackend.iswap_rotation_drive_request_angle() returning the current rotation drive angle in degrees (signed, 0 deg = FRONT).
  • Adds STARBackend.iswap_rotation_drive_set_angle(angle, speed, acceleration, current_limit) to rotate Joint 1 to an arbitrary angle within ~±93°. The wrist drive is held at its current position.

Branched off #1021; will rebase onto main once that lands.

Test plan

  • On a STAR with iSWAP installed, call iswap_rotation_drive_set_angle(0), 45, -45 and verify the drive moves to the expected orientation.
  • Confirm iswap_rotation_drive_request_angle() reports the same angle that was just set (within ~0.01°).
  • Verify out-of-range angles (e.g. 100) raise ValueError.

🤖 Generated with Claude Code

@rickwierenga rickwierenga requested a review from BioCam April 30, 2026 21:01
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BioCam BioCam force-pushed the expose-iswap_rotation_drive_angle branch from 1e74407 to 89f7c05 Compare May 1, 2026 21:05
async def iswap_rotation_drive_request_angle(self) -> float:
"""Query the iSWAP rotation drive angle in degrees (signed, 0 deg = FRONT)."""
increments = await self.request_iswap_rotation_drive_position_increments()
return increments * STARBackend.iswap_rotation_drive_deg_per_increment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is not always true:

FRONT is indeed always perfectly front-facing, i.e. the linkage_1/rotation drive is perfectly aligned to the back of the X-arm
-> this is what matters because it is one of the components that defines the relative Orientation, specifically yaw (rotation about the z-axis), of the gripper compared to the carriers and plates it will be picking up from.

But FRONT is not always 0 increments in the rotation drive encoder!

Instead the firmware-stored increment value for FRONT is set during the calibration process - my STAR has a FRONT value of 156 increments.

Using always 0 increments here will result in incorrect gripper orientation.

Instead I recommend we set 0 degrees, -90 and +90 degrees based on the firmware-predefined positions - i.e. build a dynamic, firmware-corrected degree system at runtime.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder now whether we should keep STARBackend.iswap_rotation_drive_deg_per_increment at all or just compute its value at runtime? 🤔

@BioCam
Copy link
Copy Markdown
Collaborator

BioCam commented May 1, 2026

Tame the iSWAP - Part 10

else:
raise ValueError(f"Invalid rotation drive orientation: {orientation}")

async def iswap_rotation_drive_set_angle(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

set_ is misleading terminology here - based on our PLR command prefix terminology this implies changing a memory value.

But this is an action command - maybe iswap_rotation_drive_rotate_to_angle() ?

Note: A PLR standard/convention for increment vs angle naming of methods would be useful here)

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