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(api): allow custom user offsets for deck configured trash bins and waste chute #14560

Merged
merged 16 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
move trash loading more to core
  • Loading branch information
jbleon95 committed Feb 26, 2024
commit 0dbf280f3751edc120983c79c3facd1bc2632eef
24 changes: 24 additions & 0 deletions api/src/opentrons/protocol_api/core/engine/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,30 @@ def load_instrument(
default_movement_speed=400,
)

def load_trash_bin(self, slot_name: DeckSlotName, area_name: str) -> TrashBin:
"""Load a deck configuration based trash bin.

Args:
slot_name: the slot the trash is being loaded into.
area_name: the addressable area name of the trash.

Returns:
A trash bin object.
"""
trash_bin = TrashBin(location=slot_name, addressable_area_name=area_name)
self.add_disposal_location_to_engine(trash_bin)
return trash_bin

def load_waste_chute(self) -> WasteChute:
"""Load a deck configured waste chute into Slot D3.

Returns:
A waste chute object.
"""
waste_chute = WasteChute()
self.add_disposal_location_to_engine(waste_chute)
return waste_chute

def pause(self, msg: Optional[str]) -> None:
"""Pause the protocol."""
self._engine_client.wait_for_resume(message=msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ def load_instrument(

return new_instr

def load_trash_bin(self, slot_name: DeckSlotName, area_name: str) -> TrashBin:
raise APIVersionError(
"Loading deck configured trash bin is not supported in this API version."
)

def load_waste_chute(self) -> WasteChute:
raise APIVersionError(
"Loading waste chute is not supported in this API version."
)

def get_loaded_instruments(
self,
) -> Dict[Mount, Optional[LegacyInstrumentCore]]:
Expand Down
8 changes: 8 additions & 0 deletions api/src/opentrons/protocol_api/core/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ def load_instrument(
) -> InstrumentCoreType:
...

@abstractmethod
def load_trash_bin(self, slot_name: DeckSlotName, area_name: str) -> TrashBin:
...

@abstractmethod
def load_waste_chute(self) -> WasteChute:
...

@abstractmethod
def pause(self, msg: Optional[str]) -> None:
...
Expand Down
13 changes: 4 additions & 9 deletions api/src/opentrons/protocol_api/protocol_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ def __init__(
elif should_load_fixed_trash_area_for_python_protocol(
self._api_version, self._core.robot_type
):
_fixed_trash_trashbin = TrashBin(
_fixed_trash_trash_bin = TrashBin(
location=DeckSlotName.FIXED_TRASH, addressable_area_name="fixedTrash"
)
# We are just appending the fixed trash to the core's internal list here, not adding it to the engine via
# the core, since that method works through the SyncClient and if called from here, will cause protocols
# to deadlock. Instead, that method is called in protocol engine directly in create_protocol_context after
# ProtocolContext is initialized.
self._core.append_disposal_location(_fixed_trash_trashbin)
self._core.append_disposal_location(_fixed_trash_trash_bin)

self._commands: List[str] = []
self._unsubscribe_commands: Optional[Callable[[], None]] = None
Expand Down Expand Up @@ -512,10 +512,7 @@ def load_trash_bin(self, location: DeckLocation) -> TrashBin:
api_version=self._api_version,
robot_type=self._core.robot_type,
)
trash_bin = TrashBin(
location=slot_name, addressable_area_name=addressable_area_name
)
self._core.add_disposal_location_to_engine(trash_bin)
trash_bin = self._core.load_trash_bin(slot_name, addressable_area_name)
return trash_bin

@requires_version(2, 16)
Expand All @@ -531,9 +528,7 @@ def load_waste_chute(
load another item in slot D3 after loading the waste chute, or vice versa, the
API will raise an error.
"""
waste_chute = WasteChute()
self._core.add_disposal_location_to_engine(waste_chute)
return waste_chute
return self._core.load_waste_chute()

@requires_version(2, 15)
def load_adapter(
Expand Down