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): warn tc-lid/gantry collision in simulation #4394

Merged
merged 7 commits into from
Nov 8, 2019

Conversation

b-cooper
Copy link
Contributor

@b-cooper b-cooper commented Nov 6, 2019

If a given protocol would target the labware loaded into a thermocycler module, while that module is known to be closed, simulation will fail with a helpful message.

Closes #4044

review requests

Attempt to upload a protocol in which you:

  • close the TC lid and then pipette into it (should raise)
  • close the TC lid and then pipette from it (should raise)
  • pipette into it with lid open (should simulate)

If a given protocol would target the labware loaded into a thermocycler module, while that module is
known to be closed, simulation will fail with a helpful message.

Closes #4044
@b-cooper b-cooper added feature Ticket is a feature request / PR introduces a feature api Affects the `api` project WIP labels Nov 6, 2019
@b-cooper b-cooper requested review from btmorr and a team November 6, 2019 23:14
@codecov
Copy link

codecov bot commented Nov 6, 2019

Codecov Report

Merging #4394 into edge will increase coverage by 1.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge    #4394      +/-   ##
==========================================
+ Coverage   56.01%   57.07%   +1.06%     
==========================================
  Files         899      899              
  Lines       25492    26600    +1108     
==========================================
+ Hits        14280    15183     +903     
- Misses      11212    11417     +205
Impacted Files Coverage Δ
protocol-designer/src/step-forms/utils.js 51.16% <0%> (-9.95%) ⬇️
opentrons/server/endpoints/update.py 22.44% <0%> (-0.81%) ⬇️
...er/src/components/modals/EditModulesModal/index.js 0% <0%> (ø) ⬆️
opentrons/protocol_api/geometry.py 99.32% <0%> (ø) ⬆️
...col-designer/src/components/DeckSetup/DeckSetup.js 0% <0%> (ø) ⬆️
...p/src/components/ChangePipette/PipetteSelection.js 0% <0%> (ø) ⬆️
opentrons/legacy_api/modules/tempdeck.py 70.21% <0%> (+0.21%) ⬆️
opentrons/protocol_api/contexts.py 88.51% <0%> (+0.45%) ⬆️
opentrons/protocol_api/util.py 92.95% <0%> (+0.8%) ⬆️
opentrons/drivers/smoothie_drivers/driver_3_0.py 76.46% <0%> (+1.23%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b68caac...f842618. Read the comment docs.

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.

Functionality looks good but I'd love to see a slight reorganization where this checking is the responsibility of the module context.

to_lw, to_well = geometry.split_loc_labware(location)
from_lw, from_well = geometry.split_loc_labware(from_loc)

if (isinstance(to_lw, Labware) and
Copy link
Member

Choose a reason for hiding this comment

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

Since module geometries hold refs to their child labware, could we do:

tc = next(m for m in in self._ctx._modules if isinstance(m, ThermocyclerContext))
if tc and tc.labware is to_lw or tc.labware_is from_lw and tc.lid_position=='closed':
    raise

And maybe make it a method of the thermocycler context? I think that way move_to would look a bit cleaner, basically saying "if we have a thermocycler, ask it if this move is OK". and if we add more modules that have motion restrictions (and we certainly could, right - this could be the place we check for those north/south collisions if we ever decide to do that) we'll add similar helpers for other modules without having their implementations padding out move_to.

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.

code lgtm, haven't tested yet

@sfoster1
Copy link
Member

sfoster1 commented Nov 7, 2019

Also tested locally in simulation

@b-cooper b-cooper merged commit b22a3b3 into edge Nov 8, 2019
@b-cooper b-cooper deleted the api_warn-tc-lid-collision branch November 8, 2019 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Affects the `api` project feature Ticket is a feature request / PR introduces a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raise exception if a move targets the labware on the Thermocycler with lid closed
2 participants