How to prevent sitl_gazebo from sending VISION_POSITION_ESTIMATE messages?

I was attempting to simulate our lab environment in gazebo. We have some visual markers, a frame-attached (no gimbal) camera and a companion computer, that processes data from that camera and feeds the vision position to PX4 via mavros so that GPS-denied flight can be achieved. Everything is pretty straightforward.

When trying to simulate this in gazebo (SITL), I’ve noticed, that there is some other source of VISION_POSITION_ESTIMATE messages. Adding some logging in simulator_mavlink.cpp (PX4-Autopilot/simulator_mavlink.cpp at 2549b702f0fe71ce271e64d388eb7805abbd96d9 · PX4/PX4-Autopilot · GitHub) I’ve learned, that they are coming from the simulator, that is, from gazebo side. Checking the code in sitl_gazebo repo (PX4-SITL_gazebo/gazebo_mavlink_interface.cpp at b59e6e78e42d50f70224d1d0e506825590754d64 · PX4/PX4-SITL_gazebo · GitHub) I’ve noticed, that these messages are sent from it. Is there a way to stop this behaviour? I mean, I want our “onboard” code to be the source of vision position information, but as it is now, the firmware is receiving them from two sources at once (which, unsurprisingly, does not work very well). I’ve looked into the model files for iris and typhoon (we are actually using the typhoon model, but I’ve tried with iris too).

For now I’ve added a “return” in simulator_mavlink.cpp where VPE message is processed, so that the messages coming from gazebo are ignored, but, obviously, I am looking for a better solution.

Maybe I am doing something fundamentally wrong?

P.S. We are using version 1.7.3 of PX4 (GitHub - PX4/PX4-Autopilot at v1.7.3).

1 Like