How does ArduCopter handle model uncertainties?

I am a controls engineer, studying aerospace controls systems and I have been in a lot of confusion lately. Coming from a purely academic background I have little experience in implementing controllers on real systems, and in my recent attempt at doing so, I have run into a bunch of problems. I have a few questions regarding the same:

  1. One of the first problems I faced was estimating model parameters, and that got me thinking, how does ArduCopter estimate the model parameters like Inertia, thrust coefficients, drag coefficients etc…? Every user will have a different battery weight, different from esize, different motor type etc… so how does the attitude controller in ardupilot account for that?

  2. The generic attitude controller will output a desired torque vector, because after all the controller acts on the dynamical system! So how does ArduCopter map these torques (equivalently thrusts…) to pwm values to be sent to the motors? Currently I am getting a curve fitting done via matlab to experimentally acquired data to get a relation between thrust and pwm. I feel this is overkill and I was wondering how Arducopter takes care of this.

  3. I noticed that AP_Motors and AC_AttitudeControl both do a lot of manipulations to the throttle values. Could some please take out some time to explain this briefly to me? Or to mention my larger question, I needed some tips to keep in mind when implementing flight controllers, and would appreciate anything anyone can send my way. It could be anything simple from arm checks and failsafes to more intricate things like throttle modification etc.

Implementation is an art in itself and Ardupilot is the perfect example of that, it would be great if I could learn some of this art from the community!

PS: It is obvious that ardupilot does not use a model reference type controller, but does it have some iterative method to improve the tuning for the particular copter it is controlling? Even so, you need a “starting” point of controller parameters, and how does ardupilto decide these?

I know that the majority of the community has “absolutely no time” to deal with anything non ArduPilot related, but perhaps you could spare a few moments during your coffee breaks for my question? :slight_smile:

I can only answer a couple of your questions well enough to satisfy:

Currently I am getting a curve fitting done via matlab to experimentally acquired data to get a relation between thrust and pwm. I feel this is overkill and I was wondering how Arducopter takes care of this.

This is actually an important step, as the thrust vs. PWM curve is strongly nonlinear in most cases. Arducopter makes an assumption of this curve using a parameter MOT_THST_EXPO, which defaults to 0.65. This expo curve is a reasonable approximation of the thrust curve for most powertrains within the throttle range that is experienced in flight. This assumption works for most hobby-grade configurations, but some users benefit from making the measurements themselves and adjusting this parameter. For example, T-Motor ESC’s are known to linearize thrust vs PWM input, so this parameter would be closer to 0 in that case.

but does it have some iterative method to improve the tuning for the particular copter it is controlling?

Not in normal flight. The Autotune flight mode does adjust PIDs in flight based on real responses to particular inputs, but there are no provisions for adjusting tuning during normal flight. There are some things that are done to try and keep a particular tune effective in different flight conditions, though, such as scaling control effort with battery voltage drop (MOT_BAT_VOLT_MIN/MAX) and the previously mentioned thrust expo.

1 Like