Skip to content

Commit

Permalink
Rename get_all_labware_highest_z() -> get_all_obstacle_highest_z().
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed Dec 2, 2023
1 parent 8717eec commit 1a7366e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_api/core/engine/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def get_slot_center(self, slot_name: DeckSlotName) -> Point:

def get_highest_z(self) -> float:
"""Get the highest Z point of all deck items."""
return self._engine_client.state.geometry.get_all_labware_highest_z()
return self._engine_client.state.geometry.get_all_obstacle_highest_z()

def get_labware_cores(self) -> List[LabwareCore]:
"""Get all loaded labware cores."""
Expand Down
7 changes: 3 additions & 4 deletions api/src/opentrons/protocol_engine/state/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ def get_labware_highest_z(self, labware_id: str) -> float:

return self._get_highest_z_from_labware_data(labware_data)

# TODO(mc, 2022-06-24): rename this method
def get_all_labware_highest_z(self) -> float:
"""Get the highest Z-point across all labware."""
def get_all_obstacle_highest_z(self) -> float:
"""Get the highest Z-point across all obstacles that the instruments need to fly over."""
highest_labware_z = max(
(
self._get_highest_z_from_labware_data(lw_data)
Expand Down Expand Up @@ -134,7 +133,7 @@ def get_min_travel_z(
):
min_travel_z = self.get_labware_highest_z(labware_id)
else:
min_travel_z = self.get_all_labware_highest_z()
min_travel_z = self.get_all_obstacle_highest_z()
if minimum_z_height:
min_travel_z = max(min_travel_z, minimum_z_height)
return min_travel_z
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_engine/state/motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_movement_waypoints_to_addressable_area(
# TODO(jbl 11-28-2023) This may need to change for partial tip configurations on a 96
destination_cp = CriticalPoint.XY_CENTER

all_labware_highest_z = self._geometry.get_all_labware_highest_z()
all_labware_highest_z = self._geometry.get_all_obstacle_highest_z()
if minimum_z_height is None:
minimum_z_height = float("-inf")
min_travel_z = max(all_labware_highest_z, minimum_z_height)
Expand Down Expand Up @@ -215,7 +215,7 @@ def get_movement_waypoints_to_coords(
Ignored if `direct` is True. If lower than the default height,
the default is used; this can only increase the height, not decrease it.
"""
all_labware_highest_z = self._geometry.get_all_labware_highest_z()
all_labware_highest_z = self._geometry.get_all_obstacle_highest_z()
if additional_min_travel_z is None:
additional_min_travel_z = float("-inf")
min_travel_z = max(all_labware_highest_z, additional_min_travel_z)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ def test_get_highest_z(
) -> None:
"""It should return a slot center from engine state."""
decoy.when(
mock_engine_client.state.geometry.get_all_labware_highest_z()
mock_engine_client.state.geometry.get_all_obstacle_highest_z()
).then_return(9001)

result = subject.get_highest_z()
Expand Down
10 changes: 5 additions & 5 deletions api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def test_get_all_labware_highest_z_no_equipment(
decoy.when(labware_view.get_all()).then_return([])
decoy.when(addressable_area_view.get_all()).then_return([])

result = subject.get_all_labware_highest_z()
result = subject.get_all_obstacle_highest_z()

assert result == 0

Expand Down Expand Up @@ -524,7 +524,7 @@ def test_get_all_labware_highest_z(

plate_z = subject.get_labware_highest_z("plate-id")
reservoir_z = subject.get_labware_highest_z("reservoir-id")
all_z = subject.get_all_labware_highest_z()
all_z = subject.get_all_obstacle_highest_z()

# Should exclude the off-deck plate.
assert all_z == max(plate_z, reservoir_z)
Expand Down Expand Up @@ -585,7 +585,7 @@ def test_get_all_labware_highest_z_with_staging_area(
)

staging_z = subject.get_labware_highest_z("staging-id")
all_z = subject.get_all_labware_highest_z()
all_z = subject.get_all_obstacle_highest_z()

# Should exclude the off-deck plate.
assert all_z == staging_z
Expand All @@ -609,7 +609,7 @@ def test_get_all_labware_highest_z_with_modules(
decoy.when(module_view.get_overall_height("module-id-1")).then_return(42.0)
decoy.when(module_view.get_overall_height("module-id-2")).then_return(1337.0)

result = subject.get_all_labware_highest_z()
result = subject.get_all_obstacle_highest_z()

assert result == 1337.0

Expand All @@ -633,7 +633,7 @@ def test_get_all_labware_highest_z_with_addressable_area(
1337.0
)

result = subject.get_all_labware_highest_z()
result = subject.get_all_obstacle_highest_z()

assert result == 1337.0

Expand Down
6 changes: 3 additions & 3 deletions api/tests/opentrons/protocol_engine/state/test_motion_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def test_get_movement_waypoints_to_addressable_area(
decoy.when(
addressable_area_view.get_addressable_area_move_to_location("area-name")
).then_return(Point(x=3, y=3, z=3))
decoy.when(geometry_view.get_all_labware_highest_z()).then_return(42)
decoy.when(geometry_view.get_all_obstacle_highest_z()).then_return(42)

decoy.when(
addressable_area_view.get_addressable_area_base_slot("area-name")
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_get_movement_waypoints_to_coords(
dest = Point(4, 5, 6)
max_travel_z = 789

decoy.when(geometry_view.get_all_labware_highest_z()).then_return(
decoy.when(geometry_view.get_all_obstacle_highest_z()).then_return(
all_labware_highest_z
)

Expand Down Expand Up @@ -472,7 +472,7 @@ def test_get_movement_waypoints_to_coords_raises(
subject: MotionView,
) -> None:
"""It should raise FailedToPlanMoveError if motion_planning.get_waypoints raises."""
decoy.when(geometry_view.get_all_labware_highest_z()).then_return(123)
decoy.when(geometry_view.get_all_obstacle_highest_z()).then_return(123)
decoy.when(
# TODO(mm, 2022-06-22): We should use decoy.matchers.Anything() for all
# arguments. For some reason, Decoy does not match the call unless we
Expand Down

0 comments on commit 1a7366e

Please sign in to comment.