Tuning Guide

From STorM32-BGC Wiki V1
Jump to navigation Jump to search

One of the most important steps is of course the proper tuning of the gimbal. However, it is also, unfortunately, the least straight-forward and most debatable step. No unique or universal tuning recipe seems to have yet appeared, and tuning remains an experimental process of trial-and-error. The following can hence only attempt to give some ideas. It is also necessarily very subjective, i.e. based on indivudal experiences for particular gimbals. If your experience has led you to different tuning rules please feel free to share them. Furthermore, a basic understanding by the operator is currently inescapable, and the following is accordingly explanatory in parts.

Tuning the PID controller of one axis

Preliminaries

The PID controller is the part of the firmware which controls the orientation (attitude) of the camera by taking the measured attitude and driving the motors such that the camera stays put. It is assumed that the reader understands the basics of PID controllers; many introductions are available on the web. At this point the first, and maybe most important comment is at place:

The PID tuning rules given in (essentially) all texts on PID controllers do NOT apply to brushless direct-drive gimbals!

So, the situation for the brushless gimbals is somwehat different than for the "usual" systems, and this obviously affects the tuning practice. Furthermore, although maybe termed PID in all cases it seems that the implemented PID controllers differ in their working, one probably should distinguish as follows:

  • AlexMos 2.3 and below, EvvGC: these firmwares implement basically PD controllers, with a "weak" I term
  • BruGi, BGC32, AlexMos 2.4, o323bgc/STorM32bgc: these firmwares implement "full" PID controllers

Comment: The AlexMos codes are of course not available, one can hence only speculate, however the various available descriptions/tutorials are telling.

The good message is that the PID controllers in the second category of firmwares work by the very same basic principles, which means that the tuning recipes given for any of them may be used to tune STorM32-BGC gimbals. The less good message is that there seem to be two different general tuning strategies, which may be called "low-PWM" and "high-PWM" tuning, and neither of them avoids experimenting. The "low-PWM" tunning has emerged as a result of experience for Gopro and larger gimbals; the "high-PWM" tuning has been described for small or micro gimbals. At this point it's not clear though which one is generally better, or if any is the best at all.

As a general tuning rule, consider:

Don't overdue it. Better be a bit conservative.

The first sentence is supposed to mean that while it's true that a proper tuning can lead to enormous performance gains and is mandatory for optimal operation it's also true that it is meaningless to adjust the parameters to their last digit. The second sentence reflects the fact that a PID controller which is aggresively tuned for a certain condition (e.g. battery voltage) is also very sensitive to changes in these conditions, i.e., is less robust.

Finally, although it may be obvious and may appear a bit smart ass, it cannot be over emphasized that:

The key to a good performance of the gimbal is a perfect mechanics and balance.

Inspection of the various threads immediately confirms this point.

Basic PID parameters

The basic PID controller parameters are [P], [I], [D], and [Vmax]. 

The parameter [Vmax] is known in other firmwares as e.g. the motor PWM or motor power.

The o323bgc firmware provides also the parameters [Pan], [Voltage Correction], and somewhat hidden [Hold To Pan Transition Time]. These are however not relevant for the basic tuning, and should in fact be deactivated for tuning.

Coarse tunning settings

For the basic tuning, the advanced tunning parameters should be deactivated.

  • [Pan] MUST be set to zero (or the hold mode ensured by other means, such as via the [AUX Kex Modes])
  • [Voltage Correction] should be set to 0%
  • the battery should neither be fully charged nor nearly discharged (i.e. have a voltage of around 3.7 V per cell)

The first step is to obtain a basic, working tuning (coarse tuning) of all axes. One should tune first the pitch axis, then roll, and then yaw. Ideally one would block the roll and yaw axes while tuning the pitch axes, and the yaw axis while tuning the roll axis. In any case make use of the [Roll Usage] and [Yaw Usage] parameters to avoid uncontrolled motion or even damage to the gimbal.

Once the gimbal is coarsely tuned, one may proceed to the fine tunning. Here the Data Display is most useful.

