Skip to content
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

fix(api): use consistent CriticalPoints when moving to maintenance position #12878

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,23 @@ async def execute(
ot3_api = ensure_ot3_hardware(
self._hardware_api,
)
current_position = await ot3_api.gantry_position(Mount.LEFT)
max_height_z = ot3_api.get_instrument_max_height(Mount.LEFT)
current_position_mount = await ot3_api.gantry_position(
Mount.LEFT, critical_point=CriticalPoint.MOUNT
)
max_height_z_mount = ot3_api.get_instrument_max_height(
Mount.LEFT, critical_point=CriticalPoint.MOUNT
)
max_height_z_tip = ot3_api.get_instrument_max_height(Mount.LEFT)
# avoid using motion planning waypoints because we do not need to move the z at this moment
movement_points = [
# move the z to the highest position
Point(x=current_position.x, y=current_position.y, z=max_height_z),
Point(
x=current_position_mount.x,
y=current_position_mount.y,
z=max_height_z_mount,
),
# move in x,y without going down the z
Point(x=_ATTACH_POINT.x, y=_ATTACH_POINT.y, z=max_height_z),
Point(x=_ATTACH_POINT.x, y=_ATTACH_POINT.y, z=max_height_z_mount),
]

for movement in movement_points:
Expand All @@ -108,7 +117,7 @@ async def execute(
}
)
else:
max_motion_range = max_height_z - _MAX_Z_AXIS_MOTION_RANGE
max_motion_range = max_height_z_tip - _MAX_Z_AXIS_MOTION_RANGE
await ot3_api.move_axes(
{
OT3Axis.Z_L: max_motion_range + _LEFT_MOUNT_Z_MARGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ async def test_calibration_move_to_location_implementation(
mount=MountType.LEFT, maintenancePosition=maintenance_position
)

decoy.when(await ot3_hardware_api.gantry_position(Mount.LEFT)).then_return(
Point(x=1, y=2, z=3)
)
decoy.when(
await ot3_hardware_api.gantry_position(
Mount.LEFT, critical_point=CriticalPoint.MOUNT
)
).then_return(Point(x=1, y=2, z=3))

decoy.when(
ot3_hardware_api.get_instrument_max_height(
Mount.LEFT, critical_point=CriticalPoint.MOUNT
)
).then_return(250)

decoy.when(ot3_hardware_api.get_instrument_max_height(Mount.LEFT)).then_return(300)

Expand All @@ -70,7 +78,7 @@ async def test_calibration_move_to_location_implementation(
decoy.verify(
await ot3_hardware_api.move_to(
mount=Mount.LEFT,
abs_position=Point(x=1, y=2, z=300),
abs_position=Point(x=1, y=2, z=250),
critical_point=CriticalPoint.MOUNT,
),
times=1,
Expand All @@ -79,7 +87,7 @@ async def test_calibration_move_to_location_implementation(
decoy.verify(
await ot3_hardware_api.move_to(
mount=Mount.LEFT,
abs_position=Point(x=0, y=110, z=300),
abs_position=Point(x=0, y=110, z=250),
critical_point=CriticalPoint.MOUNT,
),
times=1,
Expand Down