-
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
fix(app): handle dtwiz after estop #16168
Merged
sfoster1
merged 9 commits into
chore_release-8.0.0
from
RQA-3103-home-before-drop-tip-wizard
Sep 3, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6ee176f
added home before moving to addresable area drop tip wizard
TamarZanzouri 56922f5
engage axes command
TamarZanzouri ef86f9f
command unions and schema change
TamarZanzouri 25603d6
ts engage axes command
TamarZanzouri e907b9f
refactor(app): check estop better
sfoster1 bee2a6b
fix(app): estop: handle all devices routes
sfoster1 052257b
fix(app): droptip: handle estop before droptip
sfoster1 4780102
lint
sfoster1 b8104c2
some stray consoles
sfoster1 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
83 changes: 83 additions & 0 deletions
83
api/src/opentrons/protocol_engine/commands/unsafe/unsafe_engage_axes.py
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"""Update position estimators payload, result, and implementaiton.""" | ||
|
||
from __future__ import annotations | ||
from pydantic import BaseModel, Field | ||
from typing import TYPE_CHECKING, Optional, List, Type | ||
from typing_extensions import Literal | ||
|
||
from ...types import MotorAxis | ||
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData | ||
from ...errors.error_occurrence import ErrorOccurrence | ||
from ...resources import ensure_ot3_hardware | ||
|
||
from opentrons.hardware_control import HardwareControlAPI | ||
|
||
if TYPE_CHECKING: | ||
from ...execution import GantryMover | ||
|
||
|
||
UnsafeEngageAxesCommandType = Literal["unsafe/engageAxes"] | ||
|
||
|
||
class UnsafeEngageAxesParams(BaseModel): | ||
"""Payload required for an UnsafeEngageAxes command.""" | ||
|
||
axes: List[MotorAxis] = Field(..., description="The axes for which to enable.") | ||
|
||
|
||
class UnsafeEngageAxesResult(BaseModel): | ||
"""Result data from the execution of an UnsafeEngageAxes command.""" | ||
|
||
|
||
class UnsafeEngageAxesImplementation( | ||
AbstractCommandImpl[ | ||
UnsafeEngageAxesParams, | ||
SuccessData[UnsafeEngageAxesResult, None], | ||
] | ||
): | ||
"""Enable axes command implementation.""" | ||
|
||
def __init__( | ||
self, | ||
hardware_api: HardwareControlAPI, | ||
gantry_mover: GantryMover, | ||
**kwargs: object, | ||
) -> None: | ||
self._hardware_api = hardware_api | ||
self._gantry_mover = gantry_mover | ||
|
||
async def execute( | ||
self, params: UnsafeEngageAxesParams | ||
) -> SuccessData[UnsafeEngageAxesResult, None]: | ||
"""Enable exes.""" | ||
ot3_hardware_api = ensure_ot3_hardware(self._hardware_api) | ||
await ot3_hardware_api.engage_axes( | ||
[ | ||
self._gantry_mover.motor_axis_to_hardware_axis(axis) | ||
for axis in params.axes | ||
] | ||
) | ||
return SuccessData(public=UnsafeEngageAxesResult(), private=None) | ||
|
||
|
||
class UnsafeEngageAxes( | ||
BaseCommand[UnsafeEngageAxesParams, UnsafeEngageAxesResult, ErrorOccurrence] | ||
): | ||
"""UnsafeEngageAxes command model.""" | ||
|
||
commandType: UnsafeEngageAxesCommandType = "unsafe/engageAxes" | ||
params: UnsafeEngageAxesParams | ||
result: Optional[UnsafeEngageAxesResult] | ||
|
||
_ImplementationCls: Type[ | ||
UnsafeEngageAxesImplementation | ||
] = UnsafeEngageAxesImplementation | ||
|
||
|
||
class UnsafeEngageAxesCreate(BaseCommandCreate[UnsafeEngageAxesParams]): | ||
"""UnsafeEngageAxes command request model.""" | ||
|
||
commandType: UnsafeEngageAxesCommandType = "unsafe/engageAxes" | ||
params: UnsafeEngageAxesParams | ||
|
||
_CommandCls: Type[UnsafeEngageAxes] = UnsafeEngageAxes |
52 changes: 52 additions & 0 deletions
52
api/tests/opentrons/protocol_engine/commands/unsafe/test_engage_axes.py
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Test update-position-estimator commands.""" | ||
from decoy import Decoy | ||
|
||
from opentrons.protocol_engine.commands.unsafe.unsafe_engage_axes import ( | ||
UnsafeEngageAxesParams, | ||
UnsafeEngageAxesResult, | ||
UnsafeEngageAxesImplementation, | ||
) | ||
from opentrons.protocol_engine.commands.command import SuccessData | ||
from opentrons.protocol_engine.execution import GantryMover | ||
from opentrons.protocol_engine.types import MotorAxis | ||
from opentrons.hardware_control import OT3HardwareControlAPI | ||
from opentrons.hardware_control.types import Axis | ||
|
||
|
||
async def test_engage_axes_implementation( | ||
decoy: Decoy, ot3_hardware_api: OT3HardwareControlAPI, gantry_mover: GantryMover | ||
) -> None: | ||
"""Test EngageAxes command execution.""" | ||
subject = UnsafeEngageAxesImplementation( | ||
hardware_api=ot3_hardware_api, gantry_mover=gantry_mover | ||
) | ||
|
||
data = UnsafeEngageAxesParams( | ||
axes=[MotorAxis.LEFT_Z, MotorAxis.LEFT_PLUNGER, MotorAxis.X, MotorAxis.Y] | ||
) | ||
|
||
decoy.when(gantry_mover.motor_axis_to_hardware_axis(MotorAxis.LEFT_Z)).then_return( | ||
Axis.Z_L | ||
) | ||
decoy.when( | ||
gantry_mover.motor_axis_to_hardware_axis(MotorAxis.LEFT_PLUNGER) | ||
).then_return(Axis.P_L) | ||
decoy.when(gantry_mover.motor_axis_to_hardware_axis(MotorAxis.X)).then_return( | ||
Axis.X | ||
) | ||
decoy.when(gantry_mover.motor_axis_to_hardware_axis(MotorAxis.Y)).then_return( | ||
Axis.Y | ||
) | ||
decoy.when( | ||
await ot3_hardware_api.update_axis_position_estimations( | ||
[Axis.Z_L, Axis.P_L, Axis.X, Axis.Y] | ||
) | ||
).then_return(None) | ||
|
||
result = await subject.execute(data) | ||
|
||
assert result == SuccessData(public=UnsafeEngageAxesResult(), private=None) | ||
|
||
decoy.verify( | ||
await ot3_hardware_api.engage_axes([Axis.Z_L, Axis.P_L, Axis.X, Axis.Y]), | ||
) |
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.
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.
Super funny/weird change between RR versions.
It looks like this is the only place in the app we use
useMatch
.