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

#include <RBControl_motor.hpp>

Public Member Functions

void power (int8_t value)
 Set motor power. More...
 
void pwmMaxPercent (int8_t percent)
 Limit the maximum PWM value. If you call pwmMaxPercent(70) and then power(100), the motors will spin at 70% of maximum speed. More...
 
int8_t pwmMaxPercent () const
 Get current maximum PWM percent value. More...
 
void stop ()
 Stop motor. More...
 
void driveToValue (int32_t positionAbsolute, uint8_t power, std::function< void(Encoder &)> callback=nullptr)
 Drive motor to set position (according absolute value). See Encoder::driveToValue. More...
 
void drive (int32_t positionRelative, uint8_t power, std::function< void(Encoder &)> callback=nullptr)
 Drive motor to set position (according relative value). See Encoder::drive. More...
 
Encoderencoder ()
 Get the Encoder instance for this motor. See Encoder. More...
 
Encoderenc ()
 Get the Encoder instance for this motor. Same as encoder. More...
 

Friends

class Manager
 
class MotorChangeBuilder
 

Member Function Documentation

◆ drive()

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

Drive motor to set position (according relative value). See Encoder::drive.

◆ driveToValue()

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

Drive motor to set position (according absolute value). See Encoder::driveToValue.

◆ enc()

Encoder* rb::Motor::enc ( )
inline

Get the Encoder instance for this motor. Same as encoder.

◆ encoder()

Encoder * rb::Motor::encoder ( )

Get the Encoder instance for this motor. See Encoder.

◆ power()

void rb::Motor::power ( int8_t  value)

Set motor power.

Parameters
powerof the motor <-100 - 100>

◆ pwmMaxPercent() [1/2]

int8_t rb::Motor::pwmMaxPercent ( ) const
inline

Get current maximum PWM percent value.

◆ pwmMaxPercent() [2/2]

void rb::Motor::pwmMaxPercent ( int8_t  percent)

Limit the maximum PWM value. If you call pwmMaxPercent(70) and then power(100), the motors will spin at 70% of maximum speed.

Parameters
pctof the max value <0 - 100>

◆ stop()

void rb::Motor::stop ( )

Stop motor.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

◆ MotorChangeBuilder

friend class MotorChangeBuilder
friend

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