From 4f500440b5d785c9f7cc1698b15b758df9ced507 Mon Sep 17 00:00:00 2001 From: Alise Au <20424172+ahiuchingau@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:38:54 -0500 Subject: [PATCH] feat(can): add getMoveStatus request & response (#8688) --- .../drivers/can_bus/constants.py | 2 ++ .../can_bus/messages/message_definitions.py | 18 ++++++++++++++++++ .../drivers/can_bus/messages/messages.py | 2 ++ .../drivers/can_bus/messages/payloads.py | 11 +++++++++++ 4 files changed, 33 insertions(+) diff --git a/hardware/opentrons_hardware/drivers/can_bus/constants.py b/hardware/opentrons_hardware/drivers/can_bus/constants.py index 280eca92289..fc212738ead 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/constants.py +++ b/hardware/opentrons_hardware/drivers/can_bus/constants.py @@ -62,3 +62,5 @@ class MessageId(int, Enum): clear_move_group_request = 0x19 move_group_completed = 0x1A move_completed = 0x13 + get_move_status_request = 0x30 + get_move_status_response = 0x31 diff --git a/hardware/opentrons_hardware/drivers/can_bus/messages/message_definitions.py b/hardware/opentrons_hardware/drivers/can_bus/messages/message_definitions.py index c8c1305aabb..1c17701cc57 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/messages/message_definitions.py +++ b/hardware/opentrons_hardware/drivers/can_bus/messages/message_definitions.py @@ -178,3 +178,21 @@ class MoveCompleted: # noqa: D101 payload: payloads.MoveCompletedPayload payload_type: Type[BinarySerializable] = payloads.MoveCompletedPayload message_id: Literal[MessageId.move_completed] = MessageId.move_completed + + +@dataclass +class GetMoveStatusRequest: # noqa: D101 + payload: payloads.EmptyPayload + payload_type: Type[BinarySerializable] = payloads.EmptyPayload + message_id: Literal[ + MessageId.get_move_status_request + ] = MessageId.get_move_status_request + + +@dataclass +class GetMoveStatusResponse: # noqa: D101 + payload: payloads.GetMoveStatusResponsePayload + payload_type: Type[BinarySerializable] = payloads.GetMoveStatusResponsePayload + message_id: Literal[ + MessageId.get_move_status_response + ] = MessageId.get_move_status_response diff --git a/hardware/opentrons_hardware/drivers/can_bus/messages/messages.py b/hardware/opentrons_hardware/drivers/can_bus/messages/messages.py index 7748beae6c3..49a2bb67ab0 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/messages/messages.py +++ b/hardware/opentrons_hardware/drivers/can_bus/messages/messages.py @@ -31,6 +31,8 @@ defs.ClearMoveGroupRequest, defs.MoveGroupCompleted, defs.MoveCompleted, + defs.GetMoveStatusRequest, + defs.GetMoveStatusResponse, ] diff --git a/hardware/opentrons_hardware/drivers/can_bus/messages/payloads.py b/hardware/opentrons_hardware/drivers/can_bus/messages/payloads.py index 66b6aface28..5fdcd006d29 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/messages/payloads.py +++ b/hardware/opentrons_hardware/drivers/can_bus/messages/payloads.py @@ -109,3 +109,14 @@ class MoveCompletedPayload(MoveGroupRequestPayload): seq_id: utils.UInt8Field ack_id: utils.UInt8Field node_id: utils.UInt8Field + + +@dataclass +class GetMoveStatusResponsePayload(MoveGroupRequestPayload): + """Read status of current move being executed.""" + + seq_id: utils.UInt8Field + remaining_duration: utils.UInt64Field + current_position: utils.UInt64Field + node_id: utils.UInt8Field + padding: utils.UInt8Field