#include <RBCXMotor.h>
|
| MotorId | id () const |
| |
| int32_t | position () const |
| |
| void | requestInfo (callback_t cb) |
| |
| void | power (int16_t value) |
| | Set motor power. More...
|
| |
| void | speed (int16_t ticksPerSecond) |
| | Set motor speed. More...
|
| |
| void | brake (uint16_t brakingPower) |
| | Start braking. 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. This scales both the power and speed set through Motor. More...
|
| |
| int8_t | pwmMaxPercent () const |
| | Get current maximum PWM percent value. More...
|
| |
| void | driveToValue (int32_t positionAbsolute, int16_t speedTicksPerSecond, callback_t callback=nullptr) |
| | Drive motor to set position (according absolute value). More...
|
| |
| void | drive (int32_t positionRelative, int16_t speedTicksPerSecond, callback_t callback=nullptr) |
| | Drive motor to set position (according relative value). More...
|
| |
| void | setCurrentPosition (int32_t pos=0) |
| | Set the encoder tick counter to some value. More...
|
| |
| void | setConfig (const MotorConfig &cfg) |
| | Set configuration, see MotorConfig & STM32 firmware. More...
|
| |
◆ callback_t
◆ brake()
| void rb::Motor::brake |
( |
uint16_t |
brakingPower | ) |
|
Start braking.
- Parameters
-
| brakingPower | braking power in <0, 32767> |
◆ drive()
| void rb::Motor::drive |
( |
int32_t |
positionRelative, |
|
|
int16_t |
speedTicksPerSecond, |
|
|
callback_t |
callback = nullptr |
|
) |
| |
Drive motor to set position (according relative value).
- Parameters
-
| 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 |
- Returns
- MotorChangeBuilder
- Note
- If you call drive(100, 100) and then drive(100, 100), the motor will drive to 200 ticks. If you call drive(100, 100) and then drive(-100, 100), the motor will drive to 0 ticks.
◆ driveToValue()
| void rb::Motor::driveToValue |
( |
int32_t |
positionAbsolute, |
|
|
int16_t |
speedTicksPerSecond, |
|
|
callback_t |
callback = nullptr |
|
) |
| |
Drive motor to set position (according absolute value).
- Parameters
-
| 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 |
- Returns
- MotorChangeBuilder
◆ id()
◆ position()
| int32_t rb::Motor::position |
( |
| ) |
const |
|
inline |
◆ power()
| void rb::Motor::power |
( |
int16_t |
value | ) |
|
Set motor power.
- Parameters
-
| power | of the motor <-32768; 32767> |
◆ pwmMaxPercent() [1/2]
| int8_t rb::Motor::pwmMaxPercent |
( |
| ) |
const |
|
inline |
Get current maximum PWM percent value.
- Returns
- 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. This scales both the power and speed set through Motor.
- Parameters
-
| pct | of the max value <0 - 100> |
◆ requestInfo()
◆ setConfig()
| void rb::Motor::setConfig |
( |
const MotorConfig & |
cfg | ) |
|
Set configuration, see MotorConfig & STM32 firmware.
- Parameters
-
◆ setCurrentPosition()
| void rb::Motor::setCurrentPosition |
( |
int32_t |
pos = 0 | ) |
|
Set the encoder tick counter to some value.
- Parameters
-
| pos | new position of the motor in encoder ticks |
◆ speed()
| void rb::Motor::speed |
( |
int16_t |
ticksPerSecond | ) |
|
Set motor speed.
- Parameters
-
| ticksPerSecond | speed of the motor <-32768; 32767> |
◆ Manager
◆ MotorChangeBuilder
The documentation for this class was generated from the following files: