-
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): add extension mount and axes to top level types #12671
Changes from 7 commits
05c0953
a41bd3c
0b71669
5701ab3
a441c88
e6d1348
622e041
5748877
8e9e77e
050cc2a
36654ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ def _sanitize_attached_instrument( | |
|
||
self._attached_instruments = { | ||
m: _sanitize_attached_instrument(attached_instruments.get(m)) | ||
for m in types.Mount | ||
for m in types.Mount # Check if addition of extension Mount creates issues for this | ||
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. feels like we should just use |
||
} | ||
self._stubbed_attached_modules = attached_modules | ||
self._position = copy.copy(self._smoothie_driver.homed_position) | ||
|
@@ -284,7 +284,7 @@ async def get_attached_instruments( | |
""" | ||
return { | ||
mount: self._attached_to_mount(mount, expected.get(mount)) | ||
for mount in types.Mount | ||
for mount in types.Mount.ot2_mounts() | ||
} | ||
|
||
def set_active_current(self, axis_currents: Dict[Axis, float]) -> None: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,18 +30,21 @@ class MotionChecks(enum.Enum): | |
|
||
|
||
class Axis(enum.Enum): | ||
X = 0 | ||
Y = 1 | ||
Z = 2 | ||
A = 3 | ||
B = 4 | ||
C = 5 | ||
X = 0 # Gantry X | ||
Y = 1 # Gantry Y | ||
Z = 2 # left pipette mount Z | ||
A = 3 # right pipette mount Z | ||
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. I don't want to change the ot3 stuff to use
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. Sorry, not sure which change you are talking about here. There are still two different axis types- |
||
B = 4 # left pipette plunger | ||
C = 5 # right pipette plunger | ||
Z_G = 6 # Gripper Z | ||
G = 7 # Gripper Jaws | ||
|
||
@classmethod | ||
def by_mount(cls, mount: top_types.Mount) -> "Axis": | ||
bm = {top_types.Mount.LEFT: cls.Z, top_types.Mount.RIGHT: cls.A} | ||
return bm[mount] | ||
|
||
# TODO (spp, 2023-5-4): deprecate this method & create a replacement called 'pipette_mount_axes' | ||
@classmethod | ||
def mount_axes(cls) -> Tuple["Axis", "Axis"]: | ||
"""The axes which are used for moving pipettes up and down.""" | ||
|
@@ -66,12 +69,19 @@ def to_mount(cls, inst: "Axis") -> top_types.Mount: | |
cls.A: top_types.Mount.RIGHT, | ||
cls.B: top_types.Mount.LEFT, | ||
cls.C: top_types.Mount.RIGHT, | ||
cls.Z_G: top_types.Mount.EXTENSION, | ||
cls.G: top_types.Mount.EXTENSION, | ||
}[inst] | ||
|
||
@classmethod | ||
def pipette_axes(cls) -> Tuple["Axis", "Axis"]: | ||
return cls.B, cls.C | ||
|
||
@classmethod | ||
def ot2_axes(cls) -> List["Axis"]: | ||
"""Returns only OT2 axes.""" | ||
return [axis for axis in Axis if axis not in [Axis.Z_G, Axis.G]] | ||
|
||
def __str__(self) -> str: | ||
return self.name | ||
|
||
|
@@ -88,11 +98,13 @@ def from_mount( | |
top_types.Mount, top_types.MountType, top_types.OT3MountType, "OT3Mount" | ||
], | ||
) -> "OT3Mount": | ||
if mount == top_types.Mount.EXTENSION or mount == top_types.MountType.EXTENSION: | ||
return OT3Mount.GRIPPER | ||
return cls[mount.name] | ||
|
||
def to_mount(self) -> top_types.Mount: | ||
if self.value == self.GRIPPER.value: | ||
raise KeyError("Gripper mount is not representable") | ||
return top_types.Mount.EXTENSION | ||
return top_types.Mount[self.name] | ||
|
||
|
||
|
@@ -141,6 +153,7 @@ def by_mount(cls, mount: Union[top_types.Mount, OT3Mount]) -> "OT3Axis": | |
bm = { | ||
top_types.Mount.LEFT: cls.Z_L, | ||
top_types.Mount.RIGHT: cls.Z_R, | ||
top_types.Mount.EXTENSION: cls.Z_G, | ||
OT3Mount.LEFT: cls.Z_L, | ||
OT3Mount.RIGHT: cls.Z_R, | ||
OT3Mount.GRIPPER: cls.Z_G, | ||
|
@@ -156,6 +169,8 @@ def from_axis(cls, axis: Union[Axis, "OT3Axis"]) -> "OT3Axis": | |
Axis.A: cls.Z_R, | ||
Axis.B: cls.P_L, | ||
Axis.C: cls.P_R, | ||
Axis.Z_G: cls.Z_G, | ||
Axis.G: cls.G, | ||
} | ||
try: | ||
return am[axis] # type: ignore | ||
|
@@ -170,6 +185,8 @@ def to_axis(self) -> Axis: | |
OT3Axis.Z_R: Axis.A, | ||
OT3Axis.P_L: Axis.B, | ||
OT3Axis.P_R: Axis.C, | ||
OT3Axis.Z_G: Axis.Z_G, | ||
OT3Axis.G: Axis.G, | ||
} | ||
return am[self] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,7 @@ async def execute( | |
[ | ||
MotorAxis.RIGHT_Z, | ||
MotorAxis.LEFT_Z, | ||
MotorAxis.EXTENSION_Z, | ||
] | ||
) | ||
|
||
|
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.
I think this is correct modulo using a more specific exception than
AssertionError
- I think we want like aNotSupportedByHardware
error