Skip to content
Open
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
2 changes: 1 addition & 1 deletion pylabrobot/resources/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Deck(Resource):
def __init__(
self,
name: str = "deck",
size_x: float = 1360,
size_x: float = 1005,
size_y: float = 653.5,
size_z: float = 900,
origin: Coordinate = Coordinate(0, 0, 0),
Expand Down
47 changes: 24 additions & 23 deletions pylabrobot/resources/hamilton/hamilton_decks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
_RAILS_WIDTH = 22.5 # space between rails (mm)

STARLET_NUM_RAILS = 32
STARLET_SIZE_X = 1360
STARLET_SIZE_X = 1005
STARLET_SIZE_Y = 653.5
STARLET_SIZE_Z = 900

STAR_NUM_RAILS = 56
STAR_SIZE_X = 1900
STAR_SIZE_X = 1545
STAR_SIZE_Y = 653.5
STAR_SIZE_Z = 900

Expand Down Expand Up @@ -170,7 +170,7 @@ def assign_child_resource(

def should_check_collision(res: Resource) -> bool:
"""Determine if collision detection should be performed for this resource."""
if isinstance(res, HamiltonCoreGrippers):
if isinstance(res, (HamiltonCoreGrippers, Trash)):
return False
return True

Expand Down Expand Up @@ -437,6 +437,7 @@ def __init__(
name="deck",
category: str = "deck",
origin: Coordinate = Coordinate.zero(),
with_waste_block: bool = True,
with_trash: bool = True,
with_trash96: bool = True,
with_teaching_rack: bool = True,
Expand All @@ -456,17 +457,6 @@ def __init__(
origin=origin,
)

# assign trash area
if with_trash:
trash_x = (
size_x - 560
) # only tested on STARLet, assume STAR is same distance from right max..

self.assign_child_resource(
resource=Trash("trash", size_x=0, size_y=241.2, size_z=0),
location=Coordinate(x=trash_x, y=190.6, z=137.1),
) # z I am not sure about

self._trash96: Optional[Trash] = None
if with_trash96:
# got this location from a .lay file, but will probably need to be adjusted by the user.
Expand All @@ -476,8 +466,14 @@ def __init__(
location=Coordinate(x=-42.0 - 16.2, y=120.3 - 14.3, z=216.4),
)

if with_teaching_rack:
if with_waste_block:
waste_block = Resource(name="waste_block", size_x=30, size_y=445.2, size_z=100)
self.assign_child_resource(
waste_block,
location=Coordinate(x=self.rails_to_location(self.num_rails - 1).x, y=115.0, z=100),
)

if with_teaching_rack:
tip_spots = [
TipSpot(
name=f"tip_spot_{i}",
Expand All @@ -501,15 +497,19 @@ def __init__(
model="hamilton_teaching_tip_rack",
)
waste_block.assign_child_resource(teaching_tip_rack, location=Coordinate(x=5.9, y=346.1, z=0))
self.assign_child_resource(
waste_block,
location=Coordinate(x=self.rails_to_location(self.num_rails - 1).x, y=115.0, z=100),
)

if core_grippers is not None and not with_teaching_rack:
raise ValueError(
"core_grippers can only be added when with_teaching_rack is True, "
"as they are attached to the waste block."
# assign trash area, positioned 25mm to the right of the waste block
if with_trash:
if with_waste_block:
waste_block_x = self.get_resource("waste_block").get_location_wrt(self).x
else:
# Fallback: anchor to the rightmost rail when no waste block is present.
waste_block_x = self.rails_to_location(self.num_rails - 1).x
trash_x = waste_block_x + 25

self.assign_child_resource(
resource=Trash("trash", size_x=0, size_y=241.2, size_z=0),
location=Coordinate(x=trash_x, y=190.6, z=137.1),
)

if core_grippers == "1000uL-at-waste": # "at waste"
Expand All @@ -530,6 +530,7 @@ def __init__(
def serialize(self) -> dict:
return {
**super().serialize(),
"with_waste_block": False, # data encoded as child. (not very pretty to have this key though...)
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The serialized value for with_waste_block should reflect the actual parameter value passed to __init__, not be hardcoded to False. This will cause incorrect deserialization when the deck was created with with_waste_block=True.

Suggested change
"with_waste_block": False, # data encoded as child. (not very pretty to have this key though...)
"with_waste_block": any(child.name == "waste_block" for child in self.children),

Copilot uses AI. Check for mistakes.
"with_teaching_rack": False, # data encoded as child. (not very pretty to have this key though...)
"core_grippers": None, # data encoded as child. (not very pretty to have this key though...)
}
Expand Down