Skip to content

Commit ef722ba

Browse files
authored
fix(robot-server): pip offset: save offset from reference point (#6586)
1 parent eb058a2 commit ef722ba

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

robot-server/robot_server/robot/calibration/pipette_offset/user_flow.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def __init__(self,
6161
self._current_state = State.sessionStarted
6262
self._state_machine = PipetteOffsetCalibrationStateMachine()
6363

64+
point_one_pos = \
65+
self._deck.get_calibration_position(POINT_ONE_ID).position
66+
self._cal_ref_point = Point(*point_one_pos)
67+
6468
self._tip_origin_pt: Optional[Point] = None
6569

6670
self._command_map: COMMAND_MAP = {
@@ -173,20 +177,24 @@ async def move_to_deck(self):
173177
async def move_to_point_one(self):
174178
assert self._z_height_reference is not None, \
175179
"saveOffset has not been called yet"
176-
coords = self._deck.get_calibration_position(POINT_ONE_ID).position
177-
point_loc = Location(Point(*coords), None)
178-
await self._move(
179-
point_loc.move(point=Point(0, 0, self._z_height_reference)))
180+
target_loc = Location(self._cal_ref_point, None)
181+
target = target_loc.move(
182+
point=Point(0, 0, self._z_height_reference))
183+
await self._move(target)
180184

181185
async def save_offset(self):
182186
cur_pt = await self._get_current_point(critical_point=None)
183187
if self.current_state == State.joggingToDeck:
184188
self._z_height_reference = cur_pt.z
185189
elif self._current_state == State.savingPointOne:
190+
if self._hw_pipette.config.channels > 1:
191+
cur_pt = await self._get_current_point(
192+
critical_point=CriticalPoint.FRONT_NOZZLE)
186193
tiprack_hash = helpers.hash_labware_def(
187194
self._tip_rack._definition)
195+
offset = self._cal_ref_point - cur_pt
188196
modify.save_pipette_calibration(
189-
offset=cur_pt,
197+
offset=offset,
190198
mount=self._mount,
191199
pip_id=self._hw_pipette.pipette_id,
192200
tiprack_hash=tiprack_hash,

robot-server/tests/robot/calibration/pipette_offset/test_user_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ def mock_save_pipette_offset(*args, **kwargs):
215215

216216
await uf.save_offset()
217217
tiprack_hash = helpers.hash_labware_def(uf._tip_rack._definition)
218-
218+
offset = uf._cal_ref_point - Point(x=10, y=10, z=40)
219219
modify.save_pipette_calibration.assert_called_with(
220-
offset=Point(x=10, y=10, z=40),
220+
offset=offset,
221221
mount=uf._mount,
222222
pip_id=uf._hw_pipette.pipette_id,
223223
tiprack_hash=tiprack_hash,

0 commit comments

Comments
 (0)