Inflyght PID adjust

Post Reply
User avatar
matbogdan
Posts: 29
Joined: Wed Nov 23, 2011 9:35 am
Contact:

Inflyght PID adjust

Post by matbogdan »

I was just hit by a idea:
Adjusting PID parameters can be a pain in the ass if the adjuster have no idea what is he doing.
Adjusting as we fly it:
Step 1: have a flyable backup parameters that you can switch with a flip of a finger so you wont crash. This backup can be determined by holding the drone in your hand and see the response but for perfect parameters we need a method to calibrate PID inflight.
Step 2:use one of the AUX channels to activate PID adjustment P parameter (I and D are calculated), than use a VR (futaba like) to adjust the parameter until comfortable fly. I and D parameter can be calculated by the board using Ziegler-Nichols method.
Step3: as soon you have comfortable fly behavior (no woble), land and save the parameters.

The I and D parameters can be determined later by trial and error or/and using http://en.wikipedia.org/wiki/Ziegler%E2 ... ols_method , but the P is important and makes the thing fly. I think we can have the P manual determined by inflight calibration and the I and D calculated by the Ziegler-Nichols method.

Usual the Roll/Pitch PID parameters are the same values for a Quad/Hexa/Octo copters. So why not adjust manually inflight the P parameter same for Pitch and Roll and let the I and D be calculated with the method Ziegler-Nichols. Like this you can achieve the best PID parameters.

Many of the people around here use wifi/bluetooth serial transceivers to do this from GUI. I think it can be implemented (like in flight calibration) to be available from tx also.

It is just a idea, so please do not jump on me. My quad-copter is calibrated by hand with trial and error. Same is my tri-copter.

I got this idea from experimenting with my helicopter the gyro gain in rate and head-hold. I use a VR potentiometer from my futaba to adjust the sensibility of head hold gyro until no wobble than I land my helicopter and check the settings (the value of the channel) and set it as default parameter for that helicopter.

I think this will solve the PID adjustment problem that many have and is not so difficult to be implemented in multiwii software.

The above post was taken from http://www.fuzzydrone.org/2012/02/simpl ... tment.html

User avatar
Rob
Posts: 77
Joined: Sun Apr 03, 2011 4:40 pm

Re: Inflyght PID adjust

Post by Rob »

Was already hit......

viewtopic.php?f=7&t=978

Ziegler–Nichols method Control Type inflight PID tuning

Code: Select all




      if(PMTR_Tune){
         if(rcData[AUX3]>1700){ // Safe in eeprom
            Opslaan_PID_instellingen_in_Eeprom();
            PID_programmed=1;
         }   
         else if((rcData[AUX3]>1200)&&(PID_programmed==0)){
            PMTR_Acc_on_active; // anders kan deze uit staan!!!
            Freq = 3; // Frequentie in Hz
// P /10
// I /1000
// D   
/*

   Ziegler–Nichols method Control Type
          Kp           Ki        Kd
      P   0.50Ku    -              -
      PI   0.45Ku  1.2 Kp/Pu  -
      PID 0.60Ku  2 Kp/Pu     KpPu/8

Ku = input waarde 0...250
Kp = berekende P waarde (0,6 Ku)
Pu = de frequentie van oscillatie

*/
            PMTR.Gyro_Roll_Pitch_P   = (char)(((((constrain(rcData[AUX2],1000,2000))-1000)/4)*60)/100);
            tempp = PMTR.Gyro_Roll_Pitch_P; // waarde in een int, i.v.m. uitrekenen
            PMTR.Gyro_Roll_Pitch_I   = (char)((2*tempp)/Freq); //tempp hier niet nodig?
            PMTR.Gyro_Roll_Pitch_D    = (char)((tempp*Freq)/8); // tempp hier wel nodig
           
            PMTR.Acc_Roll_Pitch_P    = (char)(((((constrain(rcData[AUX1],1000,2000))-1000)/4)*45)/100);
            tempp = PMTR.Acc_Roll_Pitch_P; // waarde in een int, i.v.m. uitrekenen
            PMTR.Acc_Roll_Pitch_I    = (char)(((tempp*12)/10)/Freq);
         }
         else{
            PID_programmed=0;
            if(rcData[AUX1]>1500){   // ACC AAN
               PMTR_Acc_on_active;
            }
            else{               // ACC UIT
               PMTR_Acc_on_inactive;
            }     
         }
      }           
      else{

         if(rcData[AUX1]>1400){   // ACC AAN
            PMTR_Acc_on_active;
         }
         else{               // ACC UIT
            PMTR_Acc_on_inactive;
         }
         
         if(rcData[AUX3]>1200){
            OUT2_ON;
         }
         else{
            OUT2_OFF;
         }
      }



Post Reply