|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
60 / getPeriod() returns 3,000,000
We have encountered a problem where doing this:
Code:
double getRate() {
return 60 / counter.getPeriod();
}
This is getPeriod(): Code:
public double getPeriod() {
double period;
if (m_counter.readTimerOutput_Stalled()) {
return Double.POSITIVE_INFINITY;
} else {
period = (double) m_counter.readTimerOutput_Period() / (double) m_counter.readTimerOutput_Count();
}
return period / 1.0e6;
}
|
|
#2
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
How fast is your wheel spinning when this glitch happens? |
|
#3
|
|||
|
|||
|
Re: 60 / getPeriod() returns 3,000,000
4500rpm for both questions. It gets to the setpoint far before the glitch happens.
|
|
#4
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
|
|
#5
|
|||
|
|||
|
Re: 60 / getPeriod() returns 3,000,000
We've tested at the 20ms periodic methods (removed all other code), and still seen the problem.
|
|
#6
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
Can you post a picture of how you have the magnet mounted to the wheel. Working hypothesis: vibration is randomly causing the sensor to read the rising edge twice. |
|
#7
|
|||
|
|||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
|
|
#8
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
Also, it looks like the Hall end of the PCB is unsupported and the Hall chip is dangling at the end of its long leads. It could be vibrating. Try stuffing some tissue paper under the leads to dampen it and see if it makes a difference. Easy enough to try. |
|
#9
|
|||
|
|||
|
Re: 60 / getPeriod() returns 3,000,000
Here's an album.
We'll try and dampen the vibration. Right now that seems to be the most likely cause. |
|
#10
|
|||||
|
|||||
|
Re: 60 / getPeriod() returns 3,000,000
You definitely don't have the Hall sensor oriented correctly. The "flat" part of the sensor should be perpendicular to the magnet. If you don't bend anything, then the correct orientation is with your mounting board parallel to the face your magnets are mounted on. Preferably with all those components on the side facing the wheel.
Or, you can bend the Hall sensor backwards, towards the back of the mounting board, away from the side all the components are mounted from. (30 seconds later) EDIT: Also, why not put something in your GetRate function that tosses out obviously incorrect values like a period less than 0.0001 seconds or something? |
|
#11
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
But if you do filter out the glitches in software, then increment an error counter each time it happens. Monitor that error counter during non-competition use to make sure it isn't getting worse and worse over time. |
|
#12
|
|||
|
|||
|
Re: 60 / getPeriod() returns 3,000,000
Thanks guys. We mounted it horizontally and added tissue to relieve vibration. The bug hasn't come up since. We're actually within 2-5rpm from our setpoint, which is awesome.
|
|
#13
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
|
|
#14
|
||||
|
||||
|
Re: 60 / getPeriod() returns 3,000,000
agrees well with a simple ballpark calculation:
Last edited by Ether : 09-02-2013 at 18:59. |
|
#15
|
|||||
|
|||||
|
Re: 60 / getPeriod() returns 3,000,000
Quote:
EDIT: We're using LabVIEW, and the Counter class's Period output (from the Get.vi). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|