-
Notifications
You must be signed in to change notification settings - Fork 178
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(robot-server): Expose tip status in instruments #13160
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #13160 +/- ##
=======================================
Coverage 72.11% 72.11%
=======================================
Files 1531 1531
Lines 50773 50773
Branches 3144 3144
=======================================
Hits 36614 36614
Misses 13650 13650
Partials 509 509
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 good to me, and tested on a Flex!
class PipetteState(BaseModel): | ||
"""State from an attached pipette.""" | ||
|
||
tip_detected: bool = 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.
🐫-case for HTTP-facing field names.
tip_detected: bool = Field( | |
tipDetected: bool = Field( |
@@ -217,6 +226,7 @@ def rehearse_instrument_retrievals() -> None: | |||
last_modified=None, | |||
), | |||
), | |||
state=PipetteState(tip_detected=True), |
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.
state=PipetteState(tip_detected=True), | |
state=PipetteState(tipDetected=True), |
@@ -237,6 +247,7 @@ def rehearse_instrument_retrievals() -> None: | |||
last_modified=None, | |||
), | |||
), | |||
state=PipetteState(tip_detected=False), |
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.
state=PipetteState(tip_detected=False), | |
state=PipetteState(tipDetected=False), |
class PipetteState(BaseModel): | ||
"""State from an attached pipette.""" | ||
|
||
tip_detected: bool = Field( | ||
None, | ||
description="Physical state of the tip photointerrupter on the Flex. Null for OT-2", | ||
) | ||
|
||
|
||
class Pipette(_GenericInstrument[PipetteModel, PipetteData]): | ||
"""Attached pipette info & configuration.""" | ||
|
||
instrumentType: Literal["pipette"] = "pipette" | ||
instrumentName: PipetteName | ||
instrumentModel: PipetteModel | ||
data: PipetteData | ||
state: Optional[PipetteState] |
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.
Confirmed in-person with @sanni-t:
Instead of what's written now, where tipDetected
is inside data.state
:
{
"data": {
"instrumentType": "pipette",
"data": {
"calibratedOffset": { /* ... */ }
// ..
}
"state": {
"tipDetected": true
}
// ...
},
"meta": { /* ... */ }
}
We'd like data.state
to not exist, and tipDetected
to be directly inside the existing data.data
, like this:
{
"data": {
"instrumentType": "pipette",
"data": {
"calibratedOffset": { /* ... */ }
"tipDetected": true
// ...
}
// ...
},
"meta": { /* ... */ }
}
This is consistent with a gripper's jawState
, for example.
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.
Just because it's consistent doesn't mean we should stick with what we've previously done. IMO jawState
should also go into a similarly named state
component of the body returned from /instruments
-- though obviously let's not address that till post launch. I've already got sign off on this from JS devs.
tipDetected
is in fact active state about the pipette whereas things listed in data can be considered "stored" state (albeit it can change from time to time but no where near as frequently as data).
Overview
We are now exposing the tip presence status (which is only valid on the Flex) through the
/instruments
endpoint. Closes RSS-291Test Plan
Changelog
PipetteStateDict
in the hardware controller. This is currently only used in the ot3api, but we can (and should) definitely expand on this state in the futureget_instrument_state
function in theot3api.py
which gets the current state of the tip ejector. Unfortunately we currently have to ask for the state each time this function is called because we currently don't have a state store for the hardware controller as it relates to specific hardware components (such as sensors).Review requests
Does it look OK for now? Anything you want me to add and/or take away?
Risk assessment
Low. New feature add.