Skip to content

Commit

Permalink
make the nodes pipette nodes but include them if their mount is moving
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed May 22, 2024
1 parent 0ae8629 commit 80a317d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 3 additions & 7 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
motor_nodes,
LIMIT_SWITCH_OVERTRAVEL_DISTANCE,
map_pipette_type_to_sensor_id,
moving_axes_in_move_group,
moving_pipettes_in_move_group,
gripper_jaw_state_from_fw,
get_system_constraints,
get_system_constraints_for_calibration,
Expand Down Expand Up @@ -664,12 +664,8 @@ async def move(
else False,
)

mounts_moving = [
k
for k in moving_axes_in_move_group(move_group)
if k
in [NodeId.pipette_left, NodeId.pipette_right, NodeId.head_l, NodeId.head_r]
]
mounts_moving = moving_pipettes_in_move_group(move_group)

async with self._monitor_overpressure(mounts_moving):
positions = await runner.run(can_messenger=self._messenger)
self._handle_motor_status_response(positions)
Expand Down
14 changes: 14 additions & 0 deletions api/src/opentrons/hardware_control/backends/ot3utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,20 @@ def create_gripper_jaw_hold_group(encoder_position_um: int) -> MoveGroup:
return move_group


def moving_pipettes_in_move_group(group: MoveGroup) -> List[NodeId]:
"""Utility function to get which pipette nodes are moving either in z or their plunger."""
all_nodes = [node for step in group for node, _ in step.items()]
moving_nodes = moving_axes_in_move_group(group)
pipettes_moving: List[NodeId] = [
k for k in moving_nodes if k in [NodeId.pipette_left, NodeId.pipette_right]
]
if NodeId.head_l in moving_nodes and NodeId.pipette_left in all_nodes:
pipettes_moving.append(NodeId.pipette_left)
if NodeId.head_r in moving_nodes and NodeId.pipette_right in all_nodes:
pipettes_moving.append(NodeId.pipette_right)
return pipettes_moving


def moving_axes_in_move_group(group: MoveGroup) -> Set[NodeId]:
"""Utility function to get only the moving nodes in a move group."""
ret: Set[NodeId] = set()
Expand Down

0 comments on commit 80a317d

Please sign in to comment.