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

feat(hardware): add acceleration to pick up tip for 96 channel #12944

Merged
merged 28 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
95d068b
add acceleration to tip_action
caila-marashaj Jun 15, 2023
b4d4bee
pick up tip move happens, but rumbly
caila-marashaj Jun 21, 2023
bdea049
linter stuff cleanup
caila-marashaj Jun 21, 2023
782a760
fixed position of acceleration in tipaction msg
caila-marashaj Jun 22, 2023
73d26bf
moving but delayed
caila-marashaj Jun 27, 2023
c3e044a
modify tip action, debugging code still in there
caila-marashaj Jun 28, 2023
a85074e
mostly working but returning position too early
caila-marashaj Jun 29, 2023
1952348
need to update tests
caila-marashaj Jul 6, 2023
fa194a3
updated unit test args for tip_action
caila-marashaj Jul 17, 2023
d2e7927
rebase
caila-marashaj Jul 17, 2023
2b20a20
rough final draft
caila-marashaj Jul 18, 2023
8cf3c15
cleanup
caila-marashaj Jul 18, 2023
7e5b7ef
format
caila-marashaj Jul 18, 2023
8ace0ef
remove redundant data check from gear motors
caila-marashaj Jul 18, 2023
155738b
hardware controller changes
caila-marashaj Jul 19, 2023
0aede03
increase backward distances
caila-marashaj Jul 20, 2023
97e12e9
changed helpers_ot3 function
caila-marashaj Jul 21, 2023
1550c9a
format
caila-marashaj Jul 21, 2023
735ebe7
helpers_ot3 function change
caila-marashaj Jul 21, 2023
af1eefa
got rid of copysign call
caila-marashaj Jul 21, 2023
e2280aa
check if speed exists
caila-marashaj Jul 21, 2023
5be4492
add deafult value to axis convert call
caila-marashaj Jul 24, 2023
93ef4ca
update gear motor position handling after move
caila-marashaj Jul 25, 2023
f1a42d1
test fix
caila-marashaj Jul 25, 2023
2b71f07
moved comments
caila-marashaj Jul 26, 2023
57bb955
remove updategearmotorpositionestimation msg
caila-marashaj Jul 26, 2023
e201a43
removed more unneeded code
caila-marashaj Jul 26, 2023
6eb76e6
address change reqs
caila-marashaj Jul 27, 2023
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
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
caila-marashaj committed Jul 26, 2023
commit 8cf3c156a8ef283679f4365065de9b9b33f4b17b
17 changes: 9 additions & 8 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,15 @@ async def home(
]
async with self._monitor_overpressure(moving_pipettes):
positions = await asyncio.gather(*coros)
# if Axis.Q in checked_axes:
# await self.tip_action(
# [Axis.Q],
# self.axis_bounds[Axis.Q][1] - self.axis_bounds[Axis.Q][0],
# self._configuration.motion_settings.max_speed_discontinuity.high_throughput[
# Axis.to_kind(Axis.Q)
# ],
# )
# TODO(CM): default gear motor homing routine to have some acceleration
if Axis.Q in checked_axes:
await self.tip_action(
distance=self.axis_bounds[Axis.Q][1] - self.axis_bounds[Axis.Q][0],
velocity=self._configuration.motion_settings.max_speed_discontinuity.high_throughput[
Axis.to_kind(Axis.Q)
],
tip_action="home",
)
for position in positions:
self._handle_motor_status_response(position)
return axis_convert(self._position, 0.0)
Expand Down
1 change: 0 additions & 1 deletion api/src/opentrons/hardware_control/backends/ot3utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def get_system_constraints(
conf_by_pip["direction_change_speed_discontinuity"][axis_kind],
conf_by_pip["default_max_speed"][axis_kind],
)

return constraints


Expand Down
11 changes: 1 addition & 10 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ async def _home(self, axes: Sequence[Axis]) -> None:
if axis == Axis.G:
await self.home_gripper_jaw()
elif axis == Axis.Q:
await self.home_gear_motors()
await self._backend.home([axis], self.gantry_load)
else:
await self._home_axis(axis)
except ZeroLengthMoveError:
Expand Down Expand Up @@ -1710,7 +1710,6 @@ async def _motor_pick_up_tip(
)
await self._move(target_down)
# perform pick up tip

