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

fix(api, shared-data): Allow labware lids to be disposed in the trash bin #16638

Merged
merged 7 commits into from
Oct 31, 2024

Conversation

CaseyBatten
Copy link
Contributor

@CaseyBatten CaseyBatten commented Oct 30, 2024

Overview

Covers PLAT-539

This allows the TC lid to be dropped in the trash bin at a slight offset. Originally we only allowed it to be dropped in the waste chute, but we need to let it be disposed of in some sanitary way in other disposal locations as well.

Test Plan and Hands on Testing

  • Verify that we don't collide with labware in slot above the trashbin when dropping the lid
  • Verify that stack of lids can fit within trash bin (do we need to implement some kind of alternation like with tips? Is that safe?)

The following protocol should move a TC lids from a stack on the deck into a trash bin:

from typing import List
from opentrons.protocol_api import ProtocolContext, Labware

metadata = {"protocolName": "Opentrons Flex TC Lid Trash Test"}
requirements = {"robotType": "Flex", "apiLevel": "2.20"}


LID_COUNT = 5
LID_DEFINITION = "opentrons_tough_pcr_auto_sealing_lid"
LID_BOTTOM_DEFINITION = "opentrons_tough_pcr_auto_sealing_lid"

def run(protocol: ProtocolContext):
    # Tiprack to occupy space above test trashbin for collision checking
    tiprack = protocol.load_labware("opentrons_flex_96_tiprack_200ul", 'C3')

    trash = protocol.load_trash_bin('D3')

    lids: List[Labware] = [protocol.load_labware(LID_BOTTOM_DEFINITION, 'D2')]
    for i in range(LID_COUNT - 1):
        lids.append(lids[-1].load_labware(LID_DEFINITION))
    lids.reverse()  # NOTE: reversing to more easily loop through lids from top-to-bottom

    for lid in lids:
        protocol.move_labware(
            lid,
            trash,
            use_gripper=True,
        )

Changelog

  • Allow loaded trashes to be passed as a destination for move_labware commands
  • Validated that when trashbins are a destination for labware, that the labware is exclusively a lid-type
  • Raise analysis errors for unsupported labware trashing behavior, and errors for trashing lids that don't specifically have dedicated trash offsets (double restriction)

Review requests

Do movements achieve what we want to unblock users without waste chutes? Do those analysis error messages make sense for when people try to do unsupported actions?

Risk assessment

This currently allows any labware with the allowed role of "Lid" to be dropped in the trash bin. This means users could start trashing other lids in the future, so we may want to limit this via a labware quirk instead. On the other hand, giving users a sanitary way to dispose of any and all future lid types even if they don't own a waste chute may be useful. Thoughts?

@CaseyBatten CaseyBatten requested a review from a team as a code owner October 30, 2024 15:03
@CaseyBatten CaseyBatten requested a review from a team as a code owner October 30, 2024 19:15
@CaseyBatten CaseyBatten changed the title fix(api): Allow labware lids to be disposed in the trash bin fix(api, shared-data): Allow labware lids to be disposed in the trash bin Oct 30, 2024
if labware_validation.validate_definition_is_lid(
self._state_view.labware.get_definition(params.labwareId)
):
self._state_view.labware.get_labware_gripper_offsets
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

secondary validation that the labware we are about to move to the trash is infact a lid. We validate this once at the PAPI call, but we validate it here to catch incase someone tries to do this during a maintenance run or through other direct-engine command implementations.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that i see, im talking specifically about

self._state_view.labware.get_labware_gripper_offsets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually just got that accidental variable call you highlighted on 178, thats unintentional good catch.

Comment on lines 179 to 193
if (
"lidDisposalOffsets"
in current_labware_definition.gripperOffsets.keys()
):
trash_lid_drop_offset = LabwareOffsetVector(
x=current_labware_definition.gripperOffsets[
"lidDisposalOffsets"
].dropOffset.x,
y=current_labware_definition.gripperOffsets[
"lidDisposalOffsets"
].dropOffset.y,
z=current_labware_definition.gripperOffsets[
"lidDisposalOffsets"
].dropOffset.z,
)
Copy link
Contributor

@vegano1 vegano1 Oct 30, 2024

Choose a reason for hiding this comment

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

Could change to

lid_disposable_offfets = current_labware_definition.gripperOffsets.get('lidDisposalOffsets')
if lis_disposable_offsets is not None:
    trash_lid_drop_offset = LabwareOffsetVector(**lid_disposable_offsets['dropOffset'])
else:
    raise ...

Copy link
Contributor

@vegano1 vegano1 left a comment

Choose a reason for hiding this comment

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

Very nice,
I left a few comments
I tested on the Flex and everything works as expected.

@CaseyBatten CaseyBatten merged commit ec7641c into chore_release-8.2.0 Oct 31, 2024
52 checks passed
@CaseyBatten CaseyBatten deleted the tc_lid_trash_bin branch October 31, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants