The PID of the libraries of Ardupilot

Source: Internet
Author: User
Tags reset

In the source of the libraries, there are two of the source files on the PID folder, one called Ac_pid, the other is PID. The ac_pid are subdivided into ac_heli_pid, ac_p and Ac_pid, where we discuss only ac_pid. PID folder has only one PID class, the following list of these two classes of properties and methods, and roughly describe its function and implementation details, the source code please download their own reading. Ac_pid

Constructor (abbreviated)

Float Get_pid (float error, float DT); The output of the PID controller is calculated by calling the following get_p, Get_i, get_d functions respectively
Float Get_pi (float error, float DT); Calculate PI Controller Output
Float get_p (float error) const; Calculate P output
Float get_i (float error, float DT); Calculate I output, which has an integral limit, determined by _imax
Float Get_d (float error, float DT); Calculate d output, first to determine whether the last differential value is valid, to avoid the previous value uncertainty caused by large output, and there is 20HZ low-pass filter

Reset the PID Integrator
///
void Reset_i (); Set the integral value to 0, the last differential value to Nan

Load Gain Properties
///
void Load_gains ();

Save Gain Properties
///
void Save_gains ();

Sets filter Alpha for D-term LPF
void Set_d_lpf_alpha (int16_t cutoff_frequency, float time_step); Calculating filter coefficients
PID

Constructor (abbreviated)

       float        get_pid (float error, float scaler = 1.0);  //Compute the output of the PID controller, similar to the method used above, Different points 1. If the two time calculation is greater than 1 seconds, reset the integral value to avoid large fluctuations; 2 has a scaler the output value can be proportional to the overall operation, without adjusting PID three parameters, the default is 1.

    //get_pid () constrained to/+ 4500
    int16_t     get_pid_4500 (float error, float scaler = 1.0);     //Limit PID output between +/-4500

    ///Reset The PID Integrator
   ///
    void         reset_i ();

   ///Load gain Properties
   ///
    void         Load_gains ();

   ///Save gain Properties
   ///
    void         Save_gains ();

Can be seen that two PID implementation of the basic consistent, in the details of the treatment is not the same, the specific use of where is not very clear, here is only to make a note, as the study deepened will be further improved.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.