Offboard vicon tracking suddently flight toward one direction

Hello friends,
– I am using px4 on pixhawk flight in in-door env, with vicon, one wired thing is sometimes when I control it flight several times to tacking the trajectory, it suddenly fly to one direction, here is one flight log, can someone has some insights what cause this issue ?
Thanks in advance.

There are 3 things I’d check out for:

  1. From your logs, the issued position setpoints seem to stop at about 5:17. Offboard mode required a constant stream of setpoint to work from what I understand, so check whether your program stops streaming setpoints after a while.

  2. Your attitude estimates seem a bit noisy, which may lead to estimate drift or unstable oscillation. You may want to recalibrate your accelerometer and gyroscope sensors or modify the EKF2_ACC_NOISE and EKF2_GYR_NOISE parameters to solve this.

  3. From my experience, if your vicon cameras stop tracking your UAV for a while, the position estimates drift and cause the issue you describe. Your Estimator Watchdog issues a warning (step of value 1) before you switch to altitude mode, so I’d suggest keeping an eye on how well your camera system tracks your UAV throughout the trajectory. This tracking issues usually happen when you are out of bounds of the area tracked by your cameras, either making the trajectory smaller to fit the bounds or recalibrating the cameras may help in this regard.

really appreciate your response, for point 1) the set point is stopped because I am streaming the ‘setpoint_raw/attitude’ to the board for trajectory tracking in the middle, coz the setpoint cannot do a tracking work; the point 2) it is a very good point, I did have some position/orientation fusion drifting yesterday, nearly crash, for this point I have two small questions a) do I need re-do calibration each time if something weird or crash happen, b) how to determine the noise is big or not ? which values I need to pay attention ? for example in the logfile.

Thanks for your help.

If you intend to use vicon measurements for attitude control, be careful since regular PX4 firmware only uses the yaw external measurement to update the attitude estimates, roll and pitch are estimated from gyroscope and accelerometer measurements.

After a crash, I’d recommend you recalibrate the gyroscope, since it may be affected by impacts. I don’t think you need to recalibrate the accelerometer.

You should check the estimated attitude and setpoint attitude graphs to see whether or not your tracking is satisfactory. If you want to try a preliminary test before you engage in offboard mode, I’d suggest you fly in attitude mode to see whether you can fly without destabilizing the UAV since this mode uses all the attitude estimates and controllers.

big thanks for the informations !! yes, I did notice that the pitch and roll once has suddenly drift cause a crash, the vicon pitch and roll are not fused, so my last question could be if I want to do offboard + vicon trajectory tracking, which command or mode is recommended ? seems i selected a difficult mode.
– Edits:
I just checked the mavros, so I suppose to use setpoint_raw/local instead of the setpoint_raw/attitude ? right.
Thanks again,

Offboard is the mode you want to use if you want to send attitude reference commands. Maybe setpoint_attitude/attitude may also work in your case, try both in simulation just in case (Gazebo and jmavsim should both work). Finally, if you really want to use the attitude measurements from the Vicon cameras, you are going to have to modify the EKF2 library. I think some other people have tried doing something similar so you should look into it.

1 Like

thank u sir, appreciate the help !