-
Notifications
You must be signed in to change notification settings - Fork 175
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): allow calibrateGripper command to save calibration data #12046
feat(engine): allow calibrateGripper command to save calibration data #12046
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #12046 +/- ##
==========================================
+ Coverage 74.04% 74.10% +0.05%
==========================================
Files 2191 2183 -8
Lines 60609 60654 +45
Branches 6416 6465 +49
==========================================
+ Hits 44879 44946 +67
+ Misses 14194 14142 -52
- Partials 1536 1566 +30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
api/src/opentrons/protocol_engine/commands/calibration/calibrate_gripper.py
Outdated
Show resolved
Hide resolved
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.
Code looks good to me 👍
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.
Groovy! 🕺 Responses to your review requests...
@@ -38,6 +37,16 @@ class CalibrateGripperParams(BaseModel): | |||
" this probe and removed the other probe, if there was one." | |||
), | |||
) | |||
otherProbeOffset: Optional[Vec3f] = Field( |
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.
- Does this behavior of the command make sense? I was originally working on adding an http endpoint that can be used to send a
PATCH
/POST
request to save calibration to disk when the two probes' offsets are provided but realized it was not a great idea for a few reasons-
I would have preferred a separate PATCH
/POST
/PUT
endpoint. But, like you said:
- if we were to match the behavior of the other 'calibration' commands, they handle saving the calibration too. So it felt odd to have just the gripper calibration command delegate the saving part to robot server.
So I agree with making it a Protocol Engine command, for consistency.
However, I do think that the saving of the calibration should happen in a separate third command, rather than building it into the second command. So, it would be like this:
calibrateGripper
with front.calibrateGripper
with rear.saveGripperCalibration
with measurements from front and rear.
(And perhaps we could rename calibrateGripper
to probeGripper
or measureGripperCalibration
.)
Separating out the save step is nice because:
- It lets a client show the user confirmation of the measurements before we apply those measurements. Like how Labware Position Check has a confirmation step at the end, where you can choose to abandon the offsets if they look wrong.
- Use manually-supplied measurements. Or manual adjustments to the automatic measurements. This is helpful for debugging and testing, and for implementing custom calibration methods.
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 difference between LPC and instrument calibration is that the latter is handled fully by the backend. So deciding whether the offsets are wrong is something that the backend should decide, not the client or user. Until now it's been the robot server's calibration flow doing that work and I think now it will be hardware controller or some other backend entity that holds the information necessary to make that call.
As for manually supplying measurements for testing and debugging, we can always edit the calibration file. I don't think that calls for expanding the capability of client-facing engine commands.
But it is a good point that the command should let the client know whether the calibration process fully succeeded (with the offset status). Although technically the client can check the calibration status via instruments endpoint but that's yet another request and who knows how long it takes until the file change is propagated; opens up avenues for race condition.
What do you think about returning the entire calibration data in the response instead of just the total offset and keeping the calibration contained to the single command?
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.
Makes sense to me
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.
Discussed in-person with @sanni-t:
I still think that saving should be a separate command. But doing it this way doesn't preclude us from changing it in the future, so I'm cool with this being merged if we need to move forward.
* edge: (116 commits) feat(system-server): add sqlite database and barebones HTTP server (#12085) feat(ot3): add enableOT3FirmwareUpdates feature flag to gate firmware update functionality. (#12102) feat(app): add bare bones hardware section to protocol details (#12099) feat(app): Support failed calibrations in the calibration wizard (#12092) refactor(docs): clean up Versioning page (#12084) refactor(robot-server): Make run and protocol limits configurable at launch (#12094) feat(app): add robotServerVersion to display the current robot software version (#12096) fix(hardware): do not track tip motor positions (#12093) feat(engine): allow calibrateGripper command to save calibration data (#12046) feat(app, api-client, react-api-client): delete POC TLC calibration data from overflow menu (#12075) fix(api): actually update OT3 instrument calibration offset in cache instrument (#12089) fix(robot-server): correct the data returned from instruments endpoint (#12067) feat(api): add thermocycler plate lift to hardware controller (#12068) fix(app): reference moduleId from result not params (#12077) feat(app): create ODD protocol setup page (#12071) refactor(api): Deprecate presses and increment args when using PAPI pick_up_tip (#12079) fix(ot3): handle multiple responses for a tip action request (#12083) refactor(api): touch tip implementation for PAPIv2 engine core (#12053) refactor(app): Remove ssid parameter from OnDeviceRouteParams (#11930) fix(api): fix broken test in the api hardware controller (#12080) ...
Closes RLAB-198
Overview
Until now the
calibrateGripper
command only performed calibration of the specified gripper jaw and returned its offset. This PR adds the capability to have this command also save the final gripper offset once the offset for both the jaws is known.Test Plan
Testing is blocked by #11807
Changelog
calibrateGripper
command to accept a new optional paramotherProbeOffset
and return a new optional fieldgripperOffset
gripperOffset
is provided by the engine only when it has access to the current probe's offset and the other probe's offset is specified inotherProbeOffset
.Review requests
PATCH
/POST
request to save calibration to disk when the two probes' offsets are provided but realized it was not a great idea for a few reasons-/calibration
or/instrument
(here's the first pass of endpoint)Risk assessment
Very low. Doesn't change the existing command behavior