RBCX
Library for the RB3204-RBCX board with the ESP32 by RoboticsBrno.
|
Helper class for building the motor change event. More...
#include <RBCXManager.h>
Public Member Functions | |
MotorChangeBuilder () | |
MotorChangeBuilder (const MotorChangeBuilder &o)=delete | |
MotorChangeBuilder (MotorChangeBuilder &&o) | |
~MotorChangeBuilder () | |
MotorChangeBuilder & | power (MotorId id, int16_t value) |
Set single motor power. More... | |
MotorChangeBuilder & | speed (MotorId id, int16_t ticksPerSecond) |
Set single motor power. More... | |
MotorChangeBuilder & | brake (MotorId id, uint16_t brakingPower) |
Start braking. More... | |
MotorChangeBuilder & | pwmMaxPercent (MotorId id, int8_t percent) |
Limit motor index's power to percent. More... | |
MotorChangeBuilder & | drive (MotorId id, int32_t positionRelative, int16_t speedTicksPerSecond, Motor::callback_t callback=nullptr) |
Drive motor to relative position. More... | |
MotorChangeBuilder & | driveToValue (MotorId id, int32_t positionAbsolute, int16_t speedTicksPerSecond, Motor::callback_t callback=nullptr) |
Drive motor to absolute position. More... | |
void | set () |
Finish the changes and submit the events. This method must be called at the end of the motor change event. If the method is not called, the motor change event will not be submitted. More... | |
Helper class for building the motor change event.
rb::MotorChangeBuilder::MotorChangeBuilder | ( | ) |
|
delete |
rb::MotorChangeBuilder::MotorChangeBuilder | ( | MotorChangeBuilder && | o | ) |
rb::MotorChangeBuilder::~MotorChangeBuilder | ( | ) |
MotorChangeBuilder & rb::MotorChangeBuilder::brake | ( | MotorId | id, |
uint16_t | brakingPower | ||
) |
Start braking.
id | of the motor (e.g. rb:MotorId::M1) |
brakingPower | power of the braking, <0, 32767> |
MotorChangeBuilder & rb::MotorChangeBuilder::drive | ( | MotorId | id, |
int32_t | positionRelative, | ||
int16_t | speedTicksPerSecond, | ||
Motor::callback_t | callback = nullptr |
||
) |
Drive motor to relative position.
id | of the motor (e.g. rb:MotorId::M1) |
positionRelative | relative position of the motor in encoder ticks |
speedTicksPerSecond | speed of the motor in encoder ticks <-32768; 32767> |
callback | is a function which will be called when the motor reach the position |
MotorChangeBuilder & rb::MotorChangeBuilder::driveToValue | ( | MotorId | id, |
int32_t | positionAbsolute, | ||
int16_t | speedTicksPerSecond, | ||
Motor::callback_t | callback = nullptr |
||
) |
Drive motor to absolute position.
id | of the motor (e.g. rb:MotorId::M1) |
positionAbsolute | absolute position of the motor in encoder ticks |
speedTicksPerSecond | speed of the motor in encoder ticks <-32768; 32767> |
callback | is a function which will be called when the motor reach the position |
MotorChangeBuilder & rb::MotorChangeBuilder::power | ( | MotorId | id, |
int16_t | value | ||
) |
Set single motor power.
id | of the motor (e.g. rb:MotorId::M1) |
power | of the motor <-32768; 32767> |
MotorChangeBuilder & rb::MotorChangeBuilder::pwmMaxPercent | ( | MotorId | id, |
int8_t | percent | ||
) |
Limit motor index's power to percent.
id | of the motor (e.g. rb:MotorId::M1) |
percent | of the maximal power of the motor <0 - 100> |
void rb::MotorChangeBuilder::set | ( | ) |
Finish the changes and submit the events. This method must be called at the end of the motor change event. If the method is not called, the motor change event will not be submitted.
MotorChangeBuilder & rb::MotorChangeBuilder::speed | ( | MotorId | id, |
int16_t | ticksPerSecond | ||
) |
Set single motor power.
id | of the motor (e.g. rb:MotorId::M1) |
speed | of the motor in encoder ticks <-32768; 32767> |