PID Autotune Library

Hello, I downloaded http://playground.arduino.cc/Code/PIDLibrary this library, this PID works well. Then I downloaded http://playground.arduino.cc/Code/PIDAutotuneLibrary this library, but there isn't written how to use this library, no examples for arduino... only for processing. Can someone help me, I need basic example how to make it work for my quadcopter.

The example in the GitHub code looks to be for the arduino and not processing.

Looking at the library header file give some clues what is what. It list the functions along with expected parameters and data types expected and returned from calling.

//commonly used functions **************************************************************************
PID_ATune(double*, double*);  // * Constructor. links the Autotune to a given PID
int Runtime();                // * Similar to the PID Compue function, returns non 0 when done
void Cancel();                // * Stops the AutoTune
void SetOutputStep(double);   // * how far above and below the starting value will the output step?
double GetOutputStep();       //
void SetControlType(int);     // * Determies if the tuning parameters returned will be PI (D=0)
int GetControlType();         // or PID. (0=PI, 1=PID)
void SetLookbackSec(int);     // * how far back are we looking to identify peaks
int GetLookbackSec();         //
void SetNoiseBand(double);    // * the autotune will ignore signal chatter smaller than this value
double GetNoiseBand();        // this should be acurately set
double GetKp();               // * once autotune is complete, these functions contain the
double GetKi();               // computed tuning parameters.
double GetKd();               //

Thanks for this fast reply, could you give me the link where you found it, I would like to read more, when to use these commands.

rokasbalsys: Thanks for this fast reply, could you give me the link where you found it, I would like to read more, when to use these commands.

From the AutoTune playground link you supplied is one link to the GitHub code and another to an article on what the tuner does.

Ye, commands are OK, but how when and where to use it I don't know

This is my simple code part where I use PID. x_axis is angle from accelerometer, value[0] is value for motor speeds. motor3 and motor4 is value of two motors. Maybe someone can add autotune code ?

#include <PID_v1.h>

double kp=1;
double ki=1;
double k1=1;

double Setpoint, Input, Output;
PID myPID(&Input, &Output, &Setpoint,kp,ki,kd, DIRECT);

void setup()
{
    Setpoint = 0;
    myPID.SetOutputLimits(-1150, 1150);
    myPID.SetMode(AUTOMATIC);
    myPID.SetSampleTime(10);
}

void loop()
{
    Input = x_axis;

    motor3 = value[0] + Output;
    if (motor3 >= 2000)
    motor3 = 2000;
    if (motor3 <= 850)
    motor3 = 850;
    
    motor4 = value[0] - Output;
    if (motor4 >= 2000)
    motor4 = 2000;
    if (motor4 <= 850)
    motor4 = 850;
    
    MOTOR3.writeMicroseconds(motor3);
    MOTOR4.writeMicroseconds(motor4);
    
    myPID.Compute();
}