-
Notifications
You must be signed in to change notification settings - Fork 178
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
refactor(api): ot3: add gripper critical points #11024
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0e1b674
refactor(api): Add critical points to gripper
sfoster1 110c829
more gripper offset changes
sfoster1 2c98016
same here
sfoster1 2b16b49
fix s-d makefile deps for python dist
sfoster1 9d041ef
refactor(api): add critical point handling for gripper
sfoster1 96df766
now that's the right number
sfoster1 659269f
need more juice for the gripper z
sfoster1 ed44405
Critical point validity checking
sfoster1 84aeec9
whoops
sfoster1 2cda194
change pin names, add comments
sfoster1 21b6c37
fixups from rebase
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,11 @@ | |
from opentrons.types import Point | ||
from opentrons.calibration_storage.types import GripperCalibrationOffset | ||
from opentrons.config import gripper_config | ||
from opentrons.hardware_control.types import CriticalPoint, GripperJawState | ||
from opentrons.hardware_control.types import ( | ||
CriticalPoint, | ||
GripperJawState, | ||
InvalidMoveError, | ||
) | ||
from .instrument_abc import AbstractInstrument | ||
from opentrons.hardware_control.dev_types import AttachedGripper, GripperDict | ||
|
||
|
@@ -37,7 +41,24 @@ def __init__( | |
self._config = config | ||
self._name = self._config.name | ||
self._model = self._config.model | ||
base_offset = Point(*self._config.base_offset_from_mount) | ||
self._jaw_center_offset = ( | ||
Point(*self._config.jaw_center_offset_from_base) + base_offset | ||
) | ||
#: the distance between the gripper mount and the jaw center at home | ||
self._front_calibration_pin_offset = ( | ||
Point(*self._config.pin_one_offset_from_base) + base_offset | ||
) | ||
#: the distance between the gripper mount and the front calibration pin | ||
#: at home | ||
self._back_calibration_pin_offset = ( | ||
Point(*self._config.pin_two_offset_from_base) + base_offset | ||
) | ||
#: the distance between the gripper mount and the back calibration pin | ||
#: at home | ||
self._calibration_offset = gripper_cal_offset | ||
#: The output value of calibration - the additional vector added into | ||
#: the critical point geometry based on gripper mount calibration | ||
self._gripper_id = gripper_id | ||
self._state = GripperJawState.UNHOMED | ||
self._log = mod_log.getChild(self._gripper_id) | ||
|
@@ -80,12 +101,23 @@ def update_calibration_offset(self, cal_offset: GripperCalibrationOffset) -> Non | |
|
||
def critical_point(self, cp_override: Optional[CriticalPoint] = None) -> Point: | ||
""" | ||
The vector from the gripper's origin to its critical point. The | ||
critical point for a pipette is the end of the nozzle if no tip is | ||
attached, or the end of the tip if a tip is attached. | ||
The vector from the gripper mount to the critical point, which is selectable | ||
between the center of the gripper engagement volume and the calibration pins. | ||
""" | ||
# TODO: add critical point implementation | ||
return Point(0, 0, 0) | ||
if cp_override == CriticalPoint.GRIPPER_FRONT_CALIBRATION_PIN: | ||
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. If we do decide to just pick one location, can we call 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. yeah |
||
return self._front_calibration_pin_offset + Point( | ||
*self._calibration_offset.offset | ||
) | ||
elif cp_override == CriticalPoint.GRIPPER_BACK_CALIBRATION_PIN: | ||
return self._back_calibration_pin_offset + Point( | ||
*self._calibration_offset.offset | ||
) | ||
elif cp_override == CriticalPoint.GRIPPER_JAW_CENTER or not cp_override: | ||
return self._jaw_center_offset + Point(*self._calibration_offset.offset) | ||
else: | ||
raise InvalidMoveError( | ||
f"Critical point {cp_override.name} is not valid for a gripper" | ||
) | ||
|
||
def duty_cycle_by_force(self, newton: float) -> float: | ||
return gripper_config.piecewise_force_conversion( | ||
|
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
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.
Can we change this to:
calibrated_point
or something? Makes me think that this is a default configuration rather than a value we got from calibrating the thing.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's not a point though, it's the offset you get from calibration that's added into the rest of the critical point offsets. i'm not sure what else to call it, but maybe comments would help?
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.
8d885d7
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.
hmm comments are fine for now, I can't think of a better name at the moment other than maybe
_mount_to_calibration_pin_offset
which is kinda long lol.