Welcome to Multi-Rotor UK. Please login or sign up.

Monday,July 13, 2020, 07:59:58

Login with username, password and session length

Shoutbox

sh0wtime:
08 Jul 2020 23:54:24
howdy
hoverfly:
08 Jul 2020 10:22:40
My mother did it, which explains the mental conditions of my sisters, its a genetic  thing. :D
Andy7:
07 Jul 2020 14:01:29
... I could ask how you knoiw this... but I would regret it.
hoverfly:
07 Jul 2020 11:53:34
Little known fact, if you push a runner bean seed up your nose the moisture will cause it to germinate, and expand.You wont get any beans though just  two black eyes. :o
Andy7:
04 Jul 2020 13:16:48
VIDEO or it didn't happen!! :) Nice going though, keep it up!
Bad Raven:
02 Jul 2020 19:46:48
 ~~
whoelseisbored (LiamHowe89):
02 Jul 2020 17:45:19
Sounds basic but I'm happy with it  :laugh:
whoelseisbored (LiamHowe89):
02 Jul 2020 17:45:05
Managed a split s :D
badger1:
28 Jun 2020 12:29:49
BF GPS Rescue mode configured - what could possibly go wrong?   :o
badger1:
27 Jun 2020 21:07:37
and can't make it back to where you take off from   :laugh:
Members
Stats
  • Total Posts: 199021
  • Total Topics: 20055
  • Online Today: 27
  • Online Ever: 530
  • (Tuesday,June 26, 2012, 08:34:46 )
Users Online
Users: 0
Guests: 15
Total: 15

Theme Changer





thumbnail

3d - Printworx

Printing 3d Forum

Multiwii code mod - Varying Roll and Pitch PIDS on the fly

Started by teslahed, Sunday,November 11, 2012, 14:31:08

Previous topic - Next topic

teslahed

Sunday,November 11, 2012, 14:31:08 Last Edit: Thursday,November 15, 2012, 12:10:36 by teslahed
More recent versions of Multiwii have a setting called ';T P A'; which allows you to set a % value that the Roll and Pitch PIDs reduce by when throttle is at 100%. If you set ';T P A'; to 0.5 then at full throttle your Roll and Pitch PIDs will reduce by half, 0.25 and they';ll reduce by a quarter. The default is 0 which corresponds to zero reduction in PID strength at full power (or no effect in other words).

This is used in some models that are more prone to feedback wobbles at high power settings like helicopters and flying wings. I thought it might help my mini-quad that wobbles a bit at full power.

When i was looking up the explanation for all this i discovered this thread over on the multiwii forums;

http://www.multiwii.com/forum/viewtopic.php?f=8&t=1562&start=90

Shamelessly stealing little nellie';s idea and PatrikE';s how-to, it seems you can alter the Multiwii code so that an auxiliary channel rather than the throttle will control the PID strength reduction. I';ve managed to set mine so that one of my potentiometers adjusts between full PID strength and 50% (say) when i have ';T P A'; set to 0.5 in the multiwiiconf windows program.

I';ve tested it over my bed and it definitely works.

In order to set this up you need to use the arduino software to open up the MultiWii.INO file.

Search for the code section that looks like;

#define BREAKPOINT 1500
  // PITCH & ROLL only dynamic PID adjustemnt,  depending on throttle value
  if   (rcData[THROTTLE]<BREAKPOINT) {
    prop2 = 100;
  } else {
    if (rcData[THROTTLE]<2000) {
      prop2 = 100 - (uint16_t)conf.dynThrPID*(rcData[THROTTLE]-BREAKPOINT)/(2000-BREAKPOINT);
    }


The key bit here is ';rcData[THROTTLE]';. You can change this to ';rcData[AUX3]'; or in my case ';rcData[AUX1]'; (as i only have one auxillary input on this old PARIS multiwii board) and the result is that the ';T P A'; value will now be controlled by the auxillary channel rather than the throttle. It is also worth changing ';BREAKPOINT 1500'; to ';BREAKPOINT 1200'; just so that you get to use more of the travel on the potentiometer as the signal usually starts around 1000.

The result should look like this;

#define BREAKPOINT 1200  //CHRIS TELFORD modified this part 11/11/2012
  // PITCH & ROLL only dynamic PID adjustemnt,  depending on AUX1 value
  if   (rcData[AUX1]<BREAKPOINT) {
    prop2 = 100;
  } else {
    if (rcData[AUX1]<2000) {
      prop2 = 100 - (uint16_t)conf.dynThrPID*(rcData[AUX1]-BREAKPOINT)/(2000-BREAKPOINT);
    } else {
      prop2 = 100 - conf.dynThrPID;
    }
  }


Now make sure your radio is configured so that Auxillary1 is controlled by a potentiometer and it should all work. You can adjust the strength of your PIDs in flight with the potentiometer and adjust the total amount adjustable with the ';T P A'; value in the multiwiiconf program.

One circlip short of a quadcopter.
 1 lobe short of an antenna.

neagron

thats very clever stuff chris,theres a lot in there if you no what your doing,unlike me thats just stumbles around,Marty. :scotland:

teslahed

I';ve just been testing this flying around outside - it works very well, pretty much as you';d expect.

I set my Pitch and Roll PIDs too high by about 0.5 so that the quadcopter would fly, but only just, then got the thing hovering in front of me whilst i adjusted the PID strength down until it flew smoothly.

Now I just need to find a way of ';reading off'; the PID value after adjusting it so that i can then set that value as the fixed value in the GUI afterwards.
One circlip short of a quadcopter.
 1 lobe short of an antenna.

Gaza07

Nice mod Chris well done, I may give this a go on one of my spare copters  ~~

teslahed

Monday,November 12, 2012, 19:19:19 #4 Last Edit: Thursday,November 15, 2012, 12:12:49 by teslahed
I posted my findings up on the official multiwii forum;

http://www.multiwii.com/forum/viewtopic.php?f=7&t=2745&p=26629#p26629

And Patrik came back with an excellent addition;

Quote from: PatrikEYou can read the data if you insert a few rows after the calculations.
At the end of main loop after writeMotors();


mixTable();
  writeServos();
  writeMotors();

  //DebugPrint TPA dynData
    #define TPA_DEBUGDATA  // Comment of not needed
    #if defined (TPA_DEBUGDATA)
     for(axis=0;axis<2;axis++) {   
      debug[axis]=dynP8[axis];     // debug 0 & 1  P for Roll/Nick
      debug[axis+2]=dynD8[axis];   // debug 2 & 3  D for Roll/Nick
     }
   #endif
  // End of Print TPA dynData

}


The code also goes in the MultiWii.INO file, right at the bottom.

After adding this bit of code the P and D terms can be read in the MultiWiiConf windows program in the debug boxes along the bottom when the quadcopter is connected up. With a phone and bluetooth you could read of the values in flight, otherwise you can read of the best value after you';ve landed as long as you don';t twiddle the potentiometer after you';ve found the sweet spot.

Seems like this should allow for quicker PID tuning if used properly.
One circlip short of a quadcopter.
 1 lobe short of an antenna.

Gaza07

This makes it even better like you say you will now know what the settings are and can take note  ~~