await self._backend.update_gear_motor_position()
gear_origin_float = axis_convert(self._backend.gear_motor_position, 0.0)[
Axis.P_L
caila-marashaj marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -1793,7 +1792,6 @@ async def drop_tip(
if move.is_ht_tip_action and move.speed:
# The speed check is needed because speed can sometimes be None.
# Not sure why

await self._backend.update_gear_motor_position()
gear_start_position = axis_convert(
self._backend.gear_motor_position, 0.0
Expand All @@ -1804,13 +1802,6 @@ async def drop_tip(
await self._backend.tip_action(moves=drop_moves[0], tip_action="clamp")

await self.home_gear_motors()
caila-marashaj marked this conversation as resolved.
Show resolved Hide resolved
# await self._backend.update_gear_motor_position()
# gear_pos_float = axis_convert(self._backend.gear_motor_position, 0.0)[AxisP_L]
# gear_pos_dict = {AxisQ: gear_pos_float}
# home_target_dict = {AxisQ: 0.0}
# home_moves = self._build_moves(gear_pos_dict, home_target_dict)

# await self._backend.tip_action(moves=home_moves[0], tip_action="home")

else:
target_pos = target_position_from_plunger(
Expand Down
3 changes: 0 additions & 3 deletions api/tests/opentrons/hardware_control/test_ot3_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,11 +1401,9 @@ def _update_gear_motor_pos(
tip_action.side_effect = _update_gear_motor_pos
await ot3_hardware.set_gantry_load(GantryLoad.HIGH_THROUGHPUT)
await ot3_hardware.pick_up_tip(Mount.LEFT, 40.0)
# backend._gear_motor_position = 10
pipette_handler.plan_check_pick_up_tip.assert_called_once_with(
OT3Mount.LEFT, 40.0, None, None
)
# breakpoint()
# first call should be "clamp", moving down
assert tip_action.call_args_list[0][-1]["tip_action"] == "clamp"
assert tip_action.call_args_list[0][-1]["moves"][0].unit_vector == {Axis.Q: 1}
Expand Down Expand Up @@ -1445,7 +1443,6 @@ def _fake_function():
),
_fake_function,
)

def _update_gear_motor_pos(
moves: Optional[List[Move[Axis]]] = None,
distance: Optional[float] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def _listener_filter(arbitration_id: ArbitrationId) -> bool:
MessageId(arbitration_id.parts.message_id)
in [
UpdateGearMotorPositionEstimationResponse.message_id,
# TipActionResponse.message_id,
]
)

Expand Down Expand Up @@ -217,9 +216,7 @@ async def _parser_update_gear_motor_position_response(
reader: WaitableCallback, expected: NodeId
) -> Tuple[float, bool]:
async for response, arb_id in reader:
if isinstance(
response, UpdateGearMotorPositionEstimationResponse
): # or isinstance(response, TipActionResponse):
if isinstance(response, UpdateGearMotorPositionEstimationResponse):
node = NodeId(arb_id.parts.originating_node_id)
if node == expected:
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,16 @@ def _remove_move_group(
group_id = message.payload.group_id.value - self._start_at_index
node_id = arbitration_id.parts.originating_node_id
try:

in_group = (node_id, seq_id) in self._moves[group_id]
self._moves[group_id].remove((node_id, seq_id))
self._completion_queue.put_nowait((arbitration_id, message))
log.debug(
f"Received completion for {node_id} group {group_id} seq {seq_id}"
f", which {'is' if in_group else 'isn''t'} in group"
)

if not self._moves[group_id]:
log.debug(f"Move group {group_id+self._start_at_index} has completed.")
self._event.set()

except KeyError:
log.warning(
f"Got a move ack for ({node_id}, {seq_id}) which is not in this "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,17 +800,17 @@ async def test_tip_action_move_runner_position_updated(
assert completion_message[0][1].payload.current_position_um.value == 2000


# async def test_tip_action_move_runner_fail_receives_one_response(
# mock_can_messenger: AsyncMock, move_group_tip_action: MoveGroups, caplog: Any
# ) -> None:
# """Tip action move should fail if one or less responses received."""
# subject = MoveScheduler(move_groups=move_group_tip_action)
# mock_sender = MockSendMoveCompleter(move_group_tip_action, subject)
# mock_can_messenger.ensure_send.side_effect = mock_sender.mock_ensure_send_failure
# mock_can_messenger.send.side_effect = mock_sender.mock_send_failure

# with pytest.raises(MotionFailedError):
# await subject.run(can_messenger=mock_can_messenger)
async def test_tip_action_move_runner_fail_receives_one_response(
mock_can_messenger: AsyncMock, move_group_tip_action: MoveGroups, caplog: Any
) -> None:
"""Tip action move should fail if one or less responses received."""
subject = MoveScheduler(move_groups=move_group_tip_action)
mock_sender = MockSendMoveCompleter(move_group_tip_action, subject)
mock_can_messenger.ensure_send.side_effect = mock_sender.mock_ensure_send_failure
mock_can_messenger.send.side_effect = mock_sender.mock_send_failure

with pytest.raises(MotionFailedError):
await subject.run(can_messenger=mock_can_messenger)


async def test_multi_group_move(
Expand Down