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(engine): use grip force and height from definitions in pe #13233

Conversation

sanni-t
Copy link
Member

@sanni-t sanni-t commented Aug 4, 2023

Closes RSS-279

Overview

Updates the labware movement code in PE to use the grip height & force specified by the labware definition, or fallback to default if those are not specified.

Test Plan

(Currently testing with @andySigler )

  • test moving to/from deck all specified labware with & without liquid on a robot
  • test moving a non-specified labware and verify it falls back to default force & height values
  • test moving to/from modules all specified labware supported on the modules
  • make sure the force specified in definitions is actually being set (use can monitor to check the duty cycle being set for gripper jaw)

Changelog

  • updated the gripper grip point getter to use gripHeightFromLabwareBottom property if present in definition, otherwise use default we've been using so far
  • updated labware movement code to use gripForce specified in definition if present, otherwise fallback to the default force we've been using so far.

Review requests

  • make sure the code changes and calculations are correct (esp movement of labware on labware/adapter)

Risk assessment

Medium. Code is pretty isolated and well-tested so it should not cause any issues as long as tests are passing.

@sanni-t sanni-t changed the base branch from edge to internal-release_0.14.0 August 4, 2023 16:37
@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Merging #13233 (ffc64e6) into internal-release_0.14.0 (a43a58a) will decrease coverage by 0.43%.
Report is 3 commits behind head on internal-release_0.14.0.
The diff coverage is n/a.

Impacted file tree graph

@@                     Coverage Diff                     @@
##           internal-release_0.14.0   #13233      +/-   ##
===========================================================
- Coverage                    72.52%   72.10%   -0.43%     
===========================================================
  Files                         2392     1571     -821     
  Lines                        66072    51965   -14107     
  Branches                      7338     3281    -4057     
===========================================================
- Hits                         47921    37470   -10451     
+ Misses                       16404    13979    -2425     
+ Partials                      1747      516    -1231     
Flag Coverage Δ
app 43.84% <ø> (-27.50%) ⬇️
g-code-testing 96.44% <ø> (ø)
labware-library 49.17% <ø> (ø)
notify-server 89.13% <ø> (ø)
protocol-designer 47.30% <ø> (ø)
shared-data 78.93% <ø> (ø)
step-generation 87.18% <ø> (ø)

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

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

... and 824 files with indirect coverage changes

@sanni-t sanni-t marked this pull request as ready for review August 4, 2023 18:51
@sanni-t sanni-t requested a review from a team as a code owner August 4, 2023 18:51
Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

Code looks good to me! To answer your review question, though, I'm not sure where the stacking offset from an adapter between the deck and target labware is being applied, in the code.

Comment on lines 767 to 775

def get_grip_force(self, labware_id: str) -> float:
"""Get the recommended grip force for gripping labware using gripper."""
return self.get_definition(labware_id).gripForce or LABWARE_GRIP_FORCE

def get_grip_height_from_labware_bottom(self, labware_id: str) -> float:
"""Get the recommended grip height from labware bottom, if present."""
recommended_height = self.get_definition(labware_id).gripHeightFromLabwareBottom
return recommended_height or self.get_dimensions(labware_id).z / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is probably fine in practice because nobody will do this, but beware that this will do the wrong thing if someone does "gripForce": 0 or "gripHeightFromLabwareBottom": 0 for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Although it really doesn't make sense to have a force or height of 0. But it makes sense to correct this.

@sfoster1 sfoster1 merged commit a5303d1 into internal-release_0.14.0 Aug 4, 2023
@sfoster1 sfoster1 deleted the RSS-279-use-grip-force-and-height-from-definitions-in-pe branch August 4, 2023 22:02
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