-
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, robot-server, shared-data): add FlexStacker module to the hardware controller and robot server. #17187
Open
vegano1
wants to merge
9
commits into
edge
Choose a base branch
from
flex-stacker-add-module-skeleton
base: edge
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a2cf1e3
save
vegano1 d26ee40
feat(api,robot-server,shared-data): add FlexStacker module to the har…
vegano1 be1a278
add poller status getters
vegano1 5865baa
Merge branch 'edge' into flex-stacker-add-module-skeleton
vegano1 2cf4b16
Update ot3controller.py
vegano1 ce2b674
fixes to robot-server and api
vegano1 f1b0e69
add get motion params (M120) and enable motors (M17) to FlexStackerDr…
vegano1 18bdd62
- add enable_motors to driver and module
vegano1 83b5b7d
Merge branch 'edge' into flex-stacker-add-module-skeleton
vegano1 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from .abstract import AbstractStackerDriver | ||
from .abstract import AbstractFlexStackerDriver | ||
from .driver import FlexStackerDriver | ||
from .simulator import SimulatingDriver | ||
|
||
__all__ = [ | ||
"AbstractStackerDriver", | ||
"AbstractFlexStackerDriver", | ||
"FlexStackerDriver", | ||
"SimulatingDriver", | ||
] |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from enum import Enum | ||
from dataclasses import dataclass, fields | ||
from typing import List | ||
from typing import List, Dict | ||
|
||
from opentrons.drivers.command_builder import CommandBuilder | ||
|
||
|
@@ -45,6 +45,14 @@ class StackerInfo: | |
hw: HardwareRevision | ||
sn: str | ||
|
||
def to_dict(self) -> Dict[str, str]: | ||
"""Build command.""" | ||
return { | ||
"serial": self.sn, | ||
"version": self.fw, | ||
"model": self.hw.value, | ||
} | ||
|
||
|
||
class StackerAxis(Enum): | ||
"""Stacker Axis.""" | ||
|
@@ -90,11 +98,11 @@ def distance(self, distance: float) -> float: | |
class LimitSwitchStatus: | ||
"""Stacker Limit Switch Statuses.""" | ||
|
||
XE: bool | ||
XR: bool | ||
ZE: bool | ||
ZR: bool | ||
LR: bool | ||
XE: bool = False | ||
XR: bool = False | ||
ZE: bool = False | ||
ZR: bool = False | ||
LR: bool = False | ||
|
||
@classmethod | ||
def get_fields(cls) -> List[str]: | ||
|
@@ -116,8 +124,8 @@ def get(self, axis: StackerAxis, direction: Direction) -> bool: | |
class PlatformStatus: | ||
"""Stacker Platform Statuses.""" | ||
|
||
E: bool | ||
R: bool | ||
E: bool = False | ||
R: bool = False | ||
|
||
@classmethod | ||
def get_fields(cls) -> List[str]: | ||
|
@@ -128,6 +136,58 @@ def get(self, direction: Direction) -> bool: | |
"""Get platform status.""" | ||
return self.E if direction == Direction.EXTENT else self.R | ||
|
||
def to_dict(self) -> Dict[str, bool]: | ||
"""Dict of the data.""" | ||
return { | ||
"extent": self.E, | ||
"retract": self.R, | ||
} | ||
|
||
|
||
class PlatformState(Enum): | ||
UNKNOWN = "unknown" | ||
EXTENDED = "extended" | ||
RETRACTED = "retracted" | ||
|
||
@classmethod | ||
def from_status(cls, status: PlatformStatus) -> "PlatformState": | ||
"""Get the state from the platform status.""" | ||
if status.E and not status.R: | ||
return PlatformState.EXTENDED | ||
if status.R and not status.E: | ||
return PlatformState.RETRACTED | ||
return PlatformState.UNKNOWN | ||
|
||
|
||
class StackerAxisState(Enum): | ||
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. Nice - I was actually planning on this exact logic of this in FW. So we can send a GCode querying the axis state, and it will return one of these strings. |
||
UNKNOWN = "unknown" | ||
EXTENDED = "extended" | ||
RETRACTED = "retracted" | ||
|
||
@classmethod | ||
def from_status( | ||
cls, status: LimitSwitchStatus, axis: StackerAxis | ||
) -> "StackerAxisState": | ||
"""Get the axis state from the limit switch status.""" | ||
match axis: | ||
case StackerAxis.X: | ||
if status.XE and not status.XR: | ||
return StackerAxisState.EXTENDED | ||
if status.XR and not status.XE: | ||
return StackerAxisState.RETRACTED | ||
case StackerAxis.Z: | ||
if status.ZE and not status.ZR: | ||
return StackerAxisState.EXTENDED | ||
if status.ZR and not status.ZE: | ||
return StackerAxisState.RETRACTED | ||
case StackerAxis.L: | ||
return ( | ||
StackerAxisState.EXTENDED | ||
if status.LR | ||
else StackerAxisState.RETRACTED | ||
) | ||
return StackerAxisState.UNKNOWN | ||
|
||
|
||
@dataclass | ||
class MoveParams: | ||
|
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.
The GCode that we use to get the limit switch statuses always return results for all axes. What are the reasoning behind having setting default values?
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 it easier to build the obj for testing.