"Low-PWM" tuning

The "low-PWM" tuning strategy starts from the recommendation to set [Vmax], or motor power or PWM, as small as possible.

The motor power should of course also be as large as needed to overcome the motor's cogging torque, friction or imperfections in the balance. This sets a lower limit to [Vmax]. Typical tuning guides are

As said before, this recipe has emerged from the experience by several authors on Gopro and larger gimbals, and in this sense maybe considered as "proven". Generally, the motor power must not be too small:

The value of [Vmax], or motor power or PWM, should not be below 65 or 25%.

Lowering the [Vmax] value also diminishes the available angle resolution, and if it's too small the gimbal can't correct smoothly anymore.

"High-PWM" tuning

The "high-PWM" tuning strategy starts from the recommendation to set [Vmax], or motor power or PWM, as large as possible.

The rational in this tunning is that a larger motor power makes the system react faster (allowing in principle a faster correction and hence smaller error angles) and be more robust against disturbancs such as cogging torque, frictions, wind gusts and so on.

The upper limit for [Vmax] is mainly determined by the heat produced in the motors. Obviously, the motors should not get too hot. In practical terms, one should be able to touch the motors for several seconds (10 sec or more). The motor heat is however not the only factor which determines the proper [Vmax] value. As with the other parameters, one needs to experiment. It may e.g. happen that with a too large [Vmax] one may never achieve a vibration free, good tuning, and a somewhat lower [Vmax] is much better.

As regards [P], [I], [D], these two procedures seem to work:

  • Procedure A: Set [I] to a small value (might be worth to try even zero). Increase [D] and [P} alternatingly, and step by step. The gimbal should not start to oscillate. Since it are only two paramters one will quickly find the best balance of large [D] and large [P]. Now turn up the [I] value until the gimbal starts to oscillate (watch the accelerometer data in the Data Display), and back off by some 10 %. Finally, experiment with all three values. The general goal should be to get a large [I] value.
  • Procedure B: Set [P] to zero, and first adjust [I] and [D]. That is, increase I until the gimbal oscillates, then increase [D] to damp the oscillation. Repeat until neither increasing [I] nor [D] stops gimbal oscillations. Now also use [P], and experiment with all three values until the result is satisfying. The general goal should be to get a large [I] value.

Voltage correction

The voltage correction mechanism in 0323bgc attempts to compensate the effects by a varying battery voltage on the PID controller tuning. It does it by modifying the actual motor power. i.e. [Vmax] values proportionally to the voltage change. The proportionality factor is given by the parameter [Voltage Correction].

For instance, with a [Voltage Correction] of 100%, a drop in the battery voltage by 25% leads to an increase of the actually used Vmax value by 25%. With a [Voltage Correction] of 50%, a voltage drop by 25% leads to a 12.5% increase in Vmax, and so on.

The mechanism can significantly reduce the dependence of the gimbal performance on the battery voltage. It can however not accomplish what could be achieved with a truely constant (regulated) voltage.

Tuning the pan mode

In o323bgc the pan mode, also known as follow mode, is in some ways independent on the PID controller tuning. Thus, the PID controller tuning must be done with the pan mode deactivated. However, on the other hand, once the PID controller is tuned, the pan mode can be adjusted easily without having to touch the PID controller in any ways. (this is probably one of the apealing features of 0323bgc)

The pan mode is controlled by the parameters [Pitch Pan], [Roll Pan], and [Yaw Pan].

These parameters determine the pan speeds for each of the three axes. A zero means that the pan mode is deactivated, i.e., that the axis is in hold mode (also known as locked mode). There is little more to say here.

The transitions from hold to pan and pan to hold modes, which are possible via e.g. the external keys, present a challenge, since the abrupt accelerations on the camera which may occur in these situations cannot be handled well by the brushless gimbal technique. The acceleration after having switched from hold to pan can be limited or smoothened using the [Hold To Pan Transition Time] parameter.

Tuning the IMU/AHRS/MARG

PLEASE ADD

Understanding the parameters

Maybe usefull references (from the German FPVC forum):