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

Gimbal protocol v2 plugin - addressing PR comments #1953

Merged
merged 7 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions mavros_extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ add_library(mavros_extras_plugins SHARED
src/plugins/esc_status.cpp
src/plugins/esc_telemetry.cpp
src/plugins/fake_gps.cpp
src/plugins/gimbal_control.cpp
src/plugins/gps_input.cpp
src/plugins/gps_rtk.cpp
src/plugins/gps_status.cpp
Expand Down
22 changes: 22 additions & 0 deletions mavros_extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ fake\_gps
Sends fake GPS from local position estimation source data (motion capture, vision) to FCU.


gimbal\_control
----

Adds support for Mavlink Gimbal Protocol v2. To publish to tf, set parameter
tf_send=True. The implementation of this plugin has been tested with a
Freefly Astro with the mapping payload as well as with Auterion Sim. The
plugin was built following the specifications available at
https://mavlink.io/en/services/gimbal_v2.html with some adaptation to better
suit ROS2 and support tf publishing with child frame labels specified by the
gimbal_device_id field of gimbal_attitude_msg. This should enable support for
multiple gimbal devices on the target platform publishing to different leaves
of the tf tree. The assumed frame for each gimbal device is base_link_frd.
When taking control of the gimbal with the GimbalManagerConfigure, sysid_primary
can be set to -2, and default gimbal_device_id is 154, though 0 can be used for all
gimbal devices. After taking control of the gimbal, you can set RoI's or manually
set the gimbal's orientation using the service calls provided. The topic publishers
for gimbal control have not been successfully validated, though this is possibly due
to the implimentation on the Freefly Astro or with Auterion's simulator. Feel
free to reach out to mark.beaty@adinkratech.com with any questions or feedback on
this plugin!


gps\_input
-----------

Expand Down
6 changes: 6 additions & 0 deletions mavros_extras/mavros_plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Sends fake GPS from local position estimation source data (motion capture,
vision) to FCU - processed in HIL mode or out of it if parameter MAV_USEHILGPS
is set on PX4 Pro Autopilot Firmware; Ardupilot Firmware already supports it
without a flag set.</description>
</class>
<class name="gimbal_control" type="mavros::plugin::PluginFactoryTemplate&lt;mavros::extra_plugins::GimbalControlPlugin&gt;" base_class_type="mavros::plugin::PluginFactory">
<description>@brief Gimbal Control Plugin
@plugin gimbal_control

Adds support for Mavlink Gimbal Protocol v2.</description>
Comment on lines +74 to +77
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Original comment by "vooon":
"I think you haven't used cog.py to re-generate that file?"

I am not sure how to run it so it effects this file? I can the ./mavros/tools/cogall.sh but it did not seem to regenerate this file. Could you point me in the right direction to figure out how to regenerate it?

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/cog-requirements.txt

Cogall depends on installed cog.py, probbly in today's world that be easier with pipx, but i haven't exact directions for that.

So in general, you must do like that (beware, not tested!):

python3 -m venv ~/ros/.venv
source ~/ros/.venv
pip3 install -r cog-requirements.txt
pip3 install pymavlink
ln mavros_cog.py ~/ros/.venv/lib/python3.11/site-packages/

Then

cog -cr mavros_extras/mavros_plugins.xml

Copy link
Member

Choose a reason for hiding this comment

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

Also note, cog would raise an error if generated part didn't match md5. But you simply can remove hash after [[[end]]].

</class>
<class name="gps_input" type="mavros::plugin::PluginFactoryTemplate&lt;mavros::extra_plugins::GpsInputPlugin&gt;" base_class_type="mavros::plugin::PluginFactory">
<description>@brief GPS_INPUT GPS plugin.
Expand Down
Loading
Loading