RoboJDETM v2.0

com.ridgesoft.intellibrain
Class IntelliBrainShaftEncoder

java.lang.Object
  extended by com.ridgesoft.intellibrain.IntelliBrainShaftEncoder
All Implemented Interfaces:
ShaftEncoder

public class IntelliBrainShaftEncoder
extends Object
implements ShaftEncoder

IntelliBrain specific quadrature shaft encoder reader.

Each shaft encoder uses a pair of digital inputs to implement a quadrature shaft encoder. The two pins should be connected to two digital sensors that generate a quadrature signal. The two sensors should be 90 degrees out of phase. If the counter counts in the opposite direction of what is expected, swap the two inputs.

Shaft encoders on the IntelliBrain robotics controller are sampled once per millisecond. Therefore, the maximum counting rate which is supported is 500 counts per second.


Method Summary
 int getCounts()
          Reads the current shaft encoder counter value.
 int getRate()
          Read the current rate of the encoder counter.
 void initialize(IntelliBrainDigitalIO port1, IntelliBrainDigitalIO port2)
          Initializes the encoder.
 String toString()
          Returns a String with the decimal value of the encoder counter.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait
 

Method Detail

getCounts

public int getCounts()
Reads the current shaft encoder counter value.

Specified by:
getCounts in interface ShaftEncoder
Returns:
counter value

getRate

public int getRate()
Read the current rate of the encoder counter.

Shaft encoders on the IntelliBrain robotics controller are sampled once per millisecond. Therefore, the maximum rate which is supported is 500 counts per second. The maximum value this function can return is 7.

Specified by:
getRate in interface ShaftEncoder
Returns:
the number of counts in the last 128 millisecond sample period

initialize

public void initialize(IntelliBrainDigitalIO port1,
                       IntelliBrainDigitalIO port2)
Initializes the encoder.

Parameters:
port1 - digital input port for the one quadrature signal
port2 - digital input port for the other quadrature signal

toString

public String toString()
Returns a String with the decimal value of the encoder counter.

Overrides:
toString in class Object
Returns:
string representation of this object

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com