Tuning Guide
by OlliW, is somewhat outdated
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 emerged yet, 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 individual experiences on specific gimbals. Furthermore, a basic understanding by the operator is unavoidable, and the following is accordingly explanatory in parts.
If your experience has led you to different tuning rules please feel free to share them (the Discussion page could be a good place for that).
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 using the measured attitude for 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 brushless gimbals is somewhat different to that 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 somewhat 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 (be aware however that this doesn't mean that PID values can be carried over; the units generally are different!). The less good message is that there seem to be two different tuning strategies, which may be called "low-PWM" and "high-PWM" tuning, and neither of them avoids experimenting. The "low-PWM" tuning resulted from experience for Gopro and larger gimbals; the "high-PWM" tuning has been described for micro gimbals. At this point it's not clear which one is generally better, or if any is the best at all.
As a general tuning rule, consider:
Don't overdo 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 aggressively 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 the motor PWM or motor power.
The o323bgc firmware provides also the parameters [Pan], [Voltage Correction], and [Hold To Pan Transition Time]. These are however not relevant for the basic tuning, and [Pan] should in fact be deactivated for tuning.
Coarse Tuning Settings
For the basic tuning, the advanced tuning parameters should be deactivated.
- [Pan] MUST be set to zero (or the hold mode ensured by other means, such as via the [Pan Mode Control] settings)
- [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 of all axes (coarse tuning). 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 axis, 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 with fine tuning, which is entirely trial-and-error and no tuning recipe exists at all. 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
- http://sourceforge.net/p/brushless-gimbal-brugi/wiki/PIDtuningguide/
- https://bradatech.com/xPedRobo/shop/download/uploading_software_martinez_board.pdf, page 10
- Quick how to tune guide for BRUGI/martinez brushless gimbals
- A Tuning Guide - Brushless Gimbal Wiki
- PLEASE ADD HERE
As said before, this recipe has emerged from the experience by several authors on Gopro and larger gimbals, and in this sense may be 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 tuning 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 disturbances 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 can't 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. Increase [D] and [P] alternately, step by step. The gimbal should not start to oscillate. Since it are only two parameters 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, 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 or avery small value, 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.
Tip: Vibrations or oscillations of the gimbal can be nicely seen in the DataDisplay's accelerometer panel.
Voltage Correction
The voltage correction mechanism in o323bgc 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 truly constant (regulated) voltage.
Tuning the Pan Speed
For the STorM32-BGC the pan (follow) mode is in some ways independent on the PID controller. The PID tuning must thus be done with the pan mode deactivated. However, on the other hand, once the PID controller is tuned, the pan speed can be easily adjusted without having to touch the PID controller any further. This is probably one of the appealing features of the STorM32-BGC. Accordingly, the discussion of the hold and pan modes is deferred to a later chapter.
Understanding the Parameters
Maybe useful references (from the German FPVC forum):
- http://fpv-community.de/showthread.php?20795-Brushless-Gimbal-Controller-SOFTWARE&p=382163&viewfull=1#post382163
- http://fpv-community.de/showthread.php?20795-Brushless-Gimbal-Controller-SOFTWARE&p=381584&viewfull=1#post381584
- http://fpv-community.de/showthread.php?20795-Brushless-Gimbal-Controller-SOFTWARE&p=381513&viewfull=1#post381513
Next step - RC Inputs
With these settings we have a self leveling gimbal. No matter what movements the gimbal support is undergoing, the camera remains stable. While this might be perfectly sufficient for basic operation, normally the gimbal shall also be moved via a RC stick or, on a hand-held gimbal, via a joystick, or functions such as switching between hold and pan modes or releasing the shutter of the camera remotely are desired.
You can learn about these possibilities in the next chapters; continue with Configure the RC Input.