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): preserve last_moved in retract #14592

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

sfoster1
Copy link
Member

@sfoster1 sfoster1 commented Mar 4, 2024

8398c83 made a refactor to the way the hardware controller retracts the last-moved mount to get it out of the way when you change a move. This change allowed mounts that have electronic brakes to have those brakes engaged more often, lowring current consumption and heat generation. Unfortunately, it also introduced an issue in a specific code path.

If you have a 96 channel attached and you've been moving a mount that is not the left mount, so last_moved_mount is RIGHT or GRIPPER; and then you call _cache_and_maybe_retract_mount(LEFT); then

  • the left mount is idle, so we home it with home_z
  • home_z clears _last_moved_mount
  • there is now no mount to retract, and so it is not retracted

The fix for this is to copy last_moved_mount to a local so altering the cached value won't effect the rest of the method.

This fixes an issue where we use exactly this codepath: moving to maintenance position immediately after calibrating the gripper. _last_moved_mount is GRIPPER, but we always move the left mount to the maintenance position. This hits the problem. Any other codepath of this kind would also hit it.

This change should be strictly safer than the previous behavior.

Closes RABR-45, RQA-2380, RABR-23, RABR-24, RABR-25

Overview

Test Plan

Changelog

Review requests

Risk assessment

8398c83 made a refactor to the way the
hardware controller retracts the last-moved mount to get it out of the
way when you change a move. This change allowed mounts that have
electronic brakes to have those brakes engaged more often, lowring
current consumption and heat generation. Unfortunately, it also
introduced an issue in a specific code path.

If you have a 96 channel attached and you've been moving a mount that is
not the left mount, so last_moved_mount is RIGHT or GRIPPER; and then
you call `_cache_and_maybe_retract_mount(LEFT)`; then
- the left mount is idle, so we home it with home_z
- home_z clears _last_moved_mount
- there is now no mount to retract, and so it is not retracted

The fix for this is to copy last_moved_mount to a local so altering the
cached value won't effect the rest of the method.

This fixes an issue where we use exactly this codepath: moving to
maintenance position immediately after calibrating the gripper.
_last_moved_mount is GRIPPER, but we always move the left mount to the
maintenance position. This hits the problem. Any other codepath of this
kind would also hit it.

This change should be strictly safer than the previous behavior.

Closes RABR-45, RQA-2380
@sfoster1 sfoster1 requested review from ahiuchingau and a team March 4, 2024 18:36
@sfoster1 sfoster1 requested a review from a team as a code owner March 4, 2024 18:36
Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.62%. Comparing base (d44c529) to head (6b7752e).
Report is 2 commits behind head on chore_release-7.2.0.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           chore_release-7.2.0   #14592      +/-   ##
=======================================================
- Coverage                67.62%   67.62%   -0.01%     
=======================================================
  Files                     2521     2521              
  Lines                    72192    72191       -1     
  Branches                  9290     9290              
=======================================================
- Hits                     48817    48816       -1     
  Misses                   21185    21185              
  Partials                  2190     2190              
Flag Coverage Δ
g-code-testing 92.43% <ø> (ø)

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

Files Coverage Δ
api/src/opentrons/hardware_control/ot3api.py 79.81% <ø> (-0.07%) ⬇️

@sfoster1 sfoster1 merged commit 25c1e89 into chore_release-7.2.0 Mar 4, 2024
28 checks passed
@sfoster1 sfoster1 deleted the fix-gripper-no-home-after-cal branch March 4, 2024 23:22
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.

2 participants