RBControl
Library for the RB3201-RBControl board with the ESP32 by RoboticsBrno.
Public Member Functions | Friends | List of all members
rb::Encoder Class Reference

#include <RBControl_encoder.hpp>

Public Member Functions

 ~Encoder ()
 
void driveToValue (int32_t positionAbsolute, uint8_t power, std::function< void(Encoder &)> callback=nullptr)
 Drive motor to set position (according absolute value). More...
 
void drive (int32_t positionRelative, uint8_t power, std::function< void(Encoder &)> callback=nullptr)
 Drive motor to set position (according relative value). More...
 
int32_t value ()
 Get number of edges from encoder. More...
 
float speed ()
 Get number of edges per one second. More...
 

Friends

class Manager
 
class Motor
 

Constructor & Destructor Documentation

◆ ~Encoder()

rb::Encoder::~Encoder ( )

Member Function Documentation

◆ drive()

void rb::Encoder::drive ( int32_t  positionRelative,
uint8_t  power,
std::function< void(Encoder &)>  callback = nullptr 
)

Drive motor to set position (according relative value).

Parameters
positionRelativerelative position on which the motor drive
e.g. if the actual motor position (value()) is 1000 and the positionRelative is 100 then the motor will go to position 1100
powermaximal power of the motor when go to set position, allowed values: <0 - 100>
callbackis a function which will be call after the motor arrive to set position [optional]

◆ driveToValue()

void rb::Encoder::driveToValue ( int32_t  positionAbsolute,
uint8_t  power,
std::function< void(Encoder &)>  callback = nullptr 
)

Drive motor to set position (according absolute value).

Parameters
positionAbsoluteabsolute position on which the motor drive
e.g. if the actual motor position (value()) is 1000 and the positionAbsolute is 100 then the motor will go backward to position 100
powermaximal power of the motor when go to set position, allowed values: <0 - 100>
callbackis a function which will be called after the motor arrives to set position [optional]

◆ speed()

float rb::Encoder::speed ( )

Get number of edges per one second.

Returns
The number of counted edges after one second.

◆ value()

int32_t rb::Encoder::value ( )

Get number of edges from encoder.

Returns
The number of counted edges from the first initialize of the encoder Manager::initEncoder

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

◆ Motor

friend class Motor
friend

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