RoboidControl
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Passer::RoboidControl::IncrementalEncoder Class Reference

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>

Public Member Functions

 IncrementalEncoder (unsigned char pulsesPerRevolution=1, unsigned char distancePerRevolution=1)
 Creates a sensor which measures distance from pulses.
 
virtual int GetPulseCount ()
 Get the total number of pulses since the previous call.
 
virtual float GetPulsesPerSecond (float currentTimeMs)
 Get the pulse speed since the previous call.
 
virtual float GetDistance ()
 Get the distance traveled since the previous call.
 
virtual float GetRevolutionsPerSecond (float currentTimeMs)
 Get the rotation speed since the previous call.
 
virtual float GetSpeed (float currentTimeMs)
 Get the speed since the previous call.
 

Public Attributes

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.
 

Detailed Description

An Encoder measures the rotations of an axle using a rotary sensor Some encoders are able to detect direction, while others can not.

Constructor & Destructor Documentation

◆ IncrementalEncoder()

IncrementalEncoder::IncrementalEncoder ( unsigned char  pulsesPerRevolution = 1,
unsigned char  distancePerRevolution = 1 
)

Creates a sensor which measures distance from pulses.

Parameters
pulsesPerRevolutionThe number of pulse edges which make a full rotation
distancePerRevolutionThe distance a wheel travels per full rotation

Member Function Documentation

◆ 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
currentTimeMsThe 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
currentTimeMsThe 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
currentTimeMsThe 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;

Member Data Documentation

◆ 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: