Go to Post I lose track of what day it is during build season. - Gary Dillard [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread Yesterday, 19:08
soundfx's Avatar
soundfx soundfx is online now
Registered User
AKA: Aaron J
FRC #3238 (Cyborg Ferrets)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Anacortes, WA
Posts: 22
soundfx is an unknown quantity at this point
Re: Encoder not Reading back .Rate()

I think this may be an issue with the dashboard rather than your code. I believe (though i'm not entirely sure) that if your value contains more digits than fit in the display window, the box is left blank. Try using System.out.println() and the Riolog instead..
__________________


"I got 99 problems but 0.999 ain't 1."
~Orteil
Reply With Quote
  #3   Spotlight this post!  
Unread Yesterday, 21:15
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
Re: Encoder not Reading back .Rate()

+1 Coopertition to you my guy.
Worked perfectly once i rounded to 2 decimal places. Thank you.
__________________
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
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi