-
Notifications
You must be signed in to change notification settings - Fork 179
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): Validate plate reader status using live data hookups for engine and introduce lid status to the PAPI #15872
Merged
Merged
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
f694335
PLAT-397 add module lid definition
ahiuchingau ed13f7c
PLAT-398 add module lid dock addressable area
ahiuchingau 957f246
squash! PLAT-397 add module lid definition
ahiuchingau 6051392
fixup async byonoy library get_plate_presence()
ahiuchingau 29d0418
PLAT-215 load lid in lid dock when module is loaded
ahiuchingau 7935c4f
PLAT-209 & PLAT-210 add open_lid and close_lid protocol engine comman…
ahiuchingau d6200b6
some changes required to get the app working
ahiuchingau 0e2b885
squash! PLAT-209 & PLAT-210 add open_lid and close_lid protocol engin…
ahiuchingau febc1d2
update absorbance module offset in definition
ahiuchingau d656112
add a protocol engine error
ahiuchingau 262cdf2
error handling
ahiuchingau eb053b1
update setup-py
ahiuchingau fece1e7
format
ahiuchingau 58ace2d
AddAbsorbanceReaderLidAction to add lid id as module substate
ahiuchingau cda987a
fix linter errors
ahiuchingau 772d913
simplified protocol commmands
ahiuchingau 6371d4d
streamline engine logic include plate reader lid as fixed labware and…
CaseyBatten f1ff265
labware fixture correction for app tests
CaseyBatten dbb5792
remove lid from app view
CaseyBatten 051e1bd
Merge branch 'edge' into abs96_move-lid-command
CaseyBatten 4ceef15
correct max api version
CaseyBatten 93176e3
analysis validation fix accounting for reader lid as fixture
CaseyBatten a9b16dd
Lid position automatic validation and engine adjustment and labware m…
CaseyBatten 3b47af6
full lid status live data hookups and initial polling architecture
CaseyBatten e3d8fea
Merge branch 'edge' into abs96_lid_status_engine
CaseyBatten e1d99dd
Merge branch 'edge' into abs96_lid_status_engine
CaseyBatten 564cd9f
fix for is lid on
CaseyBatten 91a3242
linting and app fix
CaseyBatten 9b01734
no op open and close lid if lid already in desired end position
CaseyBatten f776469
doc and error text updates
CaseyBatten ab5caef
lid live data positioning corrections
CaseyBatten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -42,6 +42,7 @@ | |||||
RobotTypeError, | ||||||
UnsupportedAPIError, | ||||||
) | ||||||
from opentrons_shared_data.errors.exceptions import CommandPreconditionViolated | ||||||
|
||||||
from ._types import OffDeckType | ||||||
from .core.common import ModuleCore, LabwareCore, ProtocolCore | ||||||
|
@@ -707,6 +708,13 @@ def move_labware( | |||||
f"Expected labware of type 'Labware' but got {type(labware)}." | ||||||
) | ||||||
|
||||||
# Ensure that when moving to an absorbance reader than the lid is open | ||||||
if isinstance(new_location, AbsorbanceReaderContext): | ||||||
if new_location.is_lid_on(): | ||||||
raise CommandPreconditionViolated( | ||||||
f"Cannot move {labware.name} onto the Absorbance Reader Module when Lid is Closed." | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
nit |
||||||
) | ||||||
|
||||||
location: Union[ | ||||||
ModuleCore, | ||||||
LabwareCore, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,10 +7,14 @@ | |||||
|
||||||
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData | ||||||
from ...errors.error_occurrence import ErrorOccurrence | ||||||
from ...errors import CannotPerformModuleAction | ||||||
from opentrons.protocol_engine.types import AddressableAreaLocation | ||||||
|
||||||
from opentrons.protocol_engine.resources import labware_validation | ||||||
from .types import MoveLidResult | ||||||
|
||||||
from opentrons.drivers.types import AbsorbanceReaderLidStatus | ||||||
|
||||||
if TYPE_CHECKING: | ||||||
from opentrons.protocol_engine.state import StateView | ||||||
from opentrons.protocol_engine.execution import ( | ||||||
|
@@ -55,17 +59,30 @@ async def execute( | |||||
mod_substate = self._state_view.modules.get_absorbance_reader_substate( | ||||||
module_id=params.moduleId | ||||||
) | ||||||
# Make sure the lid is open | ||||||
mod_substate.raise_if_lid_status_not_expected(lid_on_expected=False) | ||||||
|
||||||
# Allow propagation of ModuleNotAttachedError. | ||||||
_ = self._equipment.get_module_hardware_api(mod_substate.module_id) | ||||||
|
||||||
# lid should currently be docked | ||||||
# lid should currently be on the module | ||||||
assert mod_substate.lid_id is not None | ||||||
loaded_lid = self._state_view.labware.get(mod_substate.lid_id) | ||||||
assert labware_validation.is_absorbance_reader_lid(loaded_lid.loadName) | ||||||
|
||||||
# If the lid is already Closed, No-op out | ||||||
if mod_substate.is_lid_on: | ||||||
current_offset_id = self._equipment.find_applicable_labware_offset_id( | ||||||
labware_definition_uri=loaded_lid.definitionUri, | ||||||
labware_location=loaded_lid.location, | ||||||
) | ||||||
return SuccessData( | ||||||
public=CloseLidResult( | ||||||
lidId=loaded_lid.id, | ||||||
newLocation=loaded_lid.location, | ||||||
offsetId=current_offset_id, | ||||||
), | ||||||
private=None, | ||||||
) | ||||||
|
||||||
# Allow propagation of ModuleNotAttachedError. | ||||||
_ = self._equipment.get_module_hardware_api(mod_substate.module_id) | ||||||
|
||||||
current_location = loaded_lid.location | ||||||
validated_current_location = ( | ||||||
self._state_view.geometry.ensure_valid_gripper_location(current_location) | ||||||
|
@@ -108,6 +125,21 @@ async def execute( | |||||
labware_definition_uri=loaded_lid.definitionUri, | ||||||
labware_location=new_location, | ||||||
) | ||||||
|
||||||
if not self._state_view.config.use_virtual_modules: | ||||||
abs_reader = self._equipment.get_module_hardware_api(mod_substate.module_id) | ||||||
|
||||||
if abs_reader is not None: | ||||||
result = await abs_reader.get_current_lid_status() | ||||||
if result is not AbsorbanceReaderLidStatus.ON: | ||||||
raise CannotPerformModuleAction( | ||||||
"The Opentrons Plate Reader lid mechanicaly position did not match expected Closed state." | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this error ever bubble up to be shown to users? if so, needs an edit.
Suggested change
|
||||||
) | ||||||
else: | ||||||
raise CannotPerformModuleAction( | ||||||
"Could not reach the Hardware API for Opentrons Plate Reader Module." | ||||||
) | ||||||
|
||||||
return SuccessData( | ||||||
public=CloseLidResult( | ||||||
lidId=loaded_lid.id, newLocation=new_location, offsetId=new_offset_id | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let's Sphinx it up
I'm OK with leaving the implication that
False
means it's open, but if false means open or unknown, we should state that.