
01-02-2011, 22:48
|
 |
Software Mentor
AKA: Mike Anderson
 FRC #0116 (Epsilon Delta)
Team Role: Mentor
|
|
Join Date: Feb 2010
Rookie Year: 2010
Location: Herndon, VA
Posts: 328
|
|
|
Re: Encoder with PIDController Help
Quote:
Originally Posted by mikets
We are not using any encoders this year because we are using Mecanum wheels and our build head said the axle of the gearbox is too big to fit with the KOP encoders. But the beauty of the PID library is that it doesn't care what sensor you use. Since this year is pretty much line following. So we have a library module for line following drive which takes one PID controller that controls the heading while following the line. This PID controller for line following uses the three light sensors as input. In fact, we are planning to translate the light sensor readings into an integer with the following possible values: -2, -1, 0, 1, 2. Zero being right on the center of the line. 2 being too far to the right. Then this input value can be used as PIDGet() to calculate the error. So we can do the equivalent of:
Code:
lineFollower->SetTarget(float setPoint);
So we will call it with 0.0, telling it to maintain a reading of 0 (center of the line).
You can access the library here:
http://proj.titanrobotics.net/hg/Frc...03ad30f/trclib
|
Thanks! I'll take a look.
Mike
|