Skip to content

Commit

Permalink
feat(hardware): OT3 gripper info messages (#10027)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau authored Apr 21, 2022
1 parent a0504c7 commit 5724a19
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hardware/opentrons_hardware/firmware_bindings/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class NodeId(int, Enum):
head_l = 0x51
head_r = 0x52
gripper = 0x20
gripper_z = 0x21
gripper_g = 0x22
pipette_left_bootloader = pipette_left | 0xF
pipette_right_bootloader = pipette_right | 0xF
gantry_x_bootloader = gantry_x | 0xF
Expand Down Expand Up @@ -56,6 +58,8 @@ class MessageId(int, Enum):
task_info_response = 0x305
pipette_info_request = 0x306
pipette_info_response = 0x307
gripper_info_request = 0x308
gripper_info_response = 0x309

stop_request = 0x00

Expand Down
12 changes: 12 additions & 0 deletions hardware/opentrons_hardware/firmware_bindings/messages/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ class PipetteSerialField(utils.BinaryFieldBase[bytes]):
FORMAT = f"{NUM_BYTES}s"


class GripperSerialField(utils.BinaryFieldBase[bytes]):
"""The serial number of a gripper.
This is sized to handle only the datecode part of the serial
number; the full field can be synthesized from this, the
model number, and the name.
"""

NUM_BYTES = 12
FORMAT = f"{NUM_BYTES}s"


class SensorOutputBindingField(utils.UInt8Field):
"""sensor type."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,17 @@ class BindSensorOutputResponse: # noqa: D101
message_id: Literal[
MessageId.bind_sensor_output_response
] = MessageId.bind_sensor_output_response


@dataclass
class GripperInfoRequest(EmptyPayloadMessage): # noqa: D101
message_id: Literal[MessageId.gripper_info_request] = MessageId.gripper_info_request


@dataclass
class GripperInfoResponse: # noqa: D101
payload: payloads.GripperInfoResponsePayload
payload_type: Type[BinarySerializable] = payloads.GripperInfoResponsePayload
message_id: Literal[
MessageId.gripper_info_response
] = MessageId.gripper_info_response
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
defs.HomeRequest,
defs.PipetteInfoRequest,
defs.PipetteInfoResponse,
defs.GripperInfoRequest,
defs.GripperInfoResponse,
defs.BindSensorOutputRequest,
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
SensorTypeField,
PipetteNameField,
PipetteSerialField,
GripperSerialField,
SensorOutputBindingField,
)
from .. import utils
Expand Down Expand Up @@ -388,3 +389,11 @@ class BrushedMotorPwmPayload(utils.BinarySerializable):

freq: utils.UInt32Field
duty_cycle: utils.UInt32Field


@dataclass
class GripperInfoResponsePayload(utils.BinarySerializable):
"""A response carrying data about an attached gripper."""

gripper_model: utils.UInt16Field
gripper_serial: GripperSerialField

0 comments on commit 5724a19

Please sign in to comment.