PID tuning for a single copter

Hi, I am flying my single copter indoor. Manually it is flying good but while in auto mission it drifts while holding position. So there is doubt regarding sensor quality but i am focusing on PID tuning as i did hit and trial for its tuning and not sure about the perfect values. Although its flying but must know the perfect values.
I am using pixhawk mini (have ordered pixhawk4 bytheway as it has deprecated by the community), firmware-px4fmu_v2_default.
I have made my custom mixer file and airframe file. (can share the files if needed.) In which 4 duct fans at bottom which are controlled by servos and one main thrust motor. Basically a thrust vectoring sytem.

So any idea how to get perfect PID values?

Thanks.

1 Like

@sharmarahul999

The PID values are related to the attitude controller, which I presume is tuned as you say it flies decent in manual control.

If you want to fly mission mode, you need to have a decent position estimate of the system. Are you using GPS to estimate the position?

Hi @sharmarahul999 ,

as @Jaeyoung-Lim said, it you can fly properly in manual, it means that your attitude PID gains are correct. If it’s not flying well in position mode, it can be an estimation problem (due to wrong measurements, axes mismatch, vibrations, …) or a control problem (velocity PID loop). I could tell you a bit more by looking at a log file :slight_smile:

Hi Jaeyoung,
No i am flying indoor without gps. Only based on sonar and px4flow module.
And Also i wanted to know if there are some good way to tune PID for a single copter?
Thanks.

Hi bresch,
here are some logs files.
https://logs.px4.io/plot_app?log=20b78222-b836-439f-81df-6bef9ca1ecdd
https://logs.px4.io/plot_app?log=39f2f1d4-e7d6-4fff-a502-031534a43492
https://logs.px4.io/plot_app?log=6be0164b-cc54-46c8-98f3-47252380f653.

Point is sometime it goes well but sometime it doesn’t even in manual mode. That’s why i wanted to confirm my PID values are correct for this system or not.

Hi,
Watch out my single copter videos.


Although flying stably but still struggling with the auto mission.;-(

Hi @sharmarahul999 ,

Exciting project!

The problem is that if you want to find “optimal” parameters defined by some criterias that you have to choose yourself (such as rise time, settling time and overshoot) using some techniques such as pole placement, etc. , you need an accurate mathematical model of your vehicle… This is called “System Identification” and it is quite challenging and time consuming to get a model good enough to design a controller.
Most of the time, PID controllers are just “hand tuned” because it is much simpler and quicker (and can give better results than a controller tuned on a poor model).

The best way to start is always to tune bottom-up. For most multicopters, this is the rate loop. But for this type of design, it is crucial to build a good control allocator (mixer) in order to linearize as much as possible the system.
In point of fact, based on aerodynamic control surfaces, the lift generated that gives side control is highly nonlinear and a PID controller is good at stabilising linear (or almost linear) systems. The airflow, mainly generated by the main rotor has to be included in the control surfaces mixing too. During motion, the airflow will be increased but you can try to ignore that for now and limit the maximum speed/angle to keep that contribution small.

In summary, your control allocator has to:

  • Include a lift model of the control surfaces (a simple model can be linear and the saturation has to occur before the stall region)
  • Take the motor RPM into account (or at least the normalised pwm signal)

An option could be to attach the drone on a multi-axes thrust bench and create lookup tables.

Good luck!

Hi @sharmarahul999 ,
Nice work! Would you be willing to share your custom mixer and airframe files?
Thanks!

Hi @rctestflight,
Did you get the the custom mixer and airframe files or any other knowledge regarding this? If yes, can you share it?
Thanks!