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

Adding OpenDroneID plugin and messages #2002

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from

Conversation

gus-robotics88
Copy link

@gus-robotics88 gus-robotics88 commented Oct 15, 2024

Adds a plugin to receive OpenDroneID mavros messages and send the data to the FCU. Messages based on Open Drone ID MAVLink spec.

Looking at the contributing guidelines, it recommends to uncrustify and test, but it looks like the guidelines are out of date as the uncrustify config no longer exists in tools/, and it recommends testing with catkin which is no longer used for ROS2. What is the recommended method for uncrustifying and testing?

Tested using Ardupilot, confirmed that messages are received and broadcasted by Ardupilot Open Drone ID infrastructure.

@vooon vooon added this to the Version 2.10 milestone Oct 17, 2024
@vooon
Copy link
Member

vooon commented Oct 17, 2024

In ros2 you have ament_uncrustify, just use the one from jazzy or rolling.

You can run tests using colcon test.

@@ -111,6 +111,7 @@ add_library(mavros_extras_plugins SHARED
src/plugins/obstacle_distance.cpp
src/plugins/odom.cpp
src/plugins/onboard_computer_status.cpp
src/plugins/open_drone_id.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of file must be generated by cog script. Please do not change this blocks manually.

<description>@brief Open Drone ID plugin
@plugin open_drone_id

Sends Open Drone ID data to the FCU</description>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same - cog extracts metadata from special plugin comments. Do not change manually.

operator_id.operator_id_type = msg->operator_id_type;

size_t length = std::min(operator_id.operator_id.size(), msg->operator_id.size());
std::memcpy(operator_id.operator_id.data(), msg->operator_id.data(), length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use mavlink::set_string() or set_string_z().

Example:

mavlink::set_string(ret.param_id, param_id);

system.category_eu = msg->category_eu;
system.class_eu = msg->class_eu;
system.operator_altitude_geo = msg->operator_altitude_geo;
system.timestamp = msg->timestamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to see a cog script here...

msg/OpenDroneID/OperatorID.msg
msg/OpenDroneID/SelfID.msg
msg/OpenDroneID/System.msg
msg/OpenDroneID/SystemUpdate.msg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same - code generated list.

uint8 MAV_ODID_ID_TYPE_SERIAL_NUMBER = 1
uint8 MAV_ODID_ID_TYPE_CAA_REGISTRATION_ID = 2
uint8 MAV_ODID_ID_TYPE_UTM_ASSIGNED_UUID = 3
uint8 MAV_ODID_ID_TYPE_SPECIFIC_SESSION_ID = 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/mavlink/mavros/blob/ros2/mavros_cog.py#L217

I'd prefer to remove unneded prefix - anyway it'll be namespaced into msg class.

@vooon
Copy link
Member

vooon commented Oct 17, 2024

Oh, and as i remember - idl do not recognize subdirs, so you must move messages to msg dir, just with prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants