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

Fix missing mavlink includes #869

Closed

Conversation

AustinDeric
Copy link

@AustinDeric AustinDeric commented Jun 5, 2022

adds missing mavlink includes which resolves the missing mavlink types:

  • MAV_CMD_REQUEST_STORAGE_INFORMATION
  • MAV_CMD_SET_CAMERA_ZOOM
  • MAV_CMD_SET_CAMERA_MODE
  • MAV_CMD_REQUEST_VIDEO_STREAM_INFORMATION
  • MAV_CMD_REQUEST_VIDEO_STREAM_STATUS

All these are found in the file generated by mavlink, located at: mavlink_root_filder/include/mavlink/v2.0/ardupilotmega/ardupilotmega.h

The bug is reproduced here: #868
This build is shown successful here (and this PR when CI is turned on): AustinDeric#1

@@ -24,6 +24,8 @@
#include <boost/algorithm/string.hpp>
#include <opencv2/opencv.hpp>

// Mavlink includes
#include <ardupilotmega/ardupilotmega.h>
Copy link
Author

Choose a reason for hiding this comment

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

This PR is only a 2-liner update. i'll rebase on master showing this after #868 is merged

Similar update in src/gazebo_gimbal_controller_plugin.cpp file below.

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

We should not be using the ardupilot mavlink dialect since the dialect is supposted to contain ardupilot specific mavlink definitions which is not compatible with PX4

@@ -24,6 +24,8 @@
#include <boost/algorithm/string.hpp>
#include <opencv2/opencv.hpp>

// Mavlink includes
#include <ardupilotmega/ardupilotmega.h>
Copy link
Member

Choose a reason for hiding this comment

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

We should not be using the ardupilot mega dialect, since this contains specific mavlink messages for the ardupilot project. PX4 is not compatible with the ardupilot project

Copy link
Author

@AustinDeric AustinDeric Jul 2, 2022

Choose a reason for hiding this comment

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

Agree, however this is where i found the types when building mavlink. here are the steps to reproduce: https://github.com/PX4/PX4-SITL_gazebo/pull/868/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R30. Where are these types located for you and how did you generate them? A standard method thats documented would be very helpful.

> [ 9/10] RUN source "/opt/ros/galactic/setup.bash" &&     export CPLUS_INCLUDE_PATH=/mavlink/include/mavlink/v2.0 &&     colcon build:                                                                  
#13 1.042 Starting >>> mavlink_sitl_gazebo                                                           
#13 124.3 --- stderr: mavlink_sitl_gazebo                                                            
#13 124.3 CMake Warning:                                                                             
#13 124.3   Manually-specified variables were not used by the project:
#13 124.3 
#13 124.3     CATKIN_INSTALL_INTO_PREFIX_ROOT
#13 124.3 
#13 124.3 
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp: In member function ‘void gazebo::GimbalControllerPlugin::HandleCommandLong(const mavlink_message_t&)’:
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:805:10: error: ‘MAV_CMD_REQUEST_MESSAGE’ was not declared in this scope
#13 124.3   805 |     case MAV_CMD_REQUEST_MESSAGE:
#13 124.3       |          ^~~~~~~~~~~~~~~~~~~~~~~
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:808:10: error: ‘MAV_CMD_SET_MESSAGE_INTERVAL’ was not declared in this scope; did you mean ‘MAVLINK_MSG_ID_MESSAGE_INTERVAL’?
#13 124.3   808 |     case MAV_CMD_SET_MESSAGE_INTERVAL:
#13 124.3       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3       |          MAVLINK_MSG_ID_MESSAGE_INTERVAL
#13 124.3 make[2]: *** [CMakeFiles/gazebo_gimbal_controller_plugin.dir/build.make:63: CMakeFiles/gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o] Error 1
#13 124.3 make[1]: *** [CMakeFiles/Makefile2:1026: CMakeFiles/gazebo_gimbal_controller_plugin.dir/all] Error 2
#13 124.3 make[1]: *** Waiting for unfinished jobs....
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp: In member function ‘void gazebo::CameraManagerPlugin::_handle_message(mavlink_message_t*, sockaddr*)’:
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:310:18: error: ‘MAV_CMD_IMAGE_START_CAPTURE’ was not declared in this scope
#13 124.3   310 |             case MAV_CMD_IMAGE_START_CAPTURE:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:313:18: error: ‘MAV_CMD_IMAGE_STOP_CAPTURE’ was not declared in this scope
#13 124.3   313 |             case MAV_CMD_IMAGE_STOP_CAPTURE:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:316:18: error: ‘MAV_CMD_REQUEST_CAMERA_INFORMATION’ was not declared in this scope; did you mean ‘MAVLINK_MSG_ID_CAMERA_INFORMATION’?
#13 124.3   316 |             case MAV_CMD_REQUEST_CAMERA_INFORMATION:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3       |                  MAVLINK_MSG_ID_CAMERA_INFORMATION
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:319:18: error: ‘MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS’ was not declared in this scope; did you mean ‘MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS’?
#13 124.3   319 |             case MAV_CMD_REQUEST_CAMERA_CAPTURE_STATUS:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3       |                  MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:322:18: error: ‘MAV_CMD_REQUEST_STORAGE_INFORMATION’ was not declared in this scope; did you mean ‘MAVLINK_MSG_ID_STORAGE_INFORMATION’?
#13 124.3   322 |             case MAV_CMD_REQUEST_STORAGE_INFORMATION:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#13 124.3       |                  MAVLINK_MSG_ID_STORAGE_INFORMATION
#13 124.3 /ros_ws/src/mavlink_sitl_gazebo/src/gazebo_camera_manager_plugin.cpp:325:18: error: ‘MAV_CMD_REQUEST_CAMERA_SETTINGS’ was not declared in this scope
#13 124.3   325 |             case MAV_CMD_REQUEST_CAMERA_SETTINGS:
#13 124.3       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim Jul 20, 2022

Choose a reason for hiding this comment

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

@AustinDeric Since the common setup is that this repo is used as a submodule of the PX4-Autopilot project, it uses the header generated there. Otherwise if you want to use this repository as a standalone catkin project, you can use the catkin mavlink package: https://github.com/mavlink/mavlink-gbp-release

@Jaeyoung-Lim
Copy link
Member

@AustinDeric Raised problem in mavlink/mavros#1767

@Jaeyoung-Lim
Copy link
Member

Fixed in Fixed in #896

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

Successfully merging this pull request may close these issues.

2 participants