EN RU CN
Release Matlab model of the PID controller?
  • Hello BaseCam,

    I am doing aerialvideo shooting using quadcopter. Do you mind to release your PID controller equation? For example in a form of matlab file?

    Tuning I believe is one of the major problem among alexmos gimbal users. Tuning is relatively easy if we want a gimbal "looks" working when bending the frame by hands. But when we need to get good "performance" in the air for example, it is always mysterious on how to get the "sweet PID parameters spot".

    For example if we know the PID controller is this:
    controller_output = (Kp + Ki/s + s Kd) * error_input

    then we can use a text-book DC motor model in matlab and study the root-locus of the over-all PID closed-loop system. We can even adjust the pole locations, get the Kp,Ki,Kd from matlab, and put them back into the alexmos controller and test it in real life. The following link teaches a study on DC motor position control using PID.
    http://ctms.engin.umich.edu/CTMS/index.php?example=MotorPosition&section=ControlRootLocus

    The dominate pole location due to the DC motor can be found by putting the real gimbal into the edge of oscillation. If we can have the actual PID controller equation, we can apply the matlab study into the real-work gimbal tuning!

    I believe the actual controller is far more complicated then those we see in text-book. But anyway if we end-up having a systematic way to optimize a gimbal performance then a steep learning is still worth it. Comparing to spending endless of time doing complete guess-work on how to get the best gimbal performance.

    Thank you very much,
    Wilson
  • Hello, Wilson

    Actual inner PID controller is pretty simple: its a straightforward P, I, D calculation over gyro data with the given sample rate. D-part is a difference between 2 samples, I-part is integration with wind-up limit. There is also outer PI, but it does not need tuning - if you disable Outer P, I coefficients, system will not change its behaviour significantly.

    The main problem with modeling of such PID is units conversion (gyro rate units -> rate of output voltage) and undefined model of a motor - its a blackbox with the 3phase voltage input and say, torque on output. But not only one problem - there are other major factors that affect PID tuning:

    1. gyro sensor has internal LPF (delay), internal noise, is sensitive to vibrations (may be important for aerial usage)
    2. mechanical structure is unknown order system with its own delay, resonances. On high-frequencies its a significant member a closed loop system.
    3. in semi-quality motors with descreet magnets, torque may depend on stator/rotor position, and cogging may present. As a result, PID well tuned in one position, will be unstable in other position.
    4. There is a cross-axes interference because of not ideal mechanical structure. In normal position, it should not present, axes should be independed, but actualy it does. And theoreticaly tuned stable PID for 1D case is not more stable in real 3D case - PID gain should be lower than tuned for 1 isolated axis.

    I considered modeling in matlab, but I think actual 'practical' way of PID tuning is more efficient (regardless of the fact that only 0.01% of gimbal users can use matlab :)
    Another way is to build a matlab model using experimental data. Check "Analyze" section in user manual, may be it will be easier way.

    I understand that there is a big room for the development of automated PID tuning, but its very complicated task and is far away in my TODO list.

    Regards, Aleksei
  • Hello Aleksei

    How are the gyro values used if the camera IMU is rotated by 90 degrees? In my gimbal, the Z axis of the IMU is parallel to the ROLL axis (Y axis parallel to the PITCH), but when PITCH(and the camera IMU) is rotated by 90 degrees, then the X axis of the IMU would be aligned with the ROLL motor. So is there some kind of switching between or are they merged all the time?

    Regards,
    Reto