Build failed when activating a new uORB message

I am running PX4 and ROS2 foxy on Ubuntu 20.04. I tested the communication between the micrortps client and agent on simulation and it works with SensorCombined topic.

Now I am trying to activate the rc_channels topic because I would like to get data from the remote control on ROS2 side.

In /px4-firmware/msg/tools/uorb_rtps_message_ids.yaml file, I added the following line to the rc_channels message:

  • msg: rc_channels
    id: 58
    send: true

Now, when ever I try to make px4_sitl_rtps gazebo, I get the following error:

src/modules/micrortps_bridge/micrortps_client/microRTPS_client.cpp:51:10: fatal error: uORB_microcdr/topics/rc_channels.h: No such file or directory
   51 | #include <uORB_microcdr/topics/rc_channels.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

So, the rc_channels.h is not generated in px4_firmware/build/px4_sitl_rtps/uORB_microcdr/topics

Do I have to modify any other file in order to activate the new uORB topic? Also do I have to add anything on ROS2 side in order to be able to see the topic?

UPDATE:
I deleted the build folder and rebuilt and the build was successful. However, I can’t find the rc_channels topic whenever I run uorb top in the shell.

Can you elaborate more on what you are trying? Did you also updated https://github.com/PX4/px4_ros_com/blob/master/templates/uorb_rtps_message_ids.yaml?

Thanks for your reply, I did update this file, but it wasn’t matching /px4-firmware/msg/tools/uorb_rtps_message_ids.yaml for this specific message. I had it as sent: true on one side and as receive: true on the other side.

Hi, thanks for the progress above! I am seeing a similar error when trying to make a wind.msg publisher.
I have made the following edits:
to /PX4-Autopilot/msg/tools/uorb_rtps_message_ids.yaml

  - msg: wind
    id: 106
    send: true

to /px4_ros_com_ros2/src/px4_ros_com/templates/uorb_rtps_message_ids.yaml

  - id: 106
    msg: Wind
    send: true

When trying to build the Autopilot: make px4_sitl_rtps I am getting the error:

src/modules/micrortps_bridge/micrortps_client/microRTPS_client.cpp:55:10: fatal error: uORB_microcdr/topics/wind.h: No such file or directory
   55 | #include <uORB_microcdr/topics/wind.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

@moustafa , which build folder did you delete and rebuild? I have not been able to get this to work.

Can you try make clean and then make px4_sitl_rtps again?

Hi @TSC21, thank you! I just tried this but received the same error:

FAILED: src/modules/micrortps_bridge/micrortps_client/CMakeFiles/modules__micrortps_bridge__micrortps_client.dir/microRTPS_client.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DCONFIG_ARCH_BOARD_PX4_SITL -DENABLE_LOCKSTEP_SCHEDULER -DMODULE_NAME=\"micrortps_client\" -DPX4_MAIN=micrortps_client_app_main -D__CUSTOM_FILE_IO__ -D__PX4_LINUX -D__PX4_POSIX -D__STDC_FORMAT_MACROS -Dnoreturn_function="__attribute__((noreturn))" -I../../boards/px4/sitl/src -I../../platforms/posix/src/px4/common/include -I. -Isrc/lib -I../../platforms/posix/src/px4/generic/generic/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/posix/include -Iexternal/Install/include -I../../src/modules/micrortps_bridge/micrortps_client -Isrc/modules/micrortps_bridge/micrortps_client -I../../src/modules/micrortps_bridge/micro-CDR/include -Isrc/modules/micrortps_bridge/micro-CDR/include -Isrc/modules/micrortps_bridge/micro-CDR/include/microcdr -O2 -g -DNDEBUG -fPIC   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-rtti -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -std=gnu++14 -MD -MT src/modules/micrortps_bridge/micrortps_client/CMakeFiles/modules__micrortps_bridge__micrortps_client.dir/microRTPS_client.cpp.o -MF src/modules/micrortps_bridge/micrortps_client/CMakeFiles/modules__micrortps_bridge__micrortps_client.dir/microRTPS_client.cpp.o.d -o src/modules/micrortps_bridge/micrortps_client/CMakeFiles/modules__micrortps_bridge__micrortps_client.dir/microRTPS_client.cpp.o -c src/modules/micrortps_bridge/micrortps_client/microRTPS_client.cpp
src/modules/micrortps_bridge/micrortps_client/microRTPS_client.cpp:89:10: fatal error: uORB_microcdr/topics/wind.h: No such file or directory
   89 | #include <uORB_microcdr/topics/wind.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
make: *** [Makefile:221: px4_sitl_rtps] Error 1

I guess that is microRTPS code generation problem.
msg/tools/generate_microRTPS_bridge.py
check error log again.