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 aftersensor_combined_listener.cpp
in the px4_ros_com examples directory - add
vehicle_odometry_listener
to “custom executables” inCMakeLists.txt
- check
urtps_bridge_topics.yaml
on the PX4-Autopilot side, confirm- msg: vehicle_odometry
is set tosend: true
. - run the
uorb_to_ros_urtps_topics.py
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.