|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Counter class issues
I am using the counter class as a makeshift encoder. During testing I had the code print out what value the getPeriod function was getting. The print statement however, was only outputting the correct number when the sensor gave a pulse. While there was no pulse it gave me zeroes. Does anyone have any clue as to why this may be happening?
|
|
#2
|
||||
|
||||
|
Re: Counter class issues
getPeriod() would be working as intended. If the encoder is not getting a pulse it means the velocity is zero and thus getPeriod is zero.
Here's the actual source code for the method. 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;
}
Code:
public boolean getStopped() {
return m_counter.readTimerOutput_Stalled();
}
Last edited by MagiChau : 28-01-2013 at 06:23. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|