diff --git a/NaviGator/hardware_drivers/navigator_drone_comm/CMakeLists.txt b/NaviGator/hardware_drivers/navigator_drone_comm/CMakeLists.txt new file mode 100644 index 000000000..7672c7baf --- /dev/null +++ b/NaviGator/hardware_drivers/navigator_drone_comm/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.0.2) +project(navigator_drone_comm) + +find_package(catkin REQUIRED COMPONENTS + rospy +) + +catkin_python_setup() +catkin_package() + +include_directories( +# include + ${catkin_INCLUDE_DIRS} +) diff --git a/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/__init__.py b/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/__init__.py new file mode 100644 index 000000000..9c356af2d --- /dev/null +++ b/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/__init__.py @@ -0,0 +1,10 @@ +from .packets import ( + Color, + EStopPacket, + GPSDronePacket, + HeartbeatReceivePacket, + HeartbeatSetPacket, + StartPacket, + StopPacket, + TargetPacket, +) diff --git a/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/packets.py b/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/packets.py new file mode 100644 index 000000000..a60003dd3 --- /dev/null +++ b/NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/packets.py @@ -0,0 +1,91 @@ +from dataclasses import dataclass +from enum import Enum + +from electrical_protocol import Packet + + +@dataclass +class HeartbeatReceivePacket( + Packet, + class_id=0x20, + subclass_id=0x00, + payload_format="", +): + """ + Heartbeat packet sent from the drone. + """ + + +@dataclass +class HeartbeatSetPacket(Packet, class_id=0x20, subclass_id=0x01, payload_format=""): + """ + Heartbeat packet sent from the boat. + """ + + +@dataclass +class GPSDronePacket(Packet, class_id=0x20, subclass_id=0x02, payload_format=" + + navigator_drone_comm + 0.0.0 + The navigator_drone_comm package + + Alex Johnson + + TODO + + catkin + rospy + rospy + rospy + diff --git a/NaviGator/hardware_drivers/navigator_drone_comm/setup.py b/NaviGator/hardware_drivers/navigator_drone_comm/setup.py new file mode 100644 index 000000000..ec0c3a7a2 --- /dev/null +++ b/NaviGator/hardware_drivers/navigator_drone_comm/setup.py @@ -0,0 +1,11 @@ +# ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD + +from catkin_pkg.python_setup import generate_distutils_setup +from setuptools import setup + +# Fetch values from package.xml +setup_args = generate_distutils_setup( + packages=["navigator_drone_comm"], +) + +setup(**setup_args) diff --git a/docs/navigator/reference.rst b/docs/navigator/reference.rst index 84b49e4e4..d85e375ab 100644 --- a/docs/navigator/reference.rst +++ b/docs/navigator/reference.rst @@ -411,3 +411,65 @@ SetSpinPacket .. autoclass:: navigator_ball_launcher.SetSpinPacket :members: + +:mod:`navigator_drone_comm` - Boat-drone communication standard +--------------------------------------------------------------- + +.. automodule:: navigator_drone_comm + :members: + +HeartbeatReceivePacket +^^^^^^^^^^^^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.HeartbeatReceivePacket + +.. autoclass:: navigator_drone_comm.HeartbeatReceivePacket + :members: + +HeartbeatSetPacket +^^^^^^^^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.HeartbeatSetPacket + +.. autoclass:: navigator_drone_comm.HeartbeatSetPacket + :members: + +GPSDronePacket +^^^^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.GPSDronePacket + +.. autoclass:: navigator_drone_comm.GPSDronePacket + :members: + +EStopPacket +^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.EStopPacket + +.. autoclass:: navigator_drone_comm.EStopPacket + :members: + +StopPacket +^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.StopPacket + +.. autoclass:: navigator_drone_comm.StopPacket + :members: + +StartPacket +^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.StartPacket + +.. autoclass:: navigator_drone_comm.StartPacket + :members: + +Color +^^^^^ +.. attributetable:: navigator_drone_comm.Color + +.. autoclass:: navigator_drone_comm.Color + :members: + +TargetPacket +^^^^^^^^^^^^ +.. attributetable:: navigator_drone_comm.TargetPacket + +.. autoclass:: navigator_drone_comm.TargetPacket + :members: diff --git a/docs/reference/electrical_protocol.rst b/docs/reference/electrical_protocol.rst index 58abe2922..621af67e3 100644 --- a/docs/reference/electrical_protocol.rst +++ b/docs/reference/electrical_protocol.rst @@ -114,6 +114,20 @@ byte length. | Launcher | | | | | Board) | | | | +------------+--------------+----------------+-------------------------------------------------------------------------+ +| 0x20 | 0x00 | Empty | :class:`navigator_drone_comm.HeartbeatReceivePacket` | +| (Drone) +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x01 | Empty | :class:`navigator_drone_comm.HeartbeatSetPacket` | ++ +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x02 | ``fff`` | :class:`navigator_drone_comm.GPSDronePacket` | ++ +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x03 | Empty | :class:`navigator_drone_comm.EStopPacket` | ++ +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x04 | ``20s`` | :class:`navigator_drone_comm.StartPacket` | ++ +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x05 | Empty | :class:`navigator_drone_comm.StopPacket` | ++ +--------------+----------------+-------------------------------------------------------------------------+ +| | 0x06 | ``ffc`` | :class:`navigator_drone_comm.TargetPacket` | ++------------+--------------+----------------+-------------------------------------------------------------------------+ Exceptions ~~~~~~~~~~