-
Notifications
You must be signed in to change notification settings - Fork 190
fix(api): discount labware in system location/hopper location when getting the deck height #18188
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
Conversation
92b7141 to
4b5a57c
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## edge #18188 +/- ##
==========================================
- Coverage 57.48% 57.48% -0.01%
==========================================
Files 3043 3043
Lines 255276 255275 -1
Branches 30517 30516 -1
==========================================
- Hits 146756 146755 -1
Misses 108333 108333
Partials 187 187
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
sfoster1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make the check catch a little more
| ) or lw_data.location in [OFF_DECK_LOCATION, SYSTEM_LOCATION]: | ||
| return False | ||
| # is it a lid? | ||
| if self._labware.get_labware_by_lid_id(lw_data.id) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait why wouldn't it be a deck obstacle if it's a lid?
| """Check if the labware is a deck obstacle.""" | ||
| # is it offdeck? | ||
| if isinstance( | ||
| lw_data.location, InStackerHopperLocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably want to use self.get_location_sequence(lw_data.id)[-1] rather than lw_data.location; the check here won't find a labware on an adapter that's off-deck, for instance
SyntaxColoring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with Seth's comments, plus one more.
5776f18 to
de7721d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes requested for avoiding mocking out other parts of subject. (I see this is targeted into edge, so we aren't rushing to get this into chore_release_8.4.0, right?)
api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Outdated
Show resolved
Hide resolved
sfoster1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with max but i'm happy with the changes you made to my suggestions
| return False | ||
| # TODO: (AA 4/28/25) re-evaluate this logic, this doesn't make sense | ||
| # to me but keeping it to preserve existing behavior | ||
| if self._labware.get_labware_by_lid_id(labware_id) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this, lids should be considered in height checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK i got rid of it!
SyntaxColoring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Approving so we can fix the bug and move on.
The testing practices continue to concern me. I think almost always, we should avoid writing tests like this, that mess with private details of the subject. At a glance, nothing that we're doing here strikes me as warranting an exception to that rule.
If any of this is controversial, we can keep talking about it in Slack.
| # Fixme (spp, 2023-12-04): the overall height is not the true highest z of modules | ||
| # on a Flex. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this old fixme comment was talking about, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overall height is the physical height of the module. This does not account for how the module sits on the deck, so its overall height is usually much taller than the highest point of the module when it's loaded into the robot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh—are you talking about how, like, how a module installed on a Flex is mostly sunken below deck? So we were over-conservatively saying that, say, a Temperature Module was 8 cm tall (or however tall it is), when in fact most of those cm shouldn't have counted because they were below deck?
api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Outdated
Show resolved
Hide resolved
api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Outdated
Show resolved
Hide resolved
api/tests/opentrons/protocol_engine/state/test_geometry_view.py
Outdated
Show resolved
Hide resolved
sfoster1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, I agree with max that the tests or the code they're testing should change to allow for better adherence to well-defined APIs. Some of the tests can be changed to provide fixed numbers as inputs and then check that the eventual output matches the fixed numbers (like, I don't think we need those asserts about the labware definition dimensions - that's not what we're testing, after all).
Would love to see some of that tuned up before merging but if you have to do it now then ok
b925e19 to
e4b829b
Compare
sfoster1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks great!
SyntaxColoring
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
| # Fixme (spp, 2023-12-04): the overall height is not the true highest z of modules | ||
| # on a Flex. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh—are you talking about how, like, how a module installed on a Flex is mostly sunken below deck? So we were over-conservatively saying that, say, a Temperature Module was 8 cm tall (or however tall it is), when in fact most of those cm shouldn't have counted because they were below deck?
This avoids a problem where the protocol_engine_lid_stack object can be in SYSTEM_LOCATION and we were asking for its ancestor slot. Also avoids a problem where asking for the ancestor slot of a SYSTEM_LOCATION would give you a bad kind of exception instead of a nice kind of exception. Closes RQA-4164 ## Reviews and TODOs This issue would also be addressed by #18188 but that includes stacker stuff that isn't in the release branch, so it does just a much lighter version of that. ## testing Check that the protocol in the ticket passes analysis
This PR adds a new geometry method to determine if labware is a deck obstacle and updates the logic for calculating the highest Z-point on the deck.
While refactoring the tests, I discovered that the we're also using the wrong z for modules. We should only consider the module height within the robot's deck, and not the overall height of the module.