Go to Post Anything that moves sideways is a waste of time. - Tom Bottiglieri [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 26-02-2012, 12:18
itsZN itsZN is offline
Code Monkey
AKA: Nick Burnett
FRC #1277 (The Robotomies)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Groton Mass.
Posts: 4
itsZN is an unknown quantity at this point
Tachometer Interrupt Help

Our team currently has a tachometer attached to one of our wheels. We were using it to find the Rpm of the wheel, but the method we were using was very inaccurate, sometimes by up to 260 rpm difference. We decided that the best way to fix this was to cause an interrupt in the code every time the counter for the tachometer pulsed. That way we could measure more accurately. How exactly would we have to set that up so it runs a segment of code whenever the tach pulses?
Thanks for any help!

-Team 1277
Reply With Quote
  #2   Spotlight this post!  
Unread 26-02-2012, 13:41
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Tachometer Interrupt Help

There are interrupts, but my guess is that isn't the best way to solve your problem. It would be better to take advantage of some of the features in the FPGA.

Can you describe your tachometer, what it outputs, and what your code is right now?
Reply With Quote
  #3   Spotlight this post!  
Unread 26-02-2012, 15:26
itsZN itsZN is offline
Code Monkey
AKA: Nick Burnett
FRC #1277 (The Robotomies)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Groton Mass.
Posts: 4
itsZN is an unknown quantity at this point
Re: Tachometer Interrupt Help

Currently, we have a counter hooked up to record the number of pulses from the tachometer, which is triggered by a bolt on the axial of the wheel. Currently, the code takes the finds the average rpm of a half second, based on the number of new ticks on the counter. This doesn't work, because if we get only one tick, it reads 120 rpm, which is a big range for error.

After looking through the wpilibj api again, I found that there was counter.getPeriod(); Which would fix the whole problem most likely. If it does we won't need to use the interrupt.

Thanks Anyway
Reply With Quote
  #4   Spotlight this post!  
Unread 28-02-2012, 11:46
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: Tachometer Interrupt Help

It may be better to use a quaduture encoder thats what we use and use the .getRate(); command
Reply With Quote
  #5   Spotlight this post!  
Unread 02-03-2012, 19:47
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Tachometer Interrupt Help

Quote:
Originally Posted by itsZN View Post
Currently, we have a counter hooked up to record the number of pulses from the tachometer, which is triggered by a bolt on the axial of the wheel. Currently, the code takes the finds the average rpm of a half second, based on the number of new ticks on the counter. This doesn't work, because if we get only one tick, it reads 120 rpm, which is a big range for error.

After looking through the wpilibj api again, I found that there was counter.getPeriod(); Which would fix the whole problem most likely. If it does we won't need to use the interrupt.

Thanks Anyway

have you had any luck with the getPeriod method in the counter class? i've tried it but it doesn't seem to work. it starts out with a value of infinity and never changes when i run it....
__________________
Wendy
Team 3502
Reply With Quote
  #6   Spotlight this post!  
Unread 07-03-2012, 12:50
loafdog loafdog is offline
Registered User
AKA: Maciej
FRC #2876 (DevilBotz)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2009
Location: Burlington, MA
Posts: 33
loafdog is an unknown quantity at this point
Re: Tachometer Interrupt Help

twiggzee, have you tried different speeds when running your device/tach? We found that until our shooter reached a certain speed getPeriod returned infinity. We also used setMaxPeriod to adjust the period so that we could measure shooter revolutions at the lowest speed we would ever use.
I didn't see a way to find out what the original max period value was, either by calling a function or looking at wpilib src code.

-Maciej
Reply With Quote
  #7   Spotlight this post!  
Unread 17-03-2012, 18:38
twiggzee twiggzee is offline
Registered User
FRC #3502 (Octo-(PI)-Rates)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2011
Location: Tallahassee, FL
Posts: 55
twiggzee is an unknown quantity at this point
Re: Tachometer Interrupt Help

Quote:
Originally Posted by loafdog View Post
twiggzee, have you tried different speeds when running your device/tach? We found that until our shooter reached a certain speed getPeriod returned infinity. We also used setMaxPeriod to adjust the period so that we could measure shooter revolutions at the lowest speed we would ever use.
I didn't see a way to find out what the original max period value was, either by calling a function or looking at wpilib src code.

-Maciej

that was it. tried it again, turns out that the getPeriod method only consistently gives a reading when our wheel is spinning more than 1200 rpm. anything below that we get either an "infinity" reading or an occasional reading when approaching 1200 rpm. thanks!
__________________
Wendy
Team 3502
Reply With Quote
  #8   Spotlight this post!  
Unread 17-03-2012, 19:02
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Tachometer Interrupt Help

Quote:
Originally Posted by twiggzee View Post
that was it. tried it again, turns out that the getPeriod method only consistently gives a reading when our wheel is spinning more than 1200 rpm. anything below that we get either an "infinity" reading or an occasional reading when approaching 1200 rpm. thanks!
Maybe Java has a "SetMaxPeriod" like C++ does:

Quote:
/**
* Set the maximum period where the device is still considered "moving".
* Sets the maximum period where the device is considered moving. This value is used to determine
* the "stopped" state of the counter using the GetStopped method.
* @param maxPeriod The maximum period where the counted device is considered moving in
* seconds.
*/
void Counter::SetMaxPeriod(double maxPeriod)
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:49.

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