RBCX
Library for the RB3204-RBCX board with the ESP32 by RoboticsBrno.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rb::MotorChangeBuilder Class Reference

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 ()
 
MotorChangeBuilderpower (MotorId id, int16_t value)
 Set single motor power. More...
 
MotorChangeBuilderspeed (MotorId id, int16_t ticksPerSecond)
 Set single motor power. More...
 
MotorChangeBuilderbrake (MotorId id, uint16_t brakingPower)
 Start braking. More...
 
MotorChangeBuilderpwmMaxPercent (MotorId id, int8_t percent)
 Limit motor index's power to percent. More...
 
MotorChangeBuilderdrive (MotorId id, int32_t positionRelative, int16_t speedTicksPerSecond, Motor::callback_t callback=nullptr)
 Drive motor to relative position. More...
 
MotorChangeBuilderdriveToValue (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...
 

Detailed Description

Helper class for building the motor change event.

Constructor & Destructor Documentation

◆ MotorChangeBuilder() [1/3]

rb::MotorChangeBuilder::MotorChangeBuilder ( )

◆ MotorChangeBuilder() [2/3]

rb::MotorChangeBuilder::MotorChangeBuilder ( const MotorChangeBuilder o)
delete

◆ MotorChangeBuilder() [3/3]

rb::MotorChangeBuilder::MotorChangeBuilder ( MotorChangeBuilder &&  o)

◆ ~MotorChangeBuilder()

rb::MotorChangeBuilder::~MotorChangeBuilder ( )

Member Function Documentation

◆ brake()

MotorChangeBuilder & rb::MotorChangeBuilder::brake ( MotorId  id,
uint16_t  brakingPower 
)

Start braking.

Parameters
idof the motor (e.g. rb:MotorId::M1)
brakingPowerpower of the braking, <0, 32767>

◆ drive()

MotorChangeBuilder & rb::MotorChangeBuilder::drive ( MotorId  id,
int32_t  positionRelative,
int16_t  speedTicksPerSecond,
Motor::callback_t  callback = nullptr 
)

Drive motor to relative position.

Parameters
idof the motor (e.g. rb:MotorId::M1)
positionRelativerelative position of the motor in encoder ticks
speedTicksPerSecondspeed of the motor in encoder ticks <-32768; 32767>
callbackis a function which will be called when the motor reach the position
Returns
MotorChangeBuilder

◆ driveToValue()

MotorChangeBuilder & rb::MotorChangeBuilder::driveToValue ( MotorId  id,
int32_t  positionAbsolute,
int16_t  speedTicksPerSecond,
Motor::callback_t  callback = nullptr 
)

Drive motor to absolute position.

Parameters
idof the motor (e.g. rb:MotorId::M1)
positionAbsoluteabsolute position of the motor in encoder ticks
speedTicksPerSecondspeed of the motor in encoder ticks <-32768; 32767>
callbackis a function which will be called when the motor reach the position
Returns
MotorChangeBuilder

◆ power()

MotorChangeBuilder & rb::MotorChangeBuilder::power ( MotorId  id,
int16_t  value 
)

Set single motor power.

Parameters
idof the motor (e.g. rb:MotorId::M1)
powerof the motor <-32768; 32767>

◆ pwmMaxPercent()

MotorChangeBuilder & rb::MotorChangeBuilder::pwmMaxPercent ( MotorId  id,
int8_t  percent 
)

Limit motor index's power to percent.

Parameters
idof the motor (e.g. rb:MotorId::M1)
percentof the maximal power of the motor <0 - 100>

◆ set()

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.

◆ speed()

MotorChangeBuilder & rb::MotorChangeBuilder::speed ( MotorId  id,
int16_t  ticksPerSecond 
)

Set single motor power.

Parameters
idof the motor (e.g. rb:MotorId::M1)
speedof the motor in encoder ticks <-32768; 32767>

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