View Single Post
  #10   Spotlight this post!  
Unread 01-02-2011, 17:58
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Encoder with PIDController Help

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
__________________
Reply With Quote