![]() |
Re: PID Loops
Quote:
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. |
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? |
Re: PID Loops
I'm not a mathematician, but couldn't
Quote:
|
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. |
Re: PID Loops
Quote:
|
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 |
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? |
Re: PID Loops
Quote:
|
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. |
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
Re: PID Loops
Quote:
|
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? |
| All times are GMT -5. The time now is 23:40. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi