Go to Post If robotics is bad for you, well then I guess I'm gonna die. At least I'll die happy. - karinka13 [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 11-02-2014, 19:11
RoboNerd01's Avatar
RoboNerd01 RoboNerd01 is offline
Super User
AKA: Austin Rowe
FRC #3604 (Goon Squad)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Woodhaven
Posts: 11
RoboNerd01 is an unknown quantity at this point
Angry Digital input lag!

I've been trying to use a hall effect sensor and a magnet to measure pulsed from a spinning wheel. But the cRio seems to not respond fast enough to pick up all the pulses. I started clean, and still the problem remains. Has anyone else had this problem? I need help.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2014, 19:36
calcmogul's Avatar
calcmogul calcmogul is offline
WPILib Developer
AKA: Tyler Veness
FRC #3512 (Spartatroniks)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Santa Maria, CA
Posts: 52
calcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nice
Re: Digital input lag!

Rather than using a DigitalInput, I recommend using a Counter instead. It counts up all of the pulses coming from a DIO for you in the FPGA.

In C++, the RPM can be found with "60.0/GetPeriod()" where GetPeriod() is a function in the Counter class which returns the time between pulses in seconds. If there is more than one pulse per revolution, you would use "60.0/(pulsesPerRev * GetPeriod())".

That's the general idea, but the implementation varies depending on which language you are using.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2014, 19:57
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Digital input lag!

Quote:
Originally Posted by RoboNerd01 View Post
I've been trying to use a hall effect sensor and a magnet to measure pulsed from a spinning wheel. But the cRio seems to not respond fast enough to pick up all the pulses. I started clean, and still the problem remains. Has anyone else had this problem? I need help.
The problem is that your robot code loop runs a lot slower (20 ms) than your sensor is sending the signal. The FPGA can sample way faster than that (> 10,000 pules per second), and can be accessed by using a counter and calling the counter.getPeriod() method to get the time between pulses.

If you're planning to use this rpm for some type of control loop, you may notice that the reported speed seems to fluctuate. If this happens you can make the FPGA average the last couple of samples to get a better reading.
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 18:31.

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