View Single Post
  #14   Spotlight this post!  
Unread 04-02-2011, 23:54
sircedric4's Avatar
sircedric4 sircedric4 is offline
Registered User
AKA: Darren
no team (The SS Prometheus)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Lousiana
Posts: 245
sircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond repute
Re: Encoder as PIDSource

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