View Full Version : Encoders With Motor Speeds
2386programming
30-01-2015, 12:34
Hello, my team is programming the drive train for this years robot and all the gear boxes move at different speeds. We are trying to figure out a way to get a value from the encoders for inches per second per say, and then send readings to our talons making all the wheels spin at the same speed.
notmattlythgoe
30-01-2015, 12:35
Hello, my team is programming the drive train for this years robot and all the gear boxes move at different speeds. We are trying to figure out a way to get a value from the encoders for inches per second per say, and then send readings to our talons making all the wheels spin at the same speed.
Are you using the new Talons or the older ones?
2386programming
30-01-2015, 12:39
We're using the old ones.
notmattlythgoe
30-01-2015, 12:40
We're using the old ones.
What programming structure are you using? Iterative, Sample, or Command?
2386programming
30-01-2015, 12:41
We're using an iterative structure
notmattlythgoe
30-01-2015, 12:49
We're using an iterative structure
What you'll want to do is look at the Encoder (http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1Encoder.htm l) class and make sure to configure the distancePerPulse. Then you will pass that encoder into a PIDController (http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1PIDControll er.html) along with the motor you want to control with it.
PIDController leftFrontWheel = new PIDController(p, i, d, leftFrontEncoder, leftFrontTalon);
2386programming
30-01-2015, 16:38
Great thank you! Is there any way that you could help and explain how a PID controller actually works in layman's terms?
Great thank you! Is there any way that you could help and explain how a PID controller actually works in layman's terms?
Watch this video (https://www.youtube.com/watch?v=UOuRx9Ujsog&list=PL8BLGj0RyhMzNXX9gHBosWPRbqqn0gJUQ&index=2).
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.