I’m using the PX4 firmware on a hexacopter and currently, I’m doing the position controller tunning.
Last week I’ve made a flight and then I plotted the flight log and I noticed that when in POSCTL mode, sometimes the position setpoint remains horizontal and the position doesn’t follow that line, as you can see in the position plots:
Are you sure it doesn’t correspond with your stick input? When the roll/pitch stick input is non zero the position is interpreted as a velocity command (xy). When centered it latches onto the current position.
In my opinion, if the control is good (which it seems, when the strange behaviour doesn’t happen), the two lines should be colinear. i just doesn’t understand why the setpoint line remains horizontal. This also happened in indoor altctl flight:
Anytime your sticks aren’t neutral it’s velocity control mode. The position setpoint is constantly reset to match the current position. When your stick is neutral it latches onto that position and then actually tries to hold it.
So It seems that I still have some calibration to do in order to reduce the position error when the position setpoint is stable (when there is no actuation on the sticks), right?
Yes that’s right. There are tuning parameters for velocity (MPC_XY_VEL_*), and position (MPC_XY_P and MPC_XY_FF). You can tweak these params in flight if you’re comfortable.