How to get uORB topic publisher matched? (micrortps_agent)

Hi! I am trying to read vehicle_odometry from the PX4 (SITL) over the ROS2 bridge. I have made all the edits I know of but the VehicleOdometry publisher is never “matched” when the microRTPS agent is started. What is going wrong?

I am using the updated PX4-Autopilot/px4_ros_com/px4_msgs repositories from microRTPS: more fixes and improvements #18052.

Here was my setup:

  • write a vehicle_odometry_listener.cpp modeled after sensor_combined_listener.cpp in the px4_ros_com examples directory
  • add vehicle_odometry_listener to “custom executables” in CMakeLists.txt
  • check urtps_bridge_topics.yaml on the PX4-Autopilot side, confirm - msg: vehicle_odometry is set to send: true.
  • run the script to duplicate topic information on the px4_ros_com side
  • clean the px4_ros_com workspace via clean_all.bash
  • build the px4_ros_com workspace via build_ros2_workspace.bash
  • clean and make the PX4: make px4_sitl_rtps jmavsim (micrortps_client is automatically started)
  • start the microRTPS agent: micrortps_agent -t UDP

The agent starts up and I can confirm that both Sensor Combined and Vehicle Odometry are listed as Publishers. Then, I run: ros2 run px4_ros_com vehicle_odometry_listener and nothing happens. The VehicleOdometer Publisher is never “matched”. How can I make this happen?

In contrast - I can do this with SensorCombined: ros2 run px4_ros_com sensor_combined_listener and 1) the SensorCombined publisher is matched (see below), and 2) the data is printed to the console. Here is the output when I start the microRTPS agent:

----   Publishers  ----
- Timesync publishers started
- TrajectoryWaypoint publisher started
- VehicleControlMode publisher started
- VehicleOdometry publisher started
- VehicleStatus publisher started
- CollisionConstraints publisher started
- TimesyncStatus publisher started
- SensorCombined publisher started
- VehicleTrajectoryWaypointDesired publisher started
[   micrortps_agent   ]	SensorCombined publisher matched
[   micrortps_agent   ]	SensorCombined publisher unmatched

Thanks for your help.

Before creating the listener, did you try to echo the topic already: ros2 topic echo /fmu/vehicle_odometry/out? It might be the case that you are using the previous topic naming (i.e. VehicleOdometry_PubSubTopics). I have updated thar yeaterday on the examples as well since that’s now the topic name format.

Thank you very much for your reply! I echoed the topic as you suggest and it does properly output the vehicle_odometry message on the agent side. Additionally, the micrortps_agent indicates that the publisher is matched.

However the vehicle odometry publisher remains unmatched when I run ros2 run px4_ros_com vehicle_odometry_listener and no message is printed. I am not sure what accounts for this difference, or how to get the listener working.