Go to Post How is it that so many team representatives have the time to run up the post count to astronomical levels in a game hint thread, while so few seem to have the time to say thank you for a $6K gift that funds the ability to play the game? - Rich Kressly [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 19-02-2013, 16:00
mgossman311 mgossman311 is offline
Registered User
FRC #0415
 
Join Date: Feb 2013
Location: SouthCarolina
Posts: 2
mgossman311 is an unknown quantity at this point
Encoder Help

This year our team has decided to use the encoders. However I being one of two programmers for the team have never used the Java language and really need some help with programming the encoders.
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2013, 17:06
shank948 shank948 is offline
VP of Programming - 948
AKA: Stephen Shank
FRC #0948 (NRG (Newport Robotics Group))
Team Role: Alumni
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Bellevue, Wa
Posts: 21
shank948 is an unknown quantity at this point
Re: Encoder Help

I might be able to help. What exactly do you plan to use the encoder for? PID? Distance tracking?
As a starting point you might look at 2013 Java FRC API, specifically the Encoder class.
__________________
If it's green and slimy, it's Biology.
If it smells, it's Chemistry.
If it doesn't work, it's Physics.
- My Physics Teacher

Fixed:
If it doesn't work, it's our Robot up until that last few days of the build season.
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2013, 17:19
mgossman311 mgossman311 is offline
Registered User
FRC #0415
 
Join Date: Feb 2013
Location: SouthCarolina
Posts: 2
mgossman311 is an unknown quantity at this point
Re: Encoder Help

We're are using it to track a distance between the starting point of autonomous and as a reference when we go to shoot the frisbees. If you could help, that would be great.
Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2013, 21:13
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Encoder Help

You need to create the encoder objects using the constructor to provide port numbers:

Code:
Encoder enc;
     .
     .
     .
enc = new Encoder(3,4); // where 3 and 4 are the digital inputs for the 2 channels
enc.start();   // start the encoder counting
     .
     .
     .
int count = enc.get() // get the number of counts
The count will be the number of counts that the encoder object saw. If you know how many counts per revolution (CPR), and the wheel size, and (possibly) the gear ratio, you can compute how far you've gone in "count" counts.

There is a convenience method in the Encoder class that will actually return the distance traveled by the wheel (getDistance()). To use it you first have to first compute the distance traveled per pulse. When you have that number, call enc.setDistancePerPulse(distPerPulse) to "calibrate" the encoder object.

Does this help or are you still unsure?

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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 11:43.

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