Make PX4 consider VISUAL_POSITION_ESTIMATE messages on EKF2 from an Offboard source in a SITL setup


I’m trying to make PX4 to consider VISUAL_POSITION_ESTIMATE messages from a separate UDP (offboard) data source in a SITL setup. So far, I didn’t succeed. Any pointers welcome.

For an environment, I have a PX4 SITL setup connected to AirSim, as described here: Simulation · PX4 Developer Guide . I have an AirSim instance running, QGroundControl, and I’m using PX4 SITL with settings from posix-configs/SITL/init/ekf2/iris , with the following additions:

param set EKF2_AID_MASK 24
param set CBRK_GPSFAIL 240024

I have a minimal application based on examples/linux/mavlink_udp.c from the mavlink repo, that sends UDP packets to port 14557 and listens on 14540, which correspond to the following line in the PX4 startup sequence:

mavlink start -u 14557 -r 4000000 -m onboard -o 14540

this app sends a heartbeat and then a VISUAL_POSITION_ESTIMATE message, with slightly varying altitude, heading, pitch and roll (same position). it dumps the messages received as per the original mavlink_upd.c sample app.

in the PX4 console, I see the following, most probably as a result of the EKF2_AID_MASK setting:

INFO [lib__ecl] EKF switching to external vision position fusion
INFO [lib__ecl] EKF switching to external vision yaw fusion

my expectation at this point is that the drone shown also in the AirSim app should have position & attitude updated as per the VISUAL_POSITION_ESTIMATE messages sent by my app. but they are not.

also, I can’t ‘take off’ with the drone via QGroundControl, I get the following messages in the PX4 console:

WARN [commander] Takeoff denied, disarm and re-try
INFO [tone_alarm] negative

I wonder what am I doing wrong?

Also, I can see no indication that PX4 receives the messages sent to it by my app. is there some way to get an indication of messages received by PX4?