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
hardware controller changes
  • Loading branch information
caila-marashaj committed Jul 26, 2023
commit 155738b297919aacdd5444234c1fd34f7080cfbb
6 changes: 2 additions & 4 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,11 @@ async def tip_action(
tip_action: str = "home",
) -> None:
move_group = []
if tip_action == "clamp":
assert moves is not None
if moves is not None:
move_group = create_tip_action_group(
moves, [NodeId.pipette_left], tip_action
)
elif tip_action == "home":
assert distance is not None and velocity is not None
elif distance is not None and velocity is not None:
move_group = create_gear_motor_home_group(float(distance), float(velocity))
runner = MoveGroupRunner(
move_groups=[move_group],
Expand Down
61 changes: 25 additions & 36 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ async def cache_instruments(
)
if not skip_configure:
await self._configure_instruments()
if self._gantry_load == GantryLoad.HIGH_THROUGHPUT:
await self._backend.update_gear_motor_position()

async def _cache_instruments( # noqa: C901
self, require: Optional[Dict[top_types.Mount, PipetteName]] = None
Expand Down Expand Up @@ -732,35 +730,6 @@ async def home_z(
axes = list(Axis.ot3_mount_axes())
await self.home(axes)

async def home_gear_motors(self) -> None:
position_estimation_dict = axis_convert(self._backend.gear_motor_position, 0.0)
position_estimation_float = position_estimation_dict[Axis.P_L]
gear_motor_axis_bound = self._backend.axis_bounds[Axis.Q][1]
velocity = self._config.motion_settings.default_max_speed[
GantryLoad.HIGH_THROUGHPUT
][OT3AxisKind.Q]
if position_estimation_float is not None and position_estimation_float > 5.0:
position_valid = abs(position_estimation_float) < gear_motor_axis_bound
if position_valid:
position_dict = {Axis.Q: position_estimation_float}
safe_home_target = {Axis.Q: self._config.safe_home_distance}
moves = self._build_moves(position_dict, safe_home_target)

await self._backend.tip_action(moves=moves[0], tip_action="clamp")

distance = axis_convert(self._backend.gear_motor_position, 0.0)[
Axis.P_L
]
await self._backend.tip_action(
distance=distance, velocity=velocity, tip_action="home"
)
return
# if gear motor position is not known:
# start at the axis boundary, and move without acceleration
# to avoid crashing if the gear motors' positions are not available
await self._backend.tip_action(
distance=gear_motor_axis_bound, velocity=velocity, tip_action="home"
)

async def home_gripper_jaw(self) -> None:
"""
Expand Down Expand Up @@ -843,6 +812,8 @@ async def refresh_positions(self) -> None:
await self._backend.update_motor_status()
await self._cache_current_position()
await self._cache_encoder_position()
if self._gantry_load == GantryLoad.HIGH_THROUGHPUT:
await self._backend.update_gear_motor_position()

async def _cache_current_position(self) -> Dict[Axis, float]:
"""Cache current position from backend and return in absolute deck coords."""
Expand Down Expand Up @@ -1711,16 +1682,25 @@ async def _motor_pick_up_tip(
await self._move(target_down)
# perform pick up tip
await self._backend.update_gear_motor_position()
pipette_axis = Axis.of_main_tool_actuator(mount)
gear_origin_float = axis_convert(self._backend.gear_motor_position, 0.0)[
Axis.P_L
pipette_axis
]
gear_origin_dict = {Axis.Q: gear_origin_float}
clamp_move_target = pipette_spec.pick_up_distance
gear_target_dict = {Axis.Q: clamp_move_target}
clamp_moves = self._build_moves(gear_origin_dict, gear_target_dict)
await self._backend.tip_action(moves=clamp_moves[0], tip_action="clamp")

await self.home_gear_motors()
homing_velocity = self._config.motion_settings.default_max_speed[
GantryLoad.HIGH_THROUGHPUT
][OT3AxisKind.Q]
q_axis_distance = axis_convert(self._backend.gear_motor_position, 0.0)[Axis.P_L]
await self._backend.tip_action(
distance=(q_axis_distance + pipette_spec.home_buffer),
velocity=homing_velocity,
tip_action="home",
)

async def pick_up_tip(
self,
Expand Down Expand Up @@ -1796,12 +1776,21 @@ async def drop_tip(
gear_start_position = axis_convert(
self._backend.gear_motor_position, 0.0
)
drop_target_dict = {Axis.Q: move.target_position}
drop_moves = self._build_moves(gear_start_position, drop_target_dict)
pickup_target_dict = {Axis.Q: move.target_position}
drop_moves = self._build_moves(gear_start_position, pickup_target_dict)

await self._backend.tip_action(moves=drop_moves[0], tip_action="clamp")

await self.home_gear_motors()
homing_velocity = self._config.motion_settings.default_max_speed[
GantryLoad.HIGH_THROUGHPUT
][OT3AxisKind.Q]
pipette_axis = Axis.of_main_tool_actuator(mount)
q_axis_distance = axis_convert(self._backend.gear_motor_position, 0.0)[pipette_axis]
await self._backend.tip_action(
distance=(q_axis_distance + move.home_buffer),
velocity=homing_velocity,
tip_action="home",
)

else:
target_pos = target_position_from_plunger(
Expand Down
2 changes: 0 additions & 2 deletions api/tests/opentrons/hardware_control/test_ot3_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1715,8 +1715,6 @@ async def test_tip_presence_disabled_ninety_six_channel(
instr_data = AttachedPipette(config=pipette_config, id="fakepip")
await ot3_hardware.cache_pipette(OT3Mount.LEFT, instr_data, None)
await ot3_hardware._configure_instruments()
await ot3_hardware.set_gantry_load(GantryLoad.HIGH_THROUGHPUT)
# await ot3_hardware.cache_instruments()
await ot3_hardware.pick_up_tip(OT3Mount.LEFT, 60)

tip_present.assert_not_called()
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,23 @@ def _listener_filter(arbitration_id: ArbitrationId) -> bool:

data = []

with WaitableCallback(can_messenger, _listener_filter) as reader:
with MultipleMessagesWaitableCallback(
can_messenger,
_listener_filter,
2,
) as reader:
await can_messenger.send(
node_id=NodeId.pipette_left,
message=UpdateGearMotorPositionEstimationRequest(),
)
try:
for i in range(2):
response = await asyncio.wait_for(
_parser_update_gear_motor_position_response(
reader, NodeId.pipette_left
),
timeout,
)
data.append(response)
if not data[0][1] or not data[1][1]:
# If the stepper_ok flag isn't set, that means the node didn't update position.
raise RuntimeError(
f"Failed to update motor position for node: {NodeId.pipette_left}"
)
response = await asyncio.wait_for(
_parser_update_gear_motor_position_response(
reader, NodeId.pipette_left
),
timeout,
)
data.append(response)
except asyncio.TimeoutError:
log.warning("Update motor position estimation timed out")
return 0, False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def convert_pipette_model(
# to attached pipettes.
# We need to figure out how to default the pipette model as well
# rather than returning a p1000
breakpoint()
if model and not provided_version:
pipette_type, parsed_channels, parsed_version = model.split("_")
channels = channels_from_string(parsed_channels)
Expand Down