Vehicle_local_position not working, other topics are though

Hello,

I am working in ROS2 Humble on Ubuntu 22.04.3 LTS. I’m using QGroundControl Daily Version, and I’m launching jmavsim from the PX4-Autopilot (commit 54d26e084a).

I have a set of ros2 scripts that I’m using to control the drone in the simulation, but the vehicle_local_position topic seems to be acting strange.

I launch QGroundControl, then I launch jmavsim. QGC recognizes and “connects” to the jmavsim drone fine.

I run MicroXRCEAgent udp4 -p 8888.

When I go into my ros2 workspace, i run source install/setup.bash, and then I can see the px4 ros2 topics if I run ros2 topic list.

As far as I can tell I’m getting good data from all the topics except for the vehicle_local_position one. If I type ros2 topic echo /fmu/out/vehicle_global_position, the output looks normal/fine. However, if I type ros2 topic echo /fmu/out/vehicle_local_position, this is the output (repeated):

2023-11-06 09:14:49.700 [RTPS_READER_HISTORY Error] Change payload size of '196' bytes is larger than the history payload size of '191' bytes and cannot be resized. -> Function can_change_be_added_nts

Any ideas what the issue could be? Ultimately, the local position subscriber on my node isn’t getting the local position, probably because of this error.

Hi @Rakmo97 , are you using the defaul ROS2 Humble DDS (eProsima’s Fast DDS)?

On a deeper check, I managed to get the same error by usign two different versions of PX4 messages.
Please make sure that your px4_msgs repo is synchronized with PX4-Autopilot:

Please adapt this for your specific paths

rm ~/px4_ros_com/src/px4_msgs/msg/*.msg
cp ~/PX4-Autopilot/mgs/*.msg ~/px4_ros_com/src/px4_msgs/msg/

You must ensure that your ROS2 messages definitions match the one in PX4.