JMotor
|
defines common interface for JEncoder More...
#include <JEncoder.h>
Public Member Functions | |
virtual void | setRev (bool _rev) |
empty function for directionless encoders to override | |
virtual long | zeroCounter () |
reset the counter of how far the encoder has turned | |
virtual float | getVel () |
calculates velocity in distance per second where distance was set by setdistPerCountFactor() | |
virtual long | getCounter () |
returns how far the encoder has turned from the zero position | |
virtual float | getPos () |
returns how far the encoder has turned from the zero position converted to distance | |
virtual float | getDistPerCountFactor () |
returns a conversion factor between encoder ticks and distance that can be set for the encoder | |
virtual void | setDistPerCountFactor (float _factor) |
set the conversion factor between encoder ticks and distance | |
virtual bool | hasDirection () |
can this encoder measure direction or just speed | |
virtual bool | isVelNew () |
could be useful for only recalculating a control loop if there's new velocity data | |
virtual void | run () |
if an encoder needs to have some code called each loop (like absolute encoder polling encoder and calculating amount turned) | |
defines common interface for JEncoder
|
virtual |
returns how far the encoder has turned from the zero position
(long) | encoder ticks |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
returns a conversion factor between encoder ticks and distance that can be set for the encoder
(float) | distPerCountFactor |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
returns how far the encoder has turned from the zero position converted to distance
(float) | encoder ticks converted to distance |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
calculates velocity in distance per second where distance was set by setdistPerCountFactor()
(float) | velocity |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
can this encoder measure direction or just speed
(bool) | true = can measure direction |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
could be useful for only recalculating a control loop if there's new velocity data
(bool) | true if velocity has changed since this function was last called |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
if an encoder needs to have some code called each loop (like absolute encoder polling encoder and calculating amount turned)
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
virtual |
set the conversion factor between encoder ticks and distance
_factor | (float) |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.
|
inlinevirtual |
empty function for directionless encoders to override
Reimplemented in JEncoderSingle.
|
virtual |
reset the counter of how far the encoder has turned
(long) | returns value of counter before it is reset |
Reimplemented in JEncoderAS5048bI2C, JEncoderAS5600I2C, JEncoderBSED, JEncoderPWMAbsolute, JEncoderQuadrature, and JEncoderSingle.