-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created packets for boat-drone communication (#1301)
* Created packets for boat-drone communication * fixed PR comments * navigator_drone_comm: Add packet listing to docs, export packet members in __init__, make catkin package python-centered --------- Co-authored-by: Cameron Brown <[email protected]>
- Loading branch information
Showing
7 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
NaviGator/hardware_drivers/navigator_drone_comm/CMakeLists.txt
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 |
---|---|---|
@@ -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} | ||
) |
10 changes: 10 additions & 0 deletions
10
NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/__init__.py
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .packets import ( | ||
Color, | ||
EStopPacket, | ||
GPSDronePacket, | ||
HeartbeatReceivePacket, | ||
HeartbeatSetPacket, | ||
StartPacket, | ||
StopPacket, | ||
TargetPacket, | ||
) |
91 changes: 91 additions & 0 deletions
91
NaviGator/hardware_drivers/navigator_drone_comm/navigator_drone_comm/packets.py
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 |
---|---|---|
@@ -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="<fff"): | ||
""" | ||
GPS location of drone packet. | ||
Attributes: | ||
lat (float): The latitude of the drone. | ||
lon (float): The longitude of the drone. | ||
alt (float): The altitude of the drone. | ||
""" | ||
|
||
lat: float | ||
lon: float | ||
alt: float | ||
|
||
|
||
@dataclass | ||
class EStopPacket(Packet, class_id=0x20, subclass_id=0x03, payload_format=""): | ||
""" | ||
Emergency stop drone packet. | ||
""" | ||
|
||
|
||
@dataclass | ||
class StartPacket(Packet, class_id=0x20, subclass_id=0x04, payload_format="<20s"): | ||
""" | ||
Start drone mission packet. | ||
Attributes: | ||
name (str): The name of the mission to run on the drone. Limited to 20 characters. | ||
""" | ||
|
||
name: str | ||
|
||
|
||
@dataclass | ||
class StopPacket(Packet, class_id=0x20, subclass_id=0x05, payload_format=""): | ||
""" | ||
Stop drone and return packet. | ||
""" | ||
|
||
|
||
class Color(Enum): | ||
""" | ||
Enum to represent the color of a target. | ||
""" | ||
|
||
BLUE = "b" | ||
GREEN = "g" | ||
RED = "r" | ||
|
||
|
||
@dataclass | ||
class TargetPacket(Packet, class_id=0x20, subclass_id=0x06, payload_format="<ffc"): | ||
""" | ||
GPS of drone-identified target packet. | ||
Attributes: | ||
lat (float): The latitude of the target. | ||
lon (float): The longitude of the target. | ||
color (Color): The color of the target. | ||
""" | ||
|
||
lat: float | ||
lon: float | ||
color: Color |
15 changes: 15 additions & 0 deletions
15
NaviGator/hardware_drivers/navigator_drone_comm/package.xml
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>navigator_drone_comm</name> | ||
<version>0.0.0</version> | ||
<description>The navigator_drone_comm package</description> | ||
|
||
<maintainer email="[email protected]">Alex Johnson</maintainer> | ||
|
||
<license>TODO</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>rospy</build_depend> | ||
<build_export_depend>rospy</build_export_depend> | ||
<exec_depend>rospy</exec_depend> | ||
</package> |
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 |
---|---|---|
@@ -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) |
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