Dang it! We had used the information that you guys had given us and finally had our robot working and PIDing with the encoders and then the WPI Library got updated with a mandatory update and broke it all again! I get a wall of red from redundant PIDSources or some such thing.
Grr, can someone please help me get set back up, now using the default, updated PIDController class that has the encoders as a source now. Specifically can someone help me figure out how to tell the encoder to use distance as its source?
So instead of constructing my encoders with the nice subclasses from earlier in the thread, I do:
Code:
Encoder *elevatorEncoder;
PIDController *elevatorControl;
//constructor
elevatorEncoder = new Encoder(11,12,true,Encoder::k4X);
elevatorEncoder->SetDistancePerPulse(0.009); //inches //UPDATE!!
elevatorEncoder->Start();
elevatorControl = new PIDController(0.1, 0.01, 0.001, elevatorEncoder, elevatorMotor);
//periodic
elevatorControl->Enable();
elevatorControl->SetPID(((leftStick->GetThrottle()+1)/2)*0.1,
((rightStick->GetThrottle()+1)/2)*0.01,0.0); //tuning
elevatorControl->SetSetpoint(ElevatorPosition);
I assume somewhere in the constructor I use
"void Encoder::SetPIDSourceParameter ( PIDSourceParameter pidSource )" from the help file, but I can't find the list of variables which denotes distance. Can someone help me figure out how to get setup correctly?