RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
robotCore.Encoder Class Reference

The Encoder interface is implemented by classes which track an relative position. More...

Classes

enum  EncoderType
 Specifies the type of encoder. More...

Public Member Functions

EncoderType getType ()
 Encoder (EncoderType type, int pin1, int pin2, int i2cAddr)
 Encoder (EncoderType type, int pin1, int pin2, int i2cAddr, boolean group)
 Encoder (EncoderType type, int pin1, int pin2)
 Encoder (EncoderType type, int pin1, int pin2, boolean group)
int getRange ()
int getEncoderNo ()
int get ()
int getPosition ()
int getSpeed ()
void reset ()
void reset (int position)
void setZero (int zero)
int getZero ()
void setInverted (boolean invert)

Detailed Description

The Encoder interface is implemented by classes which track an relative position.

Author
John Gaby

Definition at line 36 of file Encoder.java.

Constructor & Destructor Documentation

◆ Encoder() [1/5]

robotCore.Encoder.Encoder ( )

Definition at line 191 of file Encoder.java.

◆ Encoder() [2/5]

robotCore.Encoder.Encoder ( EncoderType type,
int pin1,
int pin2,
int i2cAddr )
Parameters
type- Specifies the type of encoder
pin1- Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin
pin2- Specifies the second pin that the encoder uses (Not use if type is simple)
i2cAddr- Address of i2c arduino which reads encoder

Definition at line 202 of file Encoder.java.

◆ Encoder() [3/5]

robotCore.Encoder.Encoder ( EncoderType type,
int pin1,
int pin2,
int i2cAddr,
boolean group )
Parameters
type- Specifies the type of encoder
pin1- Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin
pin2- Specifies the second pin that the encoder uses (Not use if type is simple)
i2cAddr- Address of i2c microcontroller which reads encoder
group- If this is true, then the reading of the position for this encoder is grouped with other encoders so that a single read will read multiple values. This is done to reduce the i2c speed bottleneck.

Definition at line 219 of file Encoder.java.

◆ Encoder() [4/5]

robotCore.Encoder.Encoder ( EncoderType type,
int pin1,
int pin2 )
Parameters
type- Specifies the type of encoder
pin1- Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin
pin2- Specifies the second pin that the encoder uses (Not use if type is simple)

Definition at line 230 of file Encoder.java.

◆ Encoder() [5/5]

robotCore.Encoder.Encoder ( EncoderType type,
int pin1,
int pin2,
boolean group )
Parameters
type- Specifies the type of encoder
pin1- Specifies the first pin that the encoder uses. If it is a quadrature encoder, this must be the interrupt pin
pin2- Specifies the second pin that the encoder uses (Not use if type is simple)
group- If this is true, then the reading of the position for this encoder is grouped with other encoders so that a single read will read multiple values. This is done to reduce the i2c speed bottleneck.

Definition at line 246 of file Encoder.java.

Member Function Documentation

◆ get()

int robotCore.Encoder.get ( )

Gets the current encoder value

Returns
Returns the current position or speed. In the case of a Rotational encoder the angle is returned in hundredths of a degree

Definition at line 273 of file Encoder.java.

◆ getEncoderNo()

int robotCore.Encoder.getEncoderNo ( )

Definition at line 262 of file Encoder.java.

◆ getPosition()

int robotCore.Encoder.getPosition ( )

Gets the current encoder value

Returns
Returns the current position

Definition at line 298 of file Encoder.java.

◆ getRange()

int robotCore.Encoder.getRange ( )

Gets the range for the angle encoder

Returns
Returns the range for the angle encoder. This is the number that represents 360 degrees. Note that if the encoder is not an absolute angle encoder this function returns zero.

Definition at line 257 of file Encoder.java.

◆ getSpeed()

int robotCore.Encoder.getSpeed ( )

Gets the current encoder value

Returns
Returns the current speed

Definition at line 313 of file Encoder.java.

◆ getType()

EncoderType robotCore.Encoder.getType ( )

Definition at line 105 of file Encoder.java.

◆ getZero()

int robotCore.Encoder.getZero ( )

Definition at line 352 of file Encoder.java.

◆ reset() [1/2]

void robotCore.Encoder.reset ( )

Resets the encoder to zero

Definition at line 328 of file Encoder.java.

◆ reset() [2/2]

void robotCore.Encoder.reset ( int position)

Resets the encoder to the specified position.

Parameters
position- Specifies the position to set. In the case of the Rotational encoder this should be the angle in encoder units.

Definition at line 338 of file Encoder.java.

◆ setInverted()

void robotCore.Encoder.setInverted ( boolean invert)
Parameters
invert= If True, the count and speed directions are reversed

Definition at line 360 of file Encoder.java.

◆ setZero()

void robotCore.Encoder.setZero ( int zero)

Sets the zero position for an AnalogRotational encoder.

Parameters
zero- Specifies the encoder value for when the encoder is at it's zero position.

Definition at line 348 of file Encoder.java.


The documentation for this class was generated from the following file: