Error building workspaces RTPS/ROS2

Hi there,

I’m trying to build ROS/ROS2 workspaces following the dev guide.

I am running the bash script as said in the guide. Thus, from ~/px4_ros_com_ros2 I do source /src/px4_ros_com/scripts/build_all.bash --ros1_ws_dir ~/px4_ros_com_ros1. Immediately after hitting enter the terminal where I am running this closes. The only way I can run the script is by executing it.

If executed, even though passing the argument of the ROS1 workspace path, the ROS1 workspace does not compile. I get the error [build] Error: Unable to find source space ~/src`. However, I can still compile the workspace by running the script inside the script folder.

A part from the error in the ROS1 workspace. The ROS2 workspace compiles the px4_msgspackage. However, when compiling px4_ros_com I get the following error: ~/px4_ros_com_ros2/src/px4_ros_com/src/micrortps_agent/Timesync_Publisher.h:48:10: fatal error: Timesync_PubSubTypes.h: No such file or directory #include "Timesync_PubSubTypes.h". Looking inside micrortps_agent it seems like Timesync_PubSubTypes.hdoes not exist but TimesyncPubSubTypes.h does. It seems hard to believe that this is a typo, which leads me to think I am doing something wrong (may be I’m missing something that has to be installed).

I would appreciate some guidance to debug this.

Thank you very much.

Pep

What ROS2 distro you have installed and what FastRTPS and FastRTPSGen versions? Btw, you are using an outdated version of the insttructions, if you are using PX4 upstream master you should be using the “master” version of the instructions.
I cannot reproduce the errors you get with the scripts though. Do you have ROS Melodic installed?

  • FastRTPS version: 1.8.2
  • FastRTPSGen: 1.0.2
  • ROS2 distro: dashing
  • ROS Melodic is installed
  • I didn’t realize of using the 1.9 instructions…you’re so right.

So you installed the above after you saw the latest version of the docs?

No, I had this already installed. I’ll go through the documentation again and let you know.

Update: the closing terminal was due to the terminal configuration.

Now it does not close and I can see the following error:

foo@foo:~/px4_ros_com_ros2$ source src/px4_ros_com/scripts/build_all.bash 
realpath: /home/pepms/px4_ros_com_ros2//bin/bash: No such file or directory
dirname: missing operand
Try 'dirname --help' for more information.

As said, if instead of sourcing the file .bash I execute it, the script does run. However, I still get the reported error at the beginning:

Thanks to @TSC21 that pointed me to the right direction I’ve been able to discover that I had an older version of the FastRTPS library installed at usr/lib.

Removed that and working.

Thanks!

PS 1: the scripts of the px4_ros_com should be executed instead of sourced, i.e. ./build_all.bash. That could be changed from the documentation.
PS 2: another problem I encountered is that I wasn’t able to compile the ROS1 workspace. I had to remove the file .catkin_tools, found here