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): Addition of Cutout Fixtures to slot height checks #14371

Merged
merged 7 commits into from
Jan 31, 2024

Conversation

CaseyBatten
Copy link
Contributor

@CaseyBatten CaseyBatten commented Jan 29, 2024

Overview

This seeks to fix issues related to RSS-375 and RSS-422.

Of note, this will only fix issues during runtime. Currently when in partial tip configuration the engine will attempt to check the height of object adjacent to the slot that an action (such as pickup tip) is occurring in. However, only the heigh of labware and module is checked, the system does not check for the height of fixtures loaded into the deck configuration.

To solve this, a method has been added to allow for searching of Cutout fixtures by deck slot name, and then the height of a returned fixture is then checked alongside the labware and module heights. If, for example a waste chute is loaded in D3 and a partial tip pickup is attempted in D2, the engine will raise an error.

Test Plan

Ensure that a protocol with a waste chute loaded in D3 with a 96 channel in partial tip configuration set to pick up tips from column A12 of a tiprack in D2 using column A1 of the instrument raises an error during operation before a collision would occur.
The following protocol ought to produce the expected results:

from opentrons.protocol_api import COLUMN, ALL

requirements = {
	"robotType": "Flex",
	"apiLevel": "2.16"
}

def run(protocol_context):
	tip_rack1 = protocol_context.load_labware("opentrons_flex_96_tiprack_50ul", "D2")
	instrument = protocol_context.load_instrument('flex_96channel_1000', mount="left", tip_racks=[tip_rack1])

	waste_chute = protocol_context.load_waste_chute()

	instrument.configure_nozzle_layout(style=COLUMN, start="A1")

	instrument.pick_up_tip(tip_rack1)
	instrument.drop_tip(waste_chute)

Risk assessment

While the robot will prevent a collision during runtime, a protocol where a crash would occur would still pass analysis. This is in part due to the fact that we do not load a true deck configuration for analysis, so when checking the set of loaded fixtures we see that there are "None", even if that is untrue. This is yet another item that would become simpler with multipass analysis.

@CaseyBatten CaseyBatten requested a review from a team as a code owner January 29, 2024 16:28
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b7a3b17) 68.03% compared to head (21c4a82) 68.03%.
Report is 58 commits behind head on edge.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             edge   #14371   +/-   ##
=======================================
  Coverage   68.03%   68.03%           
=======================================
  Files        2507     2507           
  Lines       71551    71551           
  Branches     9089     9089           
=======================================
  Hits        48680    48680           
  Misses      20757    20757           
  Partials     2114     2114           
Flag Coverage Δ
g-code-testing 96.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...pi/src/opentrons/protocol_engine/state/geometry.py 100.00% <ø> (ø)

@CaseyBatten CaseyBatten requested a review from a team January 29, 2024 20:54
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

Looks good to me, I like the way the logic is broken up.

@CaseyBatten CaseyBatten merged commit 4c77160 into edge Jan 31, 2024
22 checks passed
@SyntaxColoring
Copy link
Contributor

SyntaxColoring commented Jan 31, 2024

Tested on a Flex. Unfortunately, it looks like this is raising an internal KeyError.

Screenshot 2024-01-31 at 4 39 20 PM
  File "/opt/opentrons-robot-server/opentrons/protocols/execution/execute_python.py", line 69, in run_python
    exec("run(__context)", new_globs)

  File "<string>", line 1, in <module>

  File "casey_pr_test.py", line 17, in run

  File "/opt/opentrons-robot-server/opentrons/protocols/api_support/util.py", line 383, in _check_version_wrapper
    return decorated_obj(*args, **kwargs)

  File "/opt/opentrons-robot-server/opentrons/protocol_api/instrument_context.py", line 933, in pick_up_tip
    self._core.pick_up_tip(

  File "/opt/opentrons-robot-server/opentrons/protocol_api/core/engine/instrument.py", line 404, in pick_up_tip
    deck_conflict.check_safe_for_pipette_movement(

  File "/opt/opentrons-robot-server/opentrons/protocol_api/core/engine/deck_conflict.py", line 213, in check_safe_for_pipette_movement
    _check_deck_conflict_for_96_channel(

  File "/opt/opentrons-robot-server/opentrons/protocol_api/core/engine/deck_conflict.py", line 352, in _check_deck_conflict_for_96_channel
    _check_conflict_with_slot_item(

  File "/opt/opentrons-robot-server/opentrons/protocol_api/core/engine/deck_conflict.py", line 336, in _check_conflict_with_slot_item
    slot_highest_z = engine_state.geometry.get_highest_z_in_slot(

  File "/opt/opentrons-robot-server/opentrons/protocol_engine/state/geometry.py", line 154, in get_highest_z_in_slot
    slot_item = self.get_slot_item(slot.slotName)

  File "/opt/opentrons-robot-server/opentrons/protocol_engine/state/geometry.py", line 702, in get_slot_item
    maybe_fixture = self._addressable_areas.get_fixture_by_deck_slot_name(

  File "/opt/opentrons-robot-server/opentrons/protocol_engine/state/addressable_areas.py", line 488, in get_fixture_by_deck_slot_name
    for fixture in potential_fixtures[slot_cutout_id]:

Run log

CaseyBatten added a commit that referenced this pull request Jan 31, 2024
ncdiehl11 pushed a commit that referenced this pull request Feb 1, 2024
Addition of cutout fixtures to z height checking where appropriate
ncdiehl11 pushed a commit that referenced this pull request Feb 1, 2024
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.

3 participants