-
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 RobotContext movement commands #16403
Conversation
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.
inline comments. also i think something got lost in moveAxes
vs moveAxesRelative
, it seems like the gantry_mover
function is missing an argument or a separate implementation for relative moves
|
||
Args: | ||
axis_map: The mapping of axes to command. | ||
relative_move: Specifying whether a relative move needs to be handled or not. |
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.
?
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.
Updated the description, let me know if it makes more sense now.
from opentrons.protocol_api.core.robot import AbstractRobot | ||
|
||
_AXIS_TYPE_TO_MOTOR_AXIS = { | ||
AxisType.X: MotorAxis.X, |
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.
this kind of seems like it should be in the engine
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.
It is in the engine, or did you mean a specific file?
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.
This isn't the engine - this is the protocol api engine bindings. My point is really that in my opinion, we shouldn't need to move AxisType
to opentrons.types
; instead, we should push MotorAxis
upwards. Types that are used for the hardware controller shouldn't be part of user API.
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.
OK I guess that makes sense as well. I'll make the change, but as a PR based off this one since there is already a lot going on and there will be a decent amount of import changes.
abs_axis_map: Dict[hw_types.Axis, hw_types.AxisMapValue], | ||
velocity: float, | ||
critical_point: Optional[hw_types.CriticalPoint], | ||
axis_map: Union[AxisMapType, StringAxisMap], |
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.
should these be hardware axes or engine axes? I think we should probably use engine axes, since this goes to the engine and that's what it uses, and also that will keep it the same as json protos
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.
See comment from here
52bd17b
to
b91630b
Compare
@@ -69,9 +150,54 @@ def open_gripper_jaw(self) -> None: | |||
raise NotImplementedError() | |||
|
|||
def axis_coordinates_for( |
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.
random question, is this intended to be called from a protocol before using move_axes_relative
or move_axes_to
?
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.
move_axes_relative
can be called directly with a user dict, but axis_coordinates_for
is intended to help users build a proper absolute position axis map from location
. In a follow-up PR I will also build out the slot
and module
locations but I felt like there was already a lot here and decided not to address it as we only need "location" at the moment for the evo protocol.
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.
a few nips but overall looks super intuitive and makes total sense. I just want to make sure we dont need to update the state right? (sorry I was not part of the convo's of this feature)
632b75e
to
5fa07d7
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.
There's a couple last little things we need to do. Some of them can be todos, but we definitely should update the command schema since it'll be quick.
I'm also a little concerned about the big changes to ot3controller. That's all to allow users to specify gear motor motions from the robot context, right? could we split that part out of this pr?
@@ -1228,7 +1230,9 @@ async def move_axes( # noqa: C901 | |||
message=f"{axis} is not present", detail={"axis": str(axis)} | |||
) | |||
|
|||
self._log.info(f"Attempting to move {position} with speed {speed}.") |
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.
note which coordinates this is in in the log please
# TODO (lc 08-16-2024) implement `move_axes` for OT 2 hardware controller | ||
# and then we can remove this validation. | ||
ensure_ot3_hardware(self._hardware_api) | ||
|
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.
another thing we need to add here, and in the other commands, is that we changed the way the engine keeps track of positions to be based on StateUpdate
objects that command implementations return. specifically, these will need to return state_updates
with set_pipette_location()
as aspirate now does for protocol engine commands after this one to properly know where the pipette currently is. we can have a todo for this, but it will be outright broken until then.
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 mean it would still execute the movements no? We have tickets for updating state for the robot context and I'd rather not add more to the PR than necessary.
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.
Yeah, they will. It'll just move weird after.
5d0e3c8
to
02b8dde
Compare
02b8dde
to
8a6873d
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.
Okay, I feel great about this now. Thanks for bearing with me, and thanks for splitting that stuff out. Great work!
# TODO (lc 08-16-2024) implement `move_axes` for OT 2 hardware controller | ||
# and then we can remove this validation. | ||
ensure_ot3_hardware(self._hardware_api) | ||
|
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.
Yeah, they will. It'll just move weird after.
8a6873d
to
0297272
Compare
5271362
to
1fb5978
Compare
Overview
In this PR, you'll find a couple of major changes including hooking up the
RobotContext
with the protocol engine, adding the three movement commands (PLAT-351, PLAT-352, PLAT-449, PLAT-452, PLAT-455) in the context as well as http commands.Remaining work
Test Plan and Hands on Testing
Robot has been tested with pipette mounts and will need to be tested with the gripper mount.
Changelog
robot/moveTo
,robot/moveAxesRelative
androbot/moveAxesTo
protocol engine commandsmoveTo
commandNote
The
axis_coordinates_for
function can only properly handleLocation
types at this moment. There will be a follow-up PR to addressmodules
andslots
.Review requests
Double check that routing makes sense and that I'm not missing any movement conversions before passing off to the hardware controller.
Risk assessment
Low. This is a use at your own risk API.