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(app, robot-server): support retryLocation when retrying dropTipInPlace during Error Recovery #16839

Merged

Conversation

mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Nov 14, 2024

Closes RQA-3591

Overview

When dropping a tip in a trash bin or waste chute, the pipette moves downwards before doing the drop tip. During Error Recovery, when we retry the failed command with a fixit intent, we need to perform a moveToCoordinates first before dispatching the dropTipInPlace or the robot drops the tip(s) from too high a location.

To know how far to move, we need the failedCommand to contain retryLocation metadata. We have a pattern for this already with overpressure in place commands, so we extend the same functionality here.

Test Plan and Hands on Testing

  • Test with one of the protocols in RQA-3591.

Changelog

  • Fixed the "Retry tip drop" recovery option in "Tip drop failed" recovery flows dropping tips too high when retried over a waste chute or trash bin.

Risk assessment

low

@mjhuff mjhuff requested a review from a team November 14, 2024 20:38
@mjhuff mjhuff changed the title fix(app): support retryLocation when retrying dropTipInPlace during Error Recovery fix(app): support retryLocation when retrying dropTipInPlace during Error Recovery Nov 14, 2024
@mjhuff mjhuff changed the title fix(app): support retryLocation when retrying dropTipInPlace during Error Recovery fix(app, robot-server): support retryLocation when retrying dropTipInPlace during Error Recovery Nov 14, 2024
current_location = self._state_view.pipettes.get_current_location()
current_position = await self._gantry_mover.get_position(params.pipetteId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated fix. Fixing a potentially unbound reference to curent_position.

@@ -76,8 +76,8 @@ async def execute(self, params: DispenseInPlaceParams) -> _ExecuteReturn:
"""Dispense without moving the pipette."""
state_update = StateUpdate()
current_location = self._state_view.pipettes.get_current_location()
current_position = await self._gantry_mover.get_position(params.pipetteId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated fix. Fixing a potentially unbound reference to current_position.

@@ -145,6 +145,7 @@ async def execute(self, params: DropTipParams) -> _ExecuteReturn:
error=exception,
)
],
errorInfo={"retryLocation": position},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is redundant for dropTip, but it lets us share the same TipPhysicallyAttachedError shape.


async def execute(self, params: DropTipInPlaceParams) -> _ExecuteReturn:
"""Drop a tip using the requested pipette."""
state_update = update_types.StateUpdate()

retry_location = await self._gantry_mover.get_position(params.pipetteId)
Copy link
Contributor

Choose a reason for hiding this comment

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

@mjhuff Do we ever attempt a dropTipInPlace in a situation where the robot is not homed? If so, this might cause trouble, because the robot doesn't know the retryLocation, and my naive implementation here will cause it to raise an exception and fail the command. I think we had another bug like this.

Copy link
Contributor Author

@mjhuff mjhuff Nov 15, 2024

Choose a reason for hiding this comment

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

@mjhuff Do we ever attempt a dropTipInPlace in a situation where the robot is not homed?

Hm, it's possible for users to dropTipInPlace during the drop tip wizard portion of recovery (so effectively every flow minus the gripper flow) and during the "Tip drop failed" flow.

However, in theory, the only instances during ER that the robot may be unaware of its position is during a gripper stall/collision error, and it's possible to get to dt wiz during that flow.

We do update position estimators before the blowout/drop tip, however, if a MustHomeError is possible, this will be problematic, since error recovery has its own error modals and won't show the "home the gantry" CTA.

Copy link
Member

Choose a reason for hiding this comment

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

If you tried to dropTipInPlace when you don't have a position estimation then it will fail, so if we're ever doing that then it isn't working already. After you unsafe/updatePositionEstimators, get_position will work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, great, I believe we are covered then. If you're dropping tips during a gripper stall/collision, you are about to end the run, and get_position won't matter. If you are resuming the run after a gripper stall/collision, we are doing an "everything but the plungers" home.

If you are dropTipInPlaceing during a different error recovery flow, as of this release, the robot knows its position.

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.

Frontend changes LGTM, thanks.

I wrote the backend changes, so I can't approve those, and also see my question above.

@SyntaxColoring SyntaxColoring marked this pull request as ready for review November 14, 2024 23:04
@SyntaxColoring SyntaxColoring requested review from a team as code owners November 14, 2024 23:04
@SyntaxColoring SyntaxColoring requested review from smb2268 and removed request for a team November 14, 2024 23:04
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!


async def execute(self, params: DropTipInPlaceParams) -> _ExecuteReturn:
"""Drop a tip using the requested pipette."""
state_update = update_types.StateUpdate()

retry_location = await self._gantry_mover.get_position(params.pipetteId)
Copy link
Member

Choose a reason for hiding this comment

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

If you tried to dropTipInPlace when you don't have a position estimation then it will fail, so if we're ever doing that then it isn't working already. After you unsafe/updatePositionEstimators, get_position will work.

@SyntaxColoring
Copy link
Contributor

On hold until we fix https://opentrons.atlassian.net/browse/RQA-3599 and we can test this with gripper error recovery.

@mjhuff
Copy link
Contributor Author

mjhuff commented Nov 15, 2024

On hold until we fix https://opentrons.atlassian.net/browse/RQA-3599 and we can test this with gripper error recovery.

Done!

@mjhuff mjhuff merged commit df80263 into chore_release-8.2.0 Nov 15, 2024
35 checks passed
@mjhuff mjhuff deleted the fix-dropTipInPlace-retryLocation-error-recovery branch November 15, 2024 16:33
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (chore_release-8.2.0@59814e6). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                   @@
##             chore_release-8.2.0   #16839   +/-   ##
======================================================
  Coverage                       ?   92.43%           
======================================================
  Files                          ?       77           
  Lines                          ?     1283           
  Branches                       ?        0           
======================================================
  Hits                           ?     1186           
  Misses                         ?       97           
  Partials                       ?        0           
Flag Coverage Δ
g-code-testing 92.43% <ø> (?)

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

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