diff --git a/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py b/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py index cc46b0a18b5..9d0195adc51 100644 --- a/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py +++ b/api/src/opentrons/protocol_engine/commands/calibration/move_to_maintenance_position.py @@ -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: @@ -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, diff --git a/api/tests/opentrons/protocol_engine/commands/calibration/test_move_to_maintenance_position.py b/api/tests/opentrons/protocol_engine/commands/calibration/test_move_to_maintenance_position.py index 411122fd48c..3f1564c625c 100644 --- a/api/tests/opentrons/protocol_engine/commands/calibration/test_move_to_maintenance_position.py +++ b/api/tests/opentrons/protocol_engine/commands/calibration/test_move_to_maintenance_position.py @@ -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) @@ -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, @@ -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,