Expose iSWAP rotation drive request/set angle#1022
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1e74407 to
89f7c05
Compare
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I wonder now whether we should keep STARBackend.iswap_rotation_drive_deg_per_increment at all or just compute its value at runtime? 🤔
Tame the iSWAP - Part 10 |
| else: | ||
| raise ValueError(f"Invalid rotation drive orientation: {orientation}") | ||
|
|
||
| async def iswap_rotation_drive_set_angle( |
There was a problem hiding this comment.
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)
Summary
STARBackend.iswap_rotation_drive_request_angle()returning the current rotation drive angle in degrees (signed, 0 deg = FRONT).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
iswap_rotation_drive_set_angle(0),45,-45and verify the drive moves to the expected orientation.iswap_rotation_drive_request_angle()reports the same angle that was just set (within ~0.01°).ValueError.🤖 Generated with Claude Code