View Single Post
  #2   Spotlight this post!  
Unread 28-01-2013, 06:19
MagiChau's Avatar
MagiChau MagiChau is offline
Registered User
AKA: Michael Chau
FRC #0085 (B.O.B. (Built on Brains))
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Zeeland, Michigan
Posts: 875
MagiChau is just really niceMagiChau is just really niceMagiChau is just really niceMagiChau is just really nice
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;
    }
The counter class will run the getStopped() method if the pulse did not change within x period and set the time to stalled.

Code:
public boolean getStopped() {
        return m_counter.readTimerOutput_Stalled();
    }

Last edited by MagiChau : 28-01-2013 at 06:23.
Reply With Quote