-
Notifications
You must be signed in to change notification settings - Fork 121
STAR iswap & channel 0 collision checks #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rickwierenga
merged 4 commits into
main
from
STARBackend.move_iswap_y_relative-safety-check
Oct 1, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d09962d
STARBackend.move_iswap_y_relative safety check
rickwierenga b18db26
iswap y position safety checks
rickwierenga 813f6a0
Merge branch 'main' into STARBackend.move_iswap_y_relative-safety-check
rickwierenga 2e28d4a
don't update this
rickwierenga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3112,10 +3112,15 @@ async def move_channel_y(self, channel: int, y: float): | |
| f"(channel {channel - 1} y-position is {round(y, 2)} mm)" | ||
| ) | ||
| else: | ||
| # STAR machines appear to lose connection to a channel if y > 635 mm | ||
| max_y_pos = 635 | ||
| if self.iswap_installed: | ||
| max_y_pos = await self.iswap_request_module_y() | ||
| limit = "iswap module y-position" | ||
| else: | ||
| # STAR machines do not allow channels y > 635 mm | ||
| max_y_pos = 635 | ||
| limit = "machine limit" | ||
| if y > max_y_pos: | ||
| raise ValueError(f"channel {channel} y-target must be <= {max_y_pos} mm (machine limit)") | ||
| raise ValueError(f"channel {channel} y-target must be <= {max_y_pos} mm ({limit})") | ||
|
|
||
| if channel < (self.num_channels - 1): | ||
| min_y_pos = await self.request_y_pos_channel_n(channel + 1) | ||
|
|
@@ -3125,7 +3130,7 @@ async def move_channel_y(self, channel: int, y: float): | |
| f"(channel {channel + 1} y-position is {round(y, 2)} mm)" | ||
| ) | ||
| else: | ||
| # STAR machines appear to lose connection to a channel if y < 6 mm | ||
| # STAR machines do not allow channels y < 6 mm | ||
| min_y_pos = 6 | ||
| if y < min_y_pos: | ||
| raise ValueError(f"channel {channel} y-target must be >= {min_y_pos} mm (machine limit)") | ||
|
|
@@ -6476,6 +6481,17 @@ async def move_iswap_y_relative(self, step_size: float, allow_splitting: bool = | |
| allow_splitting: Allow splitting of the movement into multiple steps. Default False. | ||
| """ | ||
|
|
||
| # check if iswap will hit the first (backmost) channel | ||
| # we only need to check for positive step sizes because the iswap is always behind the first channel | ||
| if step_size < 0: | ||
| y_pos_channel_0 = await self.request_y_pos_channel_n(0) | ||
| current_y_pos_iswap = await self.iswap_request_module_y() | ||
| if current_y_pos_iswap + step_size < y_pos_channel_0: | ||
| raise ValueError( | ||
| f"iSWAP will hit the first (backmost) channel. Current iSWAP Y position: {current_y_pos_iswap} mm, " | ||
| f"first channel Y position: {y_pos_channel_0} mm, requested step size: {step_size} mm" | ||
| ) | ||
|
|
||
| direction = 0 if step_size >= 0 else 1 | ||
| max_step_size = 99.9 | ||
| if abs(step_size) > max_step_size: | ||
|
|
@@ -7213,6 +7229,17 @@ async def request_iswap_position(self) -> Coordinate: | |
| z=(resp["zj"] / 10) * (1 if resp["zd"] == 0 else -1), | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def _iswap_y_inc_to_mm(y_inc: int) -> float: | ||
| mm_per_increment = 0.046302083 | ||
| return round(y_inc * mm_per_increment, 2) | ||
|
|
||
| async def iswap_request_module_y(self) -> float: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a duplication and already exists in PyLabRobot since #666
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks, I forgot this exists |
||
| """Request iSWAP module (not gripper) Y position in mm""" | ||
| resp = await self.send_command(module="R0", command="RY", fmt="ry##### (n)") | ||
| iswap_y_pos = resp["ry"][1] # 0 = FW counter, 1 = HW counter | ||
| return STARBackend._iswap_y_inc_to_mm(iswap_y_pos) | ||
|
|
||
| async def request_iswap_initialization_status(self) -> bool: | ||
| """Request iSWAP initialization status | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplication as well, and has existed in PyLabRobot as
y_drive_increment_to_mmfor a whileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this is for pip channels, but the conversion is actually the same