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(api, shared-data): make speed & distance pickUpTipConfigurations values keyed by tip count #14458

Merged
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 @@ -771,7 +771,7 @@ def plan_check_pick_up_tip( # type: ignore[no-untyped-def]
if instrument.has_tip:
raise UnexpectedTipAttachError("pick_up_tip", instrument.name, mount.name)
self._ihp_log.debug(f"Picking up tip on {mount.name}")

tip_count = instrument.nozzle_manager.current_configuration.tip_count
if presses is None or presses < 0:
checked_presses = instrument.pick_up_configurations.press_fit.presses
else:
Expand All @@ -782,17 +782,20 @@ def plan_check_pick_up_tip( # type: ignore[no-untyped-def]
else:
check_incr = increment

pick_up_speed = instrument.pick_up_configurations.press_fit.speed
pick_up_speed = instrument.pick_up_configurations.press_fit.speed_by_tip_count[
tip_count
]
pick_up_distance = (
instrument.pick_up_configurations.press_fit.distance_by_tip_count[tip_count]
)

def build_presses() -> Iterator[Tuple[float, float]]:
# Press the nozzle into the tip <presses> number of times,
# moving further by <increment> mm after each press
for i in range(checked_presses):
# move nozzle down into the tip
press_dist = (
-1.0 * instrument.pick_up_configurations.press_fit.distance
+ -1.0 * check_incr * i
)

press_dist = -1.0 * pick_up_distance + -1.0 * check_incr * i
# move nozzle back up
backup_dist = -press_dist
yield (press_dist, backup_dist)
Expand All @@ -814,7 +817,7 @@ def add_tip_to_instr() -> None:
Axis.by_mount(
mount
): instrument.pick_up_configurations.press_fit.current_by_tip_count[
instrument.nozzle_manager.current_configuration.tip_count
tip_count
]
},
speed=pick_up_speed,
Expand All @@ -824,9 +827,7 @@ def add_tip_to_instr() -> None:
for press_dist, backup_dist in build_presses()
],
shake_off_list=self._build_pickup_shakes(instrument),
retract_target=instrument.pick_up_configurations.press_fit.distance
+ check_incr * checked_presses
+ 2,
retract_target=pick_up_distance + check_incr * checked_presses + 2,
),
add_tip_to_instr,
)
Expand Down Expand Up @@ -855,9 +856,7 @@ def add_tip_to_instr() -> None:
for press_dist, backup_dist in build_presses()
],
shake_off_list=self._build_pickup_shakes(instrument),
retract_target=instrument.pick_up_configurations.press_fit.distance
+ check_incr * checked_presses
+ 2,
retract_target=pick_up_distance + check_incr * checked_presses + 2,
),
add_tip_to_instr,
)
Expand Down
12 changes: 11 additions & 1 deletion api/src/opentrons/hardware_control/instruments/ot3/pipette.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,18 @@ def get_pick_up_configuration_for_tip_count(
):
if not config:
continue
if count in config.current_by_tip_count:

if isinstance(config, PressFitPickUpTipConfiguration) and all(
[
config.speed_by_tip_count.get(count),
config.distance_by_tip_count.get(count),
config.current_by_tip_count.get(count),
]
):
return config
elif config.current_by_tip_count.get(count) is not None:
return config

