|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: PID Loops
We are currently running two denso window motors in tandem to power the joint with a surgical tubing counter balance. I'm just curious because when we ram the fp, it was WAY too fast and couldn't hold the weight in one position, but I've seen teams do it with much success.
|
|
#2
|
||||
|
||||
|
Re: PID Loops
when you "ran the fp" how did you run it? i.e. what total gear ratio did you use?
|
|
#3
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#4
|
||||
|
||||
|
Re: PID Loops
An example of a use of PID is our autonomous mode. We want to be able to drive out exactly x inches to our rack in a perfectly straight line to put us in a position to score a tube on the high rack. This isn't so straightforward as a 150lb robot has a lot of momentum and it is easy to overshoot a target distance (and crash into the wall). We can record the distance the robot has traveled by putting an encoder on the right side of the drive train. Using PID, we set the set point to x and read the encoder to get the current position. With our gains set correctly, we arrive at distance x rather smoothly.
However, we also want to drive in a perfectly straight line. If, say there is more friction on one side of the drive train, this will cause the robot to drive in an arc. You can add a gyro to the bot, use PID on it with the set point of whatever heading is defined to be "straight". Add this correction to the speed of the left wheel motors and you are 80% of the way to having a perfect one tube autonomous mode. |
|
#5
|
||||
|
||||
|
Re: PID Loops
I've been reading this thread and could someone please post an example code with P, I and D implemented to control something? I saw the LabView code, but I never learned labview, so could someone please post a C++/Java example?!
![]() EDIT: I did implement P loop to control our arm this year, but only for presets. Is it possible to implement PID loop for manual control? If yes, how so? |
|
#6
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#7
|
||||
|
||||
|
Re: PID Loops
Quote:
I'm multiplying by 5 because the Yaxis is only between -1 and 1 so one would want to have a target that is significantly different compared to the currentPotValue |
|
#8
|
||||
|
||||
|
Re: PID Loops
Quote:
Adjust the gain "m" and the offset "b" so that your process variable corresponds to your Yaxis output. Then, error = setpoint - process_variable; motor_voltage_command = Kp*error; Kp is your proportional gain which you tune for the desired response. |
|
#9
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#10
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#11
|
||||
|
||||
|
Re: PID Loops
Quote:
So (m*currentPotValue+b) doesn't have to be within -1 to +1? And what exactly does it, the process variable, do? |
|
#12
|
||||
|
||||
|
Re: PID Loops
"m" and "b" are constants which you need to calculate and set so that the operating range of the process variable corresponds to the desired operating range of the joystick, be it -1 to +1 or 0 to +1 or whatever.
Quote:
|
|
#13
|
||||
|
||||
|
Re: PID Loops
Quote:
JoyStickYaxis is +1 (operator input) currentPotValue is 550 (min is 300 and max is 600) (m*(currentPotValue+b)) = ( (1/150)*(550-450) ) m is 1/150 and b is -450 so that the number is always between -1 and 1error = 1 - 0.6666; MotorOutput = k * 0.3333 and say k is 0.75 then the output becomes 0.25 of course, k needs to be adjusted so the error is as close to 0 as possible and/or the arm doesn't oscillateGood so far? Or did I make a mistake somewhere? EDIT: I have a feeling I did something wrong Last edited by PriyankP : 13-03-2011 at 18:01. |
|
#14
|
||||
|
||||
|
Re: PID Loops
If a system of your robot has mechanical limits (e.g. an arm) you may want to use PID (or even just P) to not smash into those limits. I can also see PID used for speed control like in Chris's example.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|