Subscriber node callback not triggering from simulator messages but manually sending with ros2 topic pub works?

I am currently running the latest PX4-Autopilot simulator using make px4_sitl gazebo-classic on a machine with ROS2 Foxy and Ubuntu 20.04. I am also running the MicroXRCEAgent using: MicroXRCEAgent udp4 -p 8888. I don’t know if that matters or not.

I can run ros2 topic echo /fmu/out/sensor_combined and see these messages being published in the terminal window. But I have a subscriber node that is listening for them, and not being triggered (despite it triggering if I manually publish to that topic via the command line). These terminals are all on the same machine on the same network if that matters.

I tried looking into MAV BROADCAST settings, but that did not seem to yield any results. What am I missing? Is there a networking thing that would prevent my node from subscribing to a topic?

Did you check the QoS?

Thanks for the response! I just got it figured out last night and it was a problem with the QoS as you mentioned. I had only set history and depth, but not reliability and durability. It did not work until I set all of them.

For those who are curious, here’s the Python code for the QoS profile I used:

      qos_profile = QoSProfile(

1 Like