Not accurate following of manual control in different modes

I am having troubles with my drone. I tested manual, position and hold mode. Unfortunately it doesn’t follow accurately the setpoints when in position mode, it basically drifts away. I am using motion capture and I am indoors. What should I do? What is wrong with my set-up, calibration or parameters. I have problems flying in offboard mode as well :frowning:

Best would be to upload a log file to https://logs.px4.io, then link it here, and maybe describe what happened, or post a video to explain it.

Helo, Julian
Basically since my drone crashed a lot in offboard mode I decided to test other modes and it doesn’t look good.
These are the logs, in manual mode it doesn’t follow strictly the given commands, I am using a joystick at 100hz rate. In position mode after the manual mode it just drifts away and crashes in my walls.
It is probably due to set up, calibration or parameters but I am clueless how to change it.

https://logs.px4.io/plot_app?log=cd0fb154-cd8c-4eb5-b885-438d103d3ae8
https://logs.px4.io/plot_app?log=f9dcc359-264e-475e-a497-1d6ae2369189
https://logs.px4.io/plot_app?log=225c84d0-6aa3-4249-bd97-e506172e5cda
https://logs.px4.io/plot_app?log=9e9be9f5-d37c-4443-800a-3195184f0f0a

And some more from today
https://logs.px4.io/plot_app?log=f774cda9-10a8-4a9f-aa4f-8fbaf196f094
https://logs.px4.io/plot_app?log=5d2817df-9a29-4c1b-88c5-6e08cd2fae8c
https://logs.px4.io/plot_app?log=fd5b513f-dcef-42c0-9b17-dd9bccd1bdbd

Same thing. Pitch, yaw, roll not really good.

Ok, so I looked at the very first log and I can see that you first fly in stabilized mode which seems to work ok. Then you switch to position control.

Now, the attitude still seems to be following the attitude setpoint fine, however the velocity and position diverges rapidly. This let’s me believe that something about the coordinate system must be wrong. Have you checked that the heading is correct with North defined in your position system and that all the signs are correct? It is likely that the mag is off indoor where you have a lot of magnetic interference.

Edit: Also, it seems that your magnetometer is also disturbed by the motors and or power cables. You can see the correlation between thrust (= more current) and the magnetic field here: https://logs.px4.io/plot_app?log=cd0fb154-cd8c-4eb5-b885-438d103d3ae8#Nav-Thrust-and-Magnetic-Field

I suggest that you use an external magnetometer like the ones on the GPS and move it far away from wires and motors. And also make sure to twist all cables that have DC current on them such as battery to power module and power module to ESCs, this also reduces the electromagnetic field.

Another idea would be to use the optitrack for the yaw angle instead of the magnetometer but I don’t know how or if that can be done.

THANK YOU SO MUCH , @JulianOes!
I will dig into that. Thanks again for your responses and really helpful answers.

1 Like