Yaw angle rotation causes horizontal drift (OFFBOARD mode)

Hi,

I am flying a drone in OFFBoard mode. I send command to /mavros/setpoint_position/local topic through MAVROS. When I command a yaw rotation there is significant X,Y axis drift. Here is an example log file:

https://review.px4.io/plot_app?log=27f734f5-18aa-4d7d-8951-363b6ded8796
https://review.px4.io/plot_app?log=65c26438-2f7b-412b-96fd-046d5ce6ca0a

Please look at around 3:21, which is the moment when the yaw command is given to rotate 180 degrees. You will see that exactly at that moment PX4 also generates what seem to be pitch and roll angle commands to compensate for the X,Y drift motion, but the controller simply ignores it and does not track those commands. Also, some moments afterwards, the X,Y position value drifts away from the setpoint, which is the issue I am facing.

There is another post related to this here, however there was no further explanation on the solution (which involved a mixer file). I have read the mixing and actuators doc, but have not been able to understand it so far. The only specific question I have is to where should I save this file? There is metion about the directory " ROMFS/px4fmu_common/mixers" but where is it?

If anybody could provide insight on what issues are apparent from the logs or on a solution using a mixer file, I will appreciate it.

Quadrotor details
X - configuration (DJI F330 frame)
Using external compass, optical flow and also a feeding a VO estimated pose from ZEDm camera to the /mavros/vision_pose/pose topic.
EKF2 Estimator
Due to this issue, we limited the yaw rate to 60degree/sec max through the MC_YAWRATE_MAX parameter.

Thanks!

@Fernando_Medrano It looks like you are commanding a large yaw error (looks like almost 180 degrees) and this results in high yaw rate inputs.

It might be saturating your motors and making you lose control authority. You might want to retune your vehicle so that it does not track yaw as aggressively, or give yaw setpoints incrementally.

@Jaeyoung-Lim Thanks for your reply and suggestions. Yes, we are commanding a 180 degree turn around, that is intended and we need to do it.

Actually we have already tried your second suggestion, rotation by increasing steps. We found that moving in steps of 60 degrees and waiting ~2s in between allows the drone to more or less recover its position without drifting too much. However, it still seems strange that yaw angle rotation causes such significant drift.

Regarding the motor saturation, aren’t the “actuator outputs” graphs in the ulog review related to the motor PWM outputs? If my understanding is not wrong, during the yaw rotation, if the motors were saturated then those signals should be clipped at the maximum value. I do not see such saturation in the attached log files during the yaw rotation. But I guess I might be wrong and not catching something.

@Fernando_Medrano Yaw command can be seen in the yaw rate commands. You can see that the yaw rate commands go up to maximum as a step input

By increment I meant incrementing continuously. Step inputs on yaw can significantly reduce your flight performance as quadrotors do not have much control authority over yaw (comapred to other axis)

You can see this demonstrated here in this video

@Jaeyoung-Lim I see, we will try by incrementing continously yaw command. Thanks for the clarification!

@Jaeyoung-Lim If I send continuous yaw waypoints, should I keep doing it in /mavros/setpoint_position/local topic or should it be in /mavros/setpoint_raw/local topic? Thanks.

I don’t think it matters since both go through SET_POSITION_TARGET_LOCAL_NED mavlink message

Hello

In my case, our UAV is not square shape.
Roll axis is longer than pitch axis, so I modified mixer file.
The location of mixer file is in ’ Firmware/ROMFS/px4fmu_common/mixers/quad_x.main.mix.
The file depends on what your airframe is, I think your airframe is also quad_x_main.

The process of new mixer file

  1. modify mixer file
  2. clean make firmware
  3. build
  4. upload new firmware
  5. change airframe on qgroundcontol to apply new mixer
    (in my case : select another airframe->reboot->change my airframe again->reboot)