View Single Post
  #1   Spotlight this post!  
Unread Yesterday, 18:27
BlacksmithWoods's Avatar
BlacksmithWoods BlacksmithWoods is offline
Mechanics / CAD
AKA: Brendan Woods
FRC #0806 (The Brooklyn Blacksmiths)
Team Role: Mentor
 
Join Date: Sep 2011
Rookie Year: 2010
Location: Brooklyn, New York
Posts: 69
BlacksmithWoods is on a distinguished road
Encoder not Reading back .Rate()

Hello from team 806.

Our programmer is being beaten by a simple encoder.
We've been using them for years and have never had problems with them before.

We ordered a CimCoder from andymark to give us a RPM readout for our launcher wheels but we're having trouble.
We can call our encoder .getRaw() and .getDistance() and we're getting reasonable numbers, so we know it's hooked up correctly. But when we call .getRate or .getPeriod(which i know is no longer used, but we were debugging) we get just blank back while the motor is running, and 0 while the motor is stopped. It returns no numbers, just blank. .getPeriod() is similar but instead of 0 we get infinite.

Here are the relevant pieces of my code.

Code:
//declaration
Encoder LauncherEnc;

//this is in robotInit
LauncherEnc = new Encoder(0, 1, true, EncodingType.k2X);

LauncherEnc.setMaxPeriod(.5);
LauncherEnc.setMinRate(10);
LauncherEnc.setDistancePerPulse(20);
LauncherEnc.setReverseDirection(true);
LauncherEnc.setSamplesToAverage(6);

//this is in the teleoploop
SmartDashboard.putString("DB/String 0", "Launch Encoder = " + LauncherEnc.getRate();	)
Thanks for any help, this problem has been killing us.
__________________
2002 - Present FRC (806)

Keeping It Stupidly Simple since 2002
"You are done with designing something, not when there's nothing more to add, but when there's nothing left to remove." - EricH
NYC FRC STLA (2011- 2014) Practice Field / Alumni Relations
Reply With Quote