|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
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. |
|
#17
|
||||
|
||||
|
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? |
|
#18
|
|||
|
|||
|
Re: PID Loops
I'm not a mathematician, but couldn't
Quote:
|
|
#19
|
||||
|
||||
|
Re: PID Loops
Quote:
If you are trying to move your car at 50 mph and currently, the error from this target is +10 mph, does it make sense to push the pedal down at 10 mph? A correlation does not mean an equivalent 1 to 1 relation. Another example is if you are trying to drive your robot 5 feet forward and the current error is 4 inches. Does it make sense to tell the motors to drive at 4 inches? Built into the k value is unit conversion among other things. Last edited by Chris27 : 13-03-2011 at 15:48. |
|
#20
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#21
|
||||
|
||||
|
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 |
|
#22
|
||||
|
||||
|
Re: PID Loops
Quote:
On the other hand, suppose you are trying to control motor speed. You want to go 2000 rpm and you are presently going 1900 rpm. So the error is 100 rpm. Would it make sense to give the motor a voltage command which is roughly equal to 100 rpm? |
|
#23
|
||||
|
||||
|
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.
|
|
#24
|
||||
|
||||
|
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. |
|
#25
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#26
|
||||
|
||||
|
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.
|
|
#27
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#28
|
||||
|
||||
|
Re: PID Loops
when you "ran the fp" how did you run it? i.e. what total gear ratio did you use?
|
|
#29
|
||||
|
||||
|
Re: PID Loops
Quote:
|
|
#30
|
||||
|
||||
|
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? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|