I am trying to use mavlink_ros to communicate with APM 2.6 . I can successfully install mavlink_ros using rosmake following the instructions on github and run the mavlink_ros_serial. I am trying publish messages to "/mavlink/to" topic in my cpp program. But I am unable to use the mavlink_ros::Mavlink message. I added all dependencies in the package.xml and CmakeLists.txt of my package, but when I try to build it gives an error saying that it is unable to find file "mavlink_ros/Mavlink.h".
This is because Mavlink.h is in mavlink_ros/msg_gen/cpp/include/mavlink_ros. The package seems to be a rosbuild package. I am not sure if that is why I am unable to use it in my cpp program catkin package.
Could any one please let me know, if you know how to use mavlink_ros package in your custom catkin package.
I also start to use mavlink_ros package. However, I don't know how to use mavlink_ros::Mavlink message. For example, if I want to arm the rotor, which values should give for the every variables in this message? Can you give me some help?
Hi, you could try this package:https://github.com/posilva/ardupilotmega-ros
I have just started to look into doing the same thing. I will have a look when I get home and see if I can accomplish this task. Have you added the mavlink_ros include directory?
I haven't looked into it yet but is there a function provided to pack the ros topic message that gets sent to mavlink_ros_serial?
You should be able add -I/home/<username>/path_to/mavlink_ros/msg_gen/cpp/include to your compiler options to include mavlink_ros/Mavlink.h. I don't know if this is the best way but it worked for me. I had to add include the folder for mavlink.h as well.
What I'm trying to get my head around now is compiling to include subscribing / publishing to ros topics. Haven't quite figured it out yet, but I think I need to use the rosmake command. Trying to reverse engineer mavlink_ros CMakeList.txt. Time for more research.
Thanks for the reply. I tried to include the header file, but I was unable to subcribe to /mavlink/to as it needes a message of type "mavlink_ros::Mavlink". It resulted in some more errors.
The main thing I am unable to understand is the package structure of mavlink_ros. I tried to add it in my ros package's CMakeLists.txt as both rosbuild as well as catkin package, none of it works.
The last attempt I did is to create Mavlink.msg in my package as a custom message, But because the it was of type <My_package_name>::Mavlink.msg, I couldnt publish or subscribe to the topics.