Creating a new ROS node for px4 msg listener

asked 2020-06-16 12:13:28 -0500

Mocca Ricco gravatar image

updated 2022-01-22 16:10:36 -0500

Evgeny gravatar image

Hi everyone

I'm new to ROS and kind of struggling to figure a couple of things out. I followed the tutorial from the PX4 dev guide: https://dev.px4.io/master/en/middlewa... . It describes how to display the output of a listener node called sensor_combined_listener. The node is defined in sensor_combined_listener.cpp and contains declarations as well as a function for standard output and a main() function initializing the node.

If I change the function to display a different output, it will work. But, when I define a different node in a different file e.g. Airspeed.cpp and try to build the px4_ros_com library, it gives me errors. I also tried to duplicate parts related to the sensor_combined_listener node in the cmakelists.txt file and created a new Airspeed.launch file in analogy with the combined_sensor_listener.launch, but I got the error that you can not declare a second main function. I also tried implementing nodelets, but that seemed even more complicated.

Thus, my question is: How can I run the sensor_combined_listener node in one terminal displaying gyro and accelerometer output from the sensor_combined.msg and the Airspeed node in another terminal displaying velocity output from Airspeed.msg? Do I need to implement node or nodelet? What changes have to be made to the cmakelists.txt file and which ones to the .launch file? Are there any steps I am missing?

I'm already thankful if someone has found the time to help me out. Thank you in advance!

I'm running Ubuntu 18.04 on an x86 (kernel 5.3.0) with gcc 7.5.0. My ROS(1) version is melodic, while the ROS2 version is dashing.

edit retag flag offensive close merge delete

Comments

Could you please add a few newlines to your post? Right now it's a single block of characters and rather difficult to read.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-16 13:15:57 -0500 )edit

Noted! Thanks for pointing it out.

Mocca Ricco gravatar image Mocca Ricco  ( 2020-06-16 13:55:22 -0500 )edit

Hello, Did you manage to find any resources/guidance on how to proceed? I am stuck in a similar place in my development and would appreciate your thoughts.

johannejvv gravatar image johannejvv  ( 2021-07-26 04:49:40 -0500 )edit

It worked eventually with ROS2 I believe. It's been a while, but I remember that I performed a clean Ubuntu install and solved every error that is returned before continuing to another instruction.

Also, be sure that you have the correct versions of dependencies installed for your version of ROS. Especially pay attention to your Eprossima version, since the RTPS bridge relies on that software package and it changes sometimes.

My findings were that most of the errors were related to dependencies that were not installed correctly on your system. Only once I altered a file manually to resolve a specific error.

For any further help, you can always refer to the PX4 slack channel.

Hope this helped!

Mocca Ricco gravatar image Mocca Ricco  ( 2021-07-27 05:51:08 -0500 )edit