raise CommandPreconditionViolated(
message=f"No pick up tip configuration for {count} tips",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,15 +794,18 @@ def plan_lt_pick_up_tip(
else:
check_incr = increment

pick_up_speed = pick_up_config.speed
pick_up_speed = pick_up_config.speed_by_tip_count[tip_count]

def build_presses() -> List[TipActionMoveSpec]:
# Press the nozzle into the tip <presses> number of times,
# moving further by <increment> mm after each press
press_moves = []
for i in range(checked_presses):
# move nozzle down into the tip
press_dist = -1.0 * pick_up_config.distance + -1.0 * check_incr * i
press_dist = (
-1.0 * pick_up_config.distance_by_tip_count[tip_count]
+ -1.0 * check_incr * i
)
press_moves.append(
TipActionMoveSpec(
distance=press_dist,
Expand Down
12 changes: 8 additions & 4 deletions api/tests/opentrons/hardware_control/test_pipette_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ def test_plan_check_pick_up_tip_with_presses_argument(
decoy.when(mock_pipette.pick_up_configurations.press_fit.presses).then_return(
expected_array_length
)
decoy.when(mock_pipette.pick_up_configurations.press_fit.distance).then_return(5)
decoy.when(
mock_pipette.pick_up_configurations.press_fit.distance_by_tip_count
).then_return({1: 5})
decoy.when(mock_pipette.pick_up_configurations.press_fit.increment).then_return(0)
decoy.when(mock_pipette.pick_up_configurations.press_fit.speed).then_return(10)
decoy.when(
mock_pipette.pick_up_configurations.press_fit.speed_by_tip_count
).then_return({1: 10})
decoy.when(mock_pipette.config.end_tip_action_retract_distance_mm).then_return(0)
decoy.when(
mock_pipette.pick_up_configurations.press_fit.current_by_tip_count
Expand Down Expand Up @@ -171,8 +175,8 @@ def test_plan_check_pick_up_tip_with_presses_argument_ot3(
else PressFitPickUpTipConfiguration(
presses=2,
increment=increment,
distance=10,
speed=5.5,
distanceByTipCount={channels: 10},
speedByTipCount={channels: 5.5},
currentByTipCount={channels: 1.0},
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,12 @@ async def update_pick_up_current(
async def update_pick_up_distance(
api: OT3API, mount: OT3Mount, distance: float = 17.0
) -> None:
"""Update pick-up-tip current."""
"""Update pick-up-tip distance."""
pipette = _get_pipette_from_mount(api, mount)
config_model = pipette.pick_up_configurations.press_fit
config_model.distance = distance
config_model.distance_by_tip_count = {
k: distance for k in config_model.distance_by_tip_count.keys()
}
pipette.pick_up_configurations.press_fit = config_model


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
"displayCategory": "GEN1",
"pickUpTipConfigurations": {
"pressFit": {
"speed": 30.0,
"speedByTipCount": {
"1": 30.0,
"2": 30.0,
"3": 30.0,
"4": 30.0,
"5": 30.0,
"6": 30.0,
"7": 30.0,
"8": 30.0
},
"presses": 3,
"increment": 1.0,
"distance": 10.0,
"distanceByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"currentByTipCount": {
"1": 0.1,
"2": 0.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
"displayCategory": "GEN1",
"pickUpTipConfigurations": {
"pressFit": {
"speed": 30.0,
"speedByTipCount": {
"1": 30.0,
"2": 30.0,
"3": 30.0,
"4": 30.0,
"5": 30.0,
"6": 30.0,
"7": 30.0,
"8": 30.0
},
"presses": 3,
"increment": 1.0,
"distance": 10.0,
"distanceByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"currentByTipCount": {
"1": 0.1,
"2": 0.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
"displayCategory": "GEN1",
"pickUpTipConfigurations": {
"pressFit": {
"speed": 30.0,
"speedByTipCount": {
"1": 30.0,
"2": 30.0,
"3": 30.0,
"4": 30.0,
"5": 30.0,
"6": 30.0,
"7": 30.0,
"8": 30.0
},
"presses": 3,
"increment": 1.0,
"distance": 10.0,
"distanceByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"currentByTipCount": {
"1": 0.1,
"2": 0.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
"displayCategory": "GEN1",
"pickUpTipConfigurations": {
"pressFit": {
"speed": 30.0,
"speedByTipCount": {
"1": 30.0,
"2": 30.0,
"3": 30.0,
"4": 30.0,
"5": 30.0,
"6": 30.0,
"7": 30.0,
"8": 30.0
},
"presses": 3,
"increment": 3.0,
"distance": 10.0,
"distanceByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"currentByTipCount": {
"1": 0.1,
"2": 0.14,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
"displayCategory": "GEN1",
"pickUpTipConfigurations": {
"pressFit": {
"speed": 30.0,
"speedByTipCount": {
"1": 30.0,
"2": 30.0,
"3": 30.0,
"4": 30.0,
"5": 30.0,
"6": 30.0,
"7": 30.0,
"8": 30.0
},
"presses": 3,
"increment": 3.0,
"distance": 10.0,
"distanceByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"currentByTipCount": {
"1": 0.1,
"2": 0.14,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@
"pickUpTipConfigurations": {
"pressFit": {
"presses": 1,
"speed": 10,
"speedByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"increment": 0.0,
"distance": 13.0,
"distanceByTipCount": {
"1": 13.0,
"2": 13.0,
"3": 13.0,
"4": 13.0,
"5": 13.0,
"6": 13.0,
"7": 13.0,
"8": 13.0
},
"currentByTipCount": {
"1": 0.15,
"2": 0.13,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@
"pickUpTipConfigurations": {
"pressFit": {
"presses": 1,
"speed": 10,
"speedByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"increment": 0.0,
"distance": 13.0,
"distanceByTipCount": {
"1": 13.0,
"2": 13.0,
"3": 13.0,
"4": 13.0,
"5": 13.0,
"6": 13.0,
"7": 13.0,
"8": 13.0
},
"currentByTipCount": {
"1": 0.15,
"2": 0.13,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@
"pickUpTipConfigurations": {
"pressFit": {
"presses": 1,
"speed": 10,
"speedByTipCount": {
"1": 10.0,
"2": 10.0,
"3": 10.0,
"4": 10.0,
"5": 10.0,
"6": 10.0,
"7": 10.0,
"8": 10.0
},
"increment": 0.0,
"distance": 13.0,
"distanceByTipCount": {
"1": 13.0,
"2": 13.0,
"3": 13.0,
"4": 13.0,
"5": 13.0,
"6": 13.0,
"7": 13.0,
"8": 13.0
},
"currentByTipCount": {
"1": 0.15,
"2": 0.13,
Expand Down
Loading
Loading