Skip to content
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

Use enumerator for the actuator packet ID #1152

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .handle import ActuatorBoard
from .packets import (
ActuatorPacketId,
ActuatorPollRequestPacket,
ActuatorPollResponsePacket,
ActuatorSetPacket,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
from dataclasses import dataclass
from enum import IntEnum

from mil_usb_to_can.sub9 import Packet


class ActuatorPacketId(IntEnum):
"""
Enumerator representing each controllable actuator.
"""

#: The dropper actuator.
DROPPER = 0
#: The torpedo launcher actuator.
TORPEDO_LAUNCHER = 1
#: The ball drop actuator. Only one actuator is used for both balls.
BALL_DROP = 2


@dataclass
class ActuatorSetPacket(Packet, msg_id=0x03, subclass_id=0x00, payload_format="BB"):
"""
Packet used by the actuator board to set a specific valve.

Attributes:
address (int): The actuator ID to set.
address (ActuatorPacketId): The actuator ID to set.
open (bool): Whether to open the specified actuator. ``True`` requests opening,
``False`` requests closing.
"""

address: int
address: ActuatorPacketId
open: bool


Expand All @@ -29,8 +43,6 @@ class ActuatorPollRequestPacket(
Packet used by the actuator board to request the status of all valves.
"""

pass


@dataclass
class ActuatorPollResponsePacket(
Expand Down
5 changes: 5 additions & 0 deletions docs/subjugator/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ ActuatorBoardSimulation
.. autoclass:: sub_actuator_board.ActuatorBoardSimulation
:members:

ActuatorPacketId
^^^^^^^^^^^^^^^^
.. autoclass:: sub_actuator_board.ActuatorPacketId
:members:

ActuatorSetPacket
^^^^^^^^^^^^^^^^^
.. attributetable:: sub_actuator_board.ActuatorSetPacket
Expand Down
Loading