View Single Post
  #12   Spotlight this post!  
Unread 05-04-2010, 10:52
SavtaKenneth SavtaKenneth is offline
Registered User
AKA: Yotam Kenneth
FRC #2212
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Israel
Posts: 63
SavtaKenneth will become famous soon enough
Re: Encoder with PIDController Help

First thing I'm a java programmer and I know the classes translate generally between Java and C++ but I'm not sure of it, also syntax differences apply.


you would probably want to make a wrapper class for TankDrive that implements PIDOutput. The PIDWrite method would probably look something like this

Code:
public void PIDWrite(double d){
super.TankDrive(d,0);
}

if I remember the method correctly( We didn't use the FIRST class this year, we wrote our own drive system class) this should work. The PID loop is a P only loop, there is no need for the I and D in this instance(i.e. set them both to 0 in the code). You'd also need to make a wrapper class for the encoder to make it into a PIDSource. When you create the loop use your encoder class as the source the drive class you created as the output and try different values. One last thing is to remember to limit output to (-1.0,1.0) so you nothing bad happens to your speed controllers. One

Last edited by SavtaKenneth : 05-04-2010 at 10:57.
Reply With Quote