#include <arpirobot/arduino/sensor/QuadEncoder.hpp>
|
| QuadEncoder (int pinA, int pinB, bool useInternalPullup, bool createDevice=true, int deviceId=-1) |
|
| QuadEncoder (std::string pinA, int pinB, bool useInternalPullup, bool createDevice=true, int deviceId=-1) |
|
| QuadEncoder (int pinA, std::string pinB, bool useInternalPullup, bool createDevice=true, int deviceId=-1) |
|
| QuadEncoder (std::string pinA, std::string pinB, bool useInternalPullup, bool createDevice=true, int deviceId=-1) |
|
int32_t | getPosition () |
|
void | setPosition (int32_t currentPosition) |
|
float | getVelocity () |
|
| ArduinoDevice (bool createDevice, int deviceId) |
|
virtual std::string | getDeviceName () |
|
|
void | applyDefaultState () override |
|
std::vector< uint8_t > | getCreateData () override |
|
void | handleData (const std::vector< uint8_t > &data) override |
|
void | setArduino (BaseArduinoInterface *arduino) |
|
void | setDeviceId (int deviceId) |
|
bool | sendData (const std::vector< uint8_t > &data) |
|
bool | sendData (const std::string &data) |
|
|
static std::vector< uint8_t > | stringToData (const std::string &str) |
|
bool | createDevice |
|
int | deviceId |
|
std::string | deviceName |
|
BaseArduinoInterface * | arduino = nullptr |
|
Quadrature encoder encoder (two channels)
◆ QuadEncoder() [1/4]
arpirobot::QuadEncoder::QuadEncoder |
( |
int |
pinA, |
|
|
int |
pinB, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pinA | The digital pin number channel A is connected to |
pinB | The digital pin number channel B is connected to |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ QuadEncoder() [2/4]
arpirobot::QuadEncoder::QuadEncoder |
( |
std::string |
pinA, |
|
|
int |
pinB, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pinA | The pin number channel A is connected to (prefix with letter A for analog pin) |
pinB | The digital pin number channel B is connected to |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ QuadEncoder() [3/4]
arpirobot::QuadEncoder::QuadEncoder |
( |
int |
pinA, |
|
|
std::string |
pinB, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pinA | The digital pin number channel A is connected to |
pinB | The pin number channel B is connected to (prefix with letter A for analog pin) |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ QuadEncoder() [4/4]
arpirobot::QuadEncoder::QuadEncoder |
( |
std::string |
pinA, |
|
|
std::string |
pinB, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pinA | The pin number channel A is connected to (prefix with letter A for analog pin) |
pinB | The pin number channel B is connected to (prefix with letter A for analog pin) |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ getPosition()
int32_t arpirobot::QuadEncoder::getPosition |
( |
| ) |
|
Get the position (tick count) for this encoder
- Returns
- The position in ticks
◆ getVelocity()
float arpirobot::QuadEncoder::getVelocity |
( |
| ) |
|
Get the current velocity from the encoder
- Returns
- The speed in ticks / sec
◆ setPosition()
void arpirobot::QuadEncoder::setPosition |
( |
int32_t |
currentPosition | ) |
|
Set the current tick count to the given value
- Parameters
-
currentPosition | The new tick value to set |
The documentation for this class was generated from the following file: