Skip to content

Commit

Permalink
add open gripper position variable to STAR iswap pick up resource (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-ray authored Jan 24, 2025
1 parent 7f38fcc commit 2aaa0b0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions pylabrobot/liquid_handling/backends/hamilton/STAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -2743,7 +2743,7 @@ async def pick_up_resource(
minimum_traverse_height_at_beginning_of_a_command: Optional[float] = None,
z_position_at_the_command_end: Optional[float] = None,
plate_width_tolerance: float = 2.0,
hotel_open_gripper_position: Optional[float] = None,
open_gripper_position: Optional[float] = None,
hotel_depth=160.0,
hotel_clearance_height=7.5,
high_speed=False,
Expand Down Expand Up @@ -2771,13 +2771,13 @@ async def pick_up_resource(
)
z_position_at_the_command_end = z_position_at_the_command_end or self._traversal_height

if use_unsafe_hotel:
if hotel_open_gripper_position is None:
if pickup.direction in (GripDirection.FRONT, GripDirection.BACK):
hotel_open_gripper_position = pickup.resource.get_absolute_size_x() + 5
else:
hotel_open_gripper_position = pickup.resource.get_absolute_size_y() + 5
if open_gripper_position is None:
if use_unsafe_hotel:
open_gripper_position = plate_width + 5
else:
open_gripper_position = plate_width + 3

if use_unsafe_hotel:
await self.unsafe.get_from_hotel(
hotel_center_x_coord=round(abs(x) * 10),
hotel_center_y_coord=round(abs(y) * 10),
Expand All @@ -2789,7 +2789,7 @@ async def pick_up_resource(
clearance_height=round(hotel_clearance_height * 10),
hotel_depth=round(hotel_depth * 10),
grip_direction=pickup.direction,
open_gripper_position=round(hotel_open_gripper_position * 10),
open_gripper_position=round(open_gripper_position * 10),
traverse_height_at_beginning=round(traverse_height_at_beginning * 10),
z_position_at_end=round(z_position_at_the_command_end * 10),
high_acceleration_index=4 if high_speed else 1,
Expand All @@ -2816,7 +2816,7 @@ async def pick_up_resource(
),
z_position_at_the_command_end=round(z_position_at_the_command_end * 10),
grip_strength=iswap_grip_strength,
open_gripper_position=round(plate_width * 10) + 30,
open_gripper_position=round(open_gripper_position * 10),
plate_width=round(plate_width * 10) - 33,
plate_width_tolerance=round(plate_width_tolerance * 10),
collision_control_level=iswap_collision_control_level,
Expand Down Expand Up @@ -2869,7 +2869,7 @@ async def drop_resource(
return_core_gripper: bool = True,
minimum_traverse_height_at_beginning_of_a_command: Optional[float] = None,
z_position_at_the_command_end: Optional[float] = None,
hotel_open_gripper_position: Optional[float] = None,
open_gripper_position: Optional[float] = None,
hotel_depth=160.0,
hotel_clearance_height=7.5,
hotel_high_speed=False,
Expand Down Expand Up @@ -2915,15 +2915,18 @@ async def drop_resource(
x, y, z = drop.destination + center_in_absolute_space + drop.offset
z = z + drop.resource.get_absolute_size_z() - drop.pickup_distance_from_top

if open_gripper_position is None:
if use_unsafe_hotel:
open_gripper_position = plate_width + 5
else:
open_gripper_position = plate_width + 3

if use_unsafe_hotel:
# hotel: down forward down.
# down to level of the destination + the clearance height (so clearance height can be subtracted)
# hotel_depth is forward.
# clearance height is second down.

if hotel_open_gripper_position is None:
hotel_open_gripper_position = plate_width + 5

await self.unsafe.put_in_hotel(
hotel_center_x_coord=round(abs(x) * 10),
hotel_center_y_coord=round(abs(y) * 10),
Expand All @@ -2934,7 +2937,7 @@ async def drop_resource(
clearance_height=round(hotel_clearance_height * 10),
hotel_depth=round(hotel_depth * 10),
grip_direction=drop.direction,
open_gripper_position=round(hotel_open_gripper_position * 10),
open_gripper_position=round(open_gripper_position * 10),
traverse_height_at_beginning=round(traversal_height_start * 10),
z_position_at_end=round(z_position_at_the_command_end * 10),
high_acceleration_index=4 if hotel_high_speed else 1,
Expand All @@ -2956,7 +2959,7 @@ async def drop_resource(
}[drop.direction],
minimum_traverse_height_at_beginning_of_a_command=round(traversal_height_start * 10),
z_position_at_the_command_end=round(z_position_at_the_command_end * 10),
open_gripper_position=round(plate_width * 10) + 30,
open_gripper_position=round(open_gripper_position * 10),
collision_control_level=iswap_collision_control_level,
)
elif use_arm == "core":
Expand Down

0 comments on commit 2aaa0b0

Please sign in to comment.