-
Notifications
You must be signed in to change notification settings - Fork 180
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(api): implement labware.set_offset in 2.18 #14940
Conversation
How are we going to communicate to users where/when they need to call Don't each one of the internal definitions of the locations correspond to, "an offset we calculate in LPC"? Can you maybe provide an example of what users would have to define if we went the other route? |
if you went the other way, they'd have to do this: https://github.com/Opentrons/opentrons/pull/14940/files#diff-6f733f7119a96d280a77b7a2c54d99087fa07c7759299c4ce029c48ec0c1c668R103-R154 or we'd have to provide some function to look it up |
@@ -91,10 +100,65 @@ def get_parameters(self) -> LabwareParametersDict: | |||
def get_quirks(self) -> List[str]: | |||
return self._definition.parameters.quirks or [] | |||
|
|||
def _get_offset_location(self) -> LabwareOffsetLocation: | |||
slot = self.get_deck_slot() | |||
if None is slot: |
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.
nip but can we do this instead?
if None is slot: | |
if slot is None: |
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.
LGTM! just a few comments
@sfoster1, your response to my earlier comment helped me understand. My mistake, you're correct, the downside of having to do all those imports and describing to the user how to use said imports, is much more difficult than just telling them to call set offset. This looks good to me so far |
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.
Cool, TY!
I think we'll need to document on the public set_offset()
method that identical labware in the same location will share the same offset. This is the opposite of what the PAPIv≤2.13 behavior was, and what is currently documented.
Right, definitely - it's now adding a labware offset. Can do. |
@ecormany Would love your opinion on the documentation strategy here |
07b8690
to
3db0724
Compare
3db0724
to
97d18eb
Compare
3c9fbce
to
b1d55c5
Compare
|
Adds a new command ReloadLabware, which allows dispatchers to change all the details of a loaded labware except for the location. This is primarily intended to allow getting a new labware offset that was not added to the engine by the time this labware was loaded (though it can technically do more, for symmetry). This doesn't really change a whole lot of behavior and is well-supported with testing. It's a prerequisite for #14940 Closes RSQ-29
The python protocol api's labware.set_offset() command lets you set a labware position check offset programmatically. This is useful in protocols run outside the app (i.e. through Jupyter, through opentrons_execute). When we moved to the protocol engine, we didn't support running those protocols outside the app, and therefore we didn't implement this method on those new API versions. Now, we allow that again, so implement that method again. This relies on dispatching AddLabwareOffset actions at arbitrary times, because it will set an offset for the location in which the labware is _currently_ present. This allows the user to set offsets without having to wrangle with the engine's internal definitions of where something is, at the cost of the user having to spread their offset calls around their protocol if they have protocols that load things in one place and later move them to another. Closes RSQ-29
or at least tests for the protocol api and protocol api core part. also a little refactor to make it easier to specify version ranges
b1d55c5
to
c2b5327
Compare
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.
One note about requested vs. connected module model, but this LGTM other than that. Thank you!
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.
Hooray
# Overview Documents [updated behavior](#14940) for `Labware.set_offset()` in Python API version 2.18. Addresses RTC-234 # Test Plan Sandbox: - [API reference entry](http://sandbox.docs.opentrons.com/docs-set_offset-updates/v2/new_protocol_api.html#opentrons.protocol_api.Labware.set_offset) - [new section](http://sandbox.docs.opentrons.com/docs-set_offset-updates/v2/new_advanced_running.html#labware-offset-behavior) of Advanced Control # Changelog - adapted new docstring draft written by @sfoster1 - adapt sample code and move it to Advanced Control # Review requests have we accurately captured the three phases of behavior (2.12–13, 14–17, 18+)? # Risk assessment none
# Overview Documents [updated behavior](#14940) for `Labware.set_offset()` in Python API version 2.18. Addresses RTC-234 # Test Plan Sandbox: - [API reference entry](http://sandbox.docs.opentrons.com/docs-set_offset-updates/v2/new_protocol_api.html#opentrons.protocol_api.Labware.set_offset) - [new section](http://sandbox.docs.opentrons.com/docs-set_offset-updates/v2/new_advanced_running.html#labware-offset-behavior) of Advanced Control # Changelog - adapted new docstring draft written by @sfoster1 - adapt sample code and move it to Advanced Control # Review requests have we accurately captured the three phases of behavior (2.12–13, 14–17, 18+)? # Risk assessment none
Adds a new command ReloadLabware, which allows dispatchers to change all the details of a loaded labware except for the location. This is primarily intended to allow getting a new labware offset that was not added to the engine by the time this labware was loaded (though it can technically do more, for symmetry). This doesn't really change a whole lot of behavior and is well-supported with testing. It's a prerequisite for #14940 Closes RSQ-29
The python protocol api's labware.set_offset() command lets you set a labware position check offset programmatically. This is useful in protocols run outside the app (i.e. through Jupyter, through opentrons_execute). When we moved to the protocol engine, we didn't support running those protocols outside the app, and therefore we didn't implement this method on those new API versions. Now, we allow that again, so implement that method again. This relies on dispatching AddLabwareOffset actions at arbitrary times, because it will set an offset for the location in which the labware is _currently_ present. This allows the user to set offsets without having to wrangle with the engine's internal definitions of where something is, at the cost of the user having to spread their offset calls around their protocol if they have protocols that load things in one place and later move them to another. ## Warning ~This won't work the way you think it will right now. Labware offsets are applied to labware instances by the `LoadLabware` and `MoveLabware` commands. So if you do an `AddLabwareOffsetAction` after a `LoadLabware`, the offset will never apply to the labware. We need to add a new `ReloadLabware` command, but I'm going to do that in a separate PR and then put this PR on top of that one.~ Fully implemented yay Closes RSQ-29
The python protocol api's labware.set_offset() command lets you set a labware position check offset programmatically. This is useful in protocols run outside the app (i.e. through Jupyter, through opentrons_execute).
When we moved to the protocol engine, we didn't support running those protocols outside the app, and therefore we didn't implement this method on those new API versions.
Now, we allow that again, so implement that method again.
This relies on dispatching AddLabwareOffset actions at arbitrary times, because it will set an offset for the location in which the labware is currently present. This allows the user to set offsets without having to wrangle with the engine's internal definitions of where something is, at the cost of the user having to spread their offset calls around their protocol if they have protocols that load things in one place and later move them to another.
Warning
This won't work the way you think it will right now. Labware offsets are applied to labware instances by theLoadLabware
andMoveLabware
commands. So if you do anAddLabwareOffsetAction
after aLoadLabware
, the offset will never apply to the labware. We need to add a newReloadLabware
command, but I'm going to do that in a separate PR and then put this PR on top of that one.Fully implemented yay
Closes RSQ-29
To Leave Draft
set_offset
ReloadLabware