Go to Post Understand that not only can you learn from other experienced engineers, but also mechanics, farmers, and craftsmen. - Andy Baker [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 20-02-2012, 19:31
richwong richwong is offline
Registered User
None #1701 (Robocubs)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Detroit, MI
Posts: 60
richwong is an unknown quantity at this point
Java Encoder Limitation?

Is there a limitation to the number of encoders we can have? When trying to add more than 4 in Java, we get the following exception:

[cRIO] Uncaught exception in Thread.run():
[cRIO] on thread edu.wpi.first.wpilibj.defaultCode.DefaultRobot - main
[cRIO] edu.wpi.first.wpilibj.util.AllocationException: There are no encoders left to allocate
[cRIO] at edu.wpi.first.wpilibj.Encoder.initEncoder(Encoder. java:76)
Reply With Quote
  #2   Spotlight this post!  
Unread 20-02-2012, 21:31
patrickviolette patrickviolette is offline
Registered User
FRC #1318
 
Join Date: Jan 2012
Location: Issaquah, WA
Posts: 8
patrickviolette is an unknown quantity at this point
Re: Java Encoder Limitation?

the quadrature encoders seem to be throwing the exception (line 76 of the Encoder class).

it seems like you can allocate more encoders as long as they are 2x or 1x encoders.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-02-2012, 21:40
patrickviolette patrickviolette is offline
Registered User
FRC #1318
 
Join Date: Jan 2012
Location: Issaquah, WA
Posts: 8
patrickviolette is an unknown quantity at this point
Re: Java Encoder Limitation?

use the constructor Encoder(int sourceA, int sourceB, boolean reversed, EncodingType type) and pass in EncodingType.k2X and you can make as many encoders as you want.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2012, 22:14
richwong richwong is offline
Registered User
None #1701 (Robocubs)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Detroit, MI
Posts: 60
richwong is an unknown quantity at this point
Re: Java Encoder Limitation?

Quote:
Originally Posted by patrickviolette View Post
use the constructor Encoder(int sourceA, int sourceB, boolean reversed, EncodingType type) and pass in EncodingType.k2X and you can make as many encoders as you want.
Worked! Thanks!
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 09:54.

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