go away spammer

Author Topic: got constant values for WebbotLib PID?  (Read 2293 times)

0 Members and 1 Guest are viewing this topic.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
got constant values for WebbotLib PID?
« on: September 04, 2010, 09:45:25 AM »
Has anyone used the PID functions in WebbotLib?

I was hoping to get a small list of 'typical PID constant values for typical robots' list.

If you've used it, can you post this information:

kP
kI
kD

If you used the PID for motor control, post your robot weight, and specific motor type, and any other relevant information.

The idea is that this information will help others, especially beginners, get into the ball-park of guessing before doing the finer PID tweaking.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: got constant values for WebbotLib PID?
« Reply #1 on: September 04, 2010, 10:45:59 AM »
Yes, I did help write it after all.

I use it as my heading controller; something else calculates the heading required to get to the next waypoint, and feeds that into a PID that 'steers' the robot into that heading.

I'm in the processing of completely rebuilding my drive train and controller from scratch, and have to re-tune the heading controller.  Still, i'm not sure if a heading controller is something most beginners can wrap there head around.

My new motor controller does have it's own (non-webbot) PID controller, but I will post it's info since it works the same anyway.

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: got constant values for WebbotLib PID?
« Reply #2 on: September 04, 2010, 11:42:30 AM »
Alright, get ready for the math I'm about to throw.

On my SAGAR robots, I have 39cm circumference wheels. That means my robot has traveled 39cm with one wheel rotation.

My motors have a 19:1 gear ratio.

My encoders give me 32 'clicks' per motor shaft rotation. That means i get 608 (32 * 19) clicks per wheel rotation.

Therefore I get about 16 (608 / 39) clicks per cm traveled.

Now my PID controller works with clicks, not cm. So whenever my motor controller gets a command for speed. (We will say 200 cm/sec for example) it has to translate that into clicks. so 200 cm * 16 =3200 clicks per second.

My PID loop runs at a rate of 35Hz, that means it adjusts wheel speed 35 times a second. so now our goal of 3200clicks/sec has to be divided by 35 to create a click goal for each PID loop. 3200/35 = about 91 clicks per PID loop.

The max speed for my motors is 325 cm/sec. That means the range of clicks per PID loop goes from 0 to 150. Actually, it's -150 to 150 since anything negative just means it spins in reverse.

All this was to demonstrate that the input range of my motor controller's PID is -150 to 150. The output is a PWM duty cycle from 0-255 where 255 is full on. Again, it's actually -255 to 255 with negative meaning power in reverse.

So for -150 to 150 input and -255 to 255 output, my PID gains are:

K_P .8  //porpotional control Gain
K_I .4 //Integral Control Gain
K_D 5 //Derivitave control gain
I_LIMIT 2.5 //to prevent I wind-up

My new controller is actually more complicated, as it has a state machine per wheel, it can be either under power with the PID controller above, braking x hard using a second PID controller, or in constant current mode with a third PID controller if a motor is drawing too much current and is still being asked to go faster.

 


Get Your Ad Here