Drone position diverges from VICON

Hello everyone,

I’m working on the configuration of a drone in indoor environment and I’m using a VICON system as external position estimate. I’ve already linked the drone with the MoCap and published the position information coming from the VICON inside vehicle_visual_odometry topic for EKF2 to get the info as stated in this guide Here.

The problem is that in the first flight, I set the drone to takeoff and reach an altitude of 0.3 meters but instead of doing that, the drone kept going up until it almost reach the ceiling and I had to take manual control to make the drone land. Here is the log. You can see that the local position x,y,z are not correct, especially in the z coordinates.

I need some guidance in what to do.


u may need to check if the mavros local pose msg match the VICON’s ouput, to see if it get fused properly, from the flight log, what I see is the orientation (roll, pitch and yaw) not tracking cmd at all, how is the manual flight goes ? I guess u are sending cmd to topic 'setpoint_position/local ', is it right ?

Hi @Ronald_Cristian_Dutu

What are you using to send visual_odometry and offboard commands to the drone? MAVROS/MAVLINK or native ROS 2 with micro XRCE-DDS?

@Leo1 @Benja I’m using ROS2 for the Offboard control and PX4 main version for the Flight Controller. Following the VICON C++ SDK I wrote a custom C++ code that gathers the position info from the VICON system and then transforms it to PX4 frame convention and publishes it to the vehicle_visual_odometry.

Meanwhile, I noticed from the logs that, if I expand the “Show Additional Data”, some of the ekf2 messages are lost. So, i think that’s the problem but I don’t know how to solve it.

Screenshot from 2023-06-09 09-22-40