Thread: Encoder Help
View Single Post
  #2   Spotlight this post!  
Unread 30-01-2017, 11:46
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 408
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Encoder Help

Quote:
Originally Posted by Team5709 View Post
Encoder: Encoder Kit AMT103-V (fc17-033)

they will be wired into the RoboRio. They are mounted on the out put shaft of the drive gear boxes. one on the left and one on the right. There is no gear ratio because its on the out put shaft and not on the motor it self. We are gonna be using arcade drive. The wheels are the 6 inch wheels (http://www.andymark.com/HiGrip-Wheel...?1=1&CartID=0). The motor controllers we are using are the 2015 Talon KOP controllers and those are using PWM.
Check out the screensteps reference: http://wpilib.screenstepslive.com/s/...or-other-shaft

And check out how to configure your encoder's pulses per revolution on the datasheet, page 4 http://www.cui.com/product/resource/amt10.pdf
Keep "maximum rpm" in mind when choosing a value. Choose the highest number of ticks that fits your intended rpm for the best accuracy.

Then you can get distance like this
Code:
Encoder enc = // create encoder as per screensteps
int ticksPerRev = // what you set them to
double diameter = 6.0; // inches
double distancePerRev = diameter * Math.PI;
enc.setDistancePerPulse(distancePerRev / ticksPerRev);

// later
double currentDistance = enc.getDistance(); // in inches
Edit: I'm unfamiliar with the 2015 KOP, but if those are Talon SRX controllers, you're a lot better off using CAN than PWM, because you can connect the encoders directly to Talons for high rate PID control.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org

Last edited by euhlmann : 30-01-2017 at 11:50.
Reply With Quote