Skip to content

Commit 09efb81

Browse files
fix(robot-server): use the current critical point when moving pipettes (#8331)
1 parent fb55f12 commit 09efb81

File tree

2 files changed

+12
-36
lines changed

2 files changed

+12
-36
lines changed

robot-server/robot_server/service/legacy/routers/control.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ThreadedAsyncLock,
99
ThreadedAsyncForbidden,
1010
)
11-
from opentrons.hardware_control.types import Axis, CriticalPoint
11+
from opentrons.hardware_control.types import Axis
1212
from opentrons.types import Mount, Point
1313

1414
from robot_server.errors import LegacyErrorResponse
@@ -147,28 +147,16 @@ async def post_robot_light_state(
147147

148148
async def _do_move(hardware: ThreadManager, robot_move_target: control.RobotMoveTarget):
149149
"""Perform the move"""
150-
await hardware.cache_instruments()
151-
152-
critical_point = None
153-
if robot_move_target.target == control.MotionTarget.mount:
154-
critical_point = CriticalPoint.MOUNT
155150

156151
mount = Mount[robot_move_target.mount.upper()]
157152
target_pos = Point(*robot_move_target.point)
158153

159154
# Reset z position
160155
await hardware.home_z()
161156

162-
gantry_position = hardware.gantry_position
163-
move_to = hardware.move_to
164-
165-
pos = await gantry_position(mount, critical_point=critical_point)
157+
pos = await hardware.gantry_position(mount)
166158
# Move to requested x, y and current z position
167-
await move_to(
168-
mount,
169-
Point(x=target_pos.x, y=target_pos.y, z=pos.z),
170-
critical_point=critical_point,
171-
)
159+
await hardware.move_to(mount, Point(x=target_pos.x, y=target_pos.y, z=pos.z))
172160
# Move to requested z position
173-
await move_to(mount, target_pos, critical_point=critical_point)
174-
return await gantry_position(mount)
161+
await hardware.move_to(mount, target_pos)
162+
return await hardware.gantry_position(mount)

robot-server/tests/service/legacy/routers/test_control.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from mock import call, MagicMock
33

44
import pytest
5-
from opentrons.hardware_control.types import Axis, CriticalPoint
5+
from opentrons.hardware_control.types import Axis
66
from opentrons.types import Mount, Point
77

88
from robot_server.errors import ApiError
@@ -116,26 +116,16 @@ def test_move_mount(api_client, hardware_move):
116116
"message": "Move complete. New position: (100.0, 200.0, 50.0)"
117117
}
118118

119-
hardware_move.cache_instruments.assert_called_once()
120-
121119
hardware_move.gantry_position.assert_has_calls(
122120
[
123-
call(Mount.RIGHT, critical_point=CriticalPoint.MOUNT),
121+
call(Mount.RIGHT),
124122
call(Mount.RIGHT),
125123
]
126124
)
127125
hardware_move.move_to.assert_has_calls(
128126
[
129-
call(
130-
Mount.RIGHT,
131-
Point(100.0, 200.0, 0.0),
132-
critical_point=CriticalPoint.MOUNT,
133-
),
134-
call(
135-
Mount.RIGHT,
136-
Point(100.0, 200.0, 50.0),
137-
critical_point=CriticalPoint.MOUNT,
138-
),
127+
call(Mount.RIGHT, Point(100.0, 200.0, 0.0)),
128+
call(Mount.RIGHT, Point(100.0, 200.0, 50.0)),
139129
]
140130
)
141131

@@ -151,18 +141,16 @@ def test_move_pipette(api_client, hardware_move):
151141
assert res.status_code == 200
152142
assert res.json() == {"message": "Move complete. New position: (50.0, 100.0, 25.0)"}
153143

154-
hardware_move.cache_instruments.assert_called_once()
155-
156144
hardware_move.gantry_position.assert_has_calls(
157145
[
158-
call(Mount.LEFT, critical_point=None),
146+
call(Mount.LEFT),
159147
call(Mount.LEFT),
160148
]
161149
)
162150
hardware_move.move_to.assert_has_calls(
163151
[
164-
call(Mount.LEFT, Point(50.0, 100.0, 0.0), critical_point=None),
165-
call(Mount.LEFT, Point(50.0, 100.0, 25.0), critical_point=None),
152+
call(Mount.LEFT, Point(50.0, 100.0, 0.0)),
153+
call(Mount.LEFT, Point(50.0, 100.0, 25.0)),
166154
]
167155
)
168156

0 commit comments

Comments
 (0)