An Encoder measures the rotations of an axle using a rotary sensor Some encoders are able to detect direction, while others can not.
More...
#include <IncrementalEncoder.h>
|
unsigned char | pulsesPerRevolution = 1 |
| The numer of pulses corresponding to a full rotation of the axle.
|
|
unsigned char | distancePerRevolution = 1 |
| The number of revolutions which makes the wheel move forward 1 meter.
|
|
An Encoder measures the rotations of an axle using a rotary sensor Some encoders are able to detect direction, while others can not.
◆ IncrementalEncoder()
IncrementalEncoder::IncrementalEncoder |
( |
unsigned char |
pulsesPerRevolution = 1 , |
|
|
unsigned char |
distancePerRevolution = 1 |
|
) |
| |
Creates a sensor which measures distance from pulses.
- Parameters
-
pulsesPerRevolution | The number of pulse edges which make a full rotation |
distancePerRevolution | The distance a wheel travels per full rotation |
◆ GetPulseCount()
int IncrementalEncoder::GetPulseCount |
( |
| ) |
|
|
virtual |
Get the total number of pulses since the previous call.
- Returns
- The number of pulses, is zero or greater
◆ GetPulsesPerSecond()
float IncrementalEncoder::GetPulsesPerSecond |
( |
float |
currentTimeMs | ) |
|
|
virtual |
Get the pulse speed since the previous call.
- Parameters
-
currentTimeMs | The clock time in milliseconds |
- Returns
- The average pulses per second in the last period.
◆ GetDistance()
float IncrementalEncoder::GetDistance |
( |
| ) |
|
|
virtual |
Get the distance traveled since the previous call.
- Returns
- The distance in meters.
◆ GetRevolutionsPerSecond()
float IncrementalEncoder::GetRevolutionsPerSecond |
( |
float |
currentTimeMs | ) |
|
|
virtual |
Get the rotation speed since the previous call.
- Parameters
-
currentTimeMs | The clock time in milliseconds |
- Returns
- The speed in rotations per second
◆ GetSpeed()
float IncrementalEncoder::GetSpeed |
( |
float |
currentTimeMs | ) |
|
|
virtual |
Get the speed since the previous call.
- Parameters
-
currentTimeMs | The clock time in milliseconds |
- Returns
- The speed in meters per second.
- Note
- this value is dependent on the accurate setting of the pulsesPerRevolution and distancePerRevolution parameters;
◆ pulsesPerRevolution
unsigned char Passer::RoboidControl::IncrementalEncoder::pulsesPerRevolution = 1 |
The numer of pulses corresponding to a full rotation of the axle.
◆ distancePerRevolution
unsigned char Passer::RoboidControl::IncrementalEncoder::distancePerRevolution = 1 |
The number of revolutions which makes the wheel move forward 1 meter.
The documentation for this class was generated from the following files: