This thread is to discuss this program. I am sure some people have questions about how a PID loop works. I am relatively new to PID, but I can do my best to explain my code to you all.
I can not open the code in easy C.
Do you have EasyC Pro? Thats what it was written in.
So care to explain what a PID loop is?
I’m almost grasp the concept of a PID loop, I’m not quite sure how or if it can be applied to the vex system. I think that, in context, the point of it is to adjust the measured speed of a motor to match the set speed by increasing or decreasing the power level given to the motor. Please correct me if I have the concept wrong and I was also curious whether it could be applied to make a robot drive a striaghter line.
- Using a PID control loop you can filter the signal of a sensor such as the Ultrasonic or Accelerometer (generally used with analog)
- If you felt like your robot was reacting too slowly to your transmitter’s control inputs than a PID loop would help increase the robots reactivity
Exactly, if you give the motor an input of 100, then usually it would take a fraction of a second for it to ramp up to that speed. With a PID loop you get the motor up to that speed much faster. Note: this test would be difficult to carry out. Personally I believe the motors are pretty responsive already and if you use a PID loop you might “overdampen” the signal causing it to jump a bit higher than your initial input before going to its original speed.
I have been looking into this and I believe a PID loop could slightly help the robot drive in a straighter line esp. if you PID control your inputs (such as a line tracker/other sensors) and outputs (motors). I am testing this out and will report my results as soon as possible.
With PID control loops you have to do a lot of adjusting on the gains and such… this technically requires an oscilloscope (which I do not have…) therefore I am using our FRC teams cRIO and getting graphical data which is very helpful
oh, I thought the point of the loop was to keep a motor at the actual speed it was supposed to be at accounting for friction and other factors that usually slow motors down. Check out these links for programming the Lego Mindstorms kit in robot C, do you think it is reasonable that something like this could be used with Vex to make very straight driving robots.
The link doesn’t work that great, click on movement tab, then inproved movement to veiw the page.
I think you are mistaken about this part of your explanation. Double-check your sources and let us know what you find out.
Control loops are a method of controlling input(s) to keep a variable as close to its desired value as possible (called its setpoint). For example, consider a computer-controlled valve on the pipe leading into a large tank. A control loop could be used to change the extent to which the valve is closed (the input) to keep the amount of liquid in the tank (the variable) as close to 5 gallons (the setpoint) as possible.
PID (Proportional, Integral, Derivative) control loops are a specific implementation of a control loop and is composed of three terms:
*]Proportional: Change in the input is proportional to the magnitude of the error in the output.
If there is one gallon of liquid in the tank, the valve would be further open than if there is 4.5 gallons of liquid in the tank.
*]Integral: Change in the input is proportional to the integral of the difference between the variable and setpoint. This eliminates errors that are too small to be corrected of the proportional term.
If there is 4.9 gallons of liquid in the tank, the valve would be slightly open as the 0.1 gallon error will increase as it is integrated with respect to time.
*]Derivative: Change in the input is proportional to the derivative (i.e. rate of change) of the difference between the variable and its setpoint. This decreases the input as the variable approaches the setpoint, to prevent overshooting.
As the tank fills from 1.0 to 4.9 gallons, the rate at which it fills is decreased to prevent potential overshoot.
Crammed together, the current input is a linear combination (i.e. weighted sum) of the above factors:
input = a*P + b*I + c*D
Arguably, the hardest part of implementing a PID controller is identifying the variable on which the error should be minimized and properly selecting the appropriate constants a, b, and c. This is called tuning, and is described in more detail on the PID Controller Wikipedia page.
uh oh, you are right. I put the P, I, and D together into a mixed up assumption. Necraz’s explanation really cleared it up.
No sweat - If you are getting familiar with these concepts before taking college courses to learn their details, then you are way ahead of where I was back when I was eligible to be on a Vex team. That’s a good thing - Keep it up.
I was looking at the vex wiki both the new Cortex and the ARM9 Microcontrollers have at least 2 motor outputs with PID control. It looks like you could use either encoders ro EMF motors.