#include <motors.h>
|
| static void | enable_deep_sleep_hold () |
| | Sets up the motor speed pins to stay low when the ESP32 goes into deep sleep mode.
|
◆ motor_direction_t
| Enumerator |
|---|
| FORWARD | |
| BACKWARD | |
◆ motor_id_t
◆ Motors()
| Device::Motors::Motors |
( |
Robot & | robot | ) |
|
|
explicit |
◆ ~Motors()
| Device::Motors::~Motors |
( |
| ) |
|
◆ _set_direction()
Physically sets the direction of the given motor.
- Warning
- Should never be used by any task except the ramp task
- Parameters
-
| motor_id | The id of the motor of which to set the direction |
| direction | The target direction to set the motor to |
◆ _set_speed()
| void Device::Motors::_set_speed |
( |
motor_id_t | motor_id, |
|
|
uint16_t | speed ) const |
Physically sets the speed of the given motor.
- Warning
- Should never be used by any task except the ramp task
- Note
- The motor will immediately begin turning at that exact speed
- Parameters
-
| motor_id | The id of the motor of which to set the speed |
| speed | The target speed to set the motor to |
◆ enable_deep_sleep_hold()
| void Device::Motors::enable_deep_sleep_hold |
( |
| ) |
|
|
static |
Sets up the motor speed pins to stay low when the ESP32 goes into deep sleep mode.
◆ hard_stop()
| void Device::Motors::hard_stop |
( |
motor_id_t | motor_id | ) |
const |
Stops the given motor abruptly without ramping.
- Parameters
-
| motor_id | The id of the motor to stop |
◆ initialize()
| void Device::Motors::initialize |
( |
| ) |
|
Sets up the necessary GPIO pins and LEDC channels.
◆ set_direction()
Sets the virtual direction of the given motor.
- Parameters
-
| motor_id | The id of the motor of which to set the direction |
| direction | The target direction to set the motor to |
| ramp_time | The time to take when ramping to that speed (default: DEFAULT_RAMP_TIME_MS) |
◆ set_speed()
Sets the speed of the given motor toward which it should accelerate.
- Note
- The motor will immediately begin accelerating towards the specified speed
- Parameters
-
| motor_id | The id of the motor of which to set the speed |
| speed | The target speed to set the motor to |
| ramp_time | The time to take when ramping to that speed (default: DEFAULT_RAMP_TIME_MS) |
◆ stop()
Stops the given motor by gradually reducing speed for a smooth stop.
- Parameters
-
| motor_id | The id of the motor to stop |
| ramp_time | The time to take when ramping to that speed (default: DEFAULT_RAMP_TIME_MS) |
◆ DEFAULT_RAMP_TIME_MS
| uint16_t Device::Motors::DEFAULT_RAMP_TIME_MS = 1000 |
|
staticconstexpr |
◆ MAX_MOTOR_SPEED
| uint16_t Device::Motors::MAX_MOTOR_SPEED = 820 |
|
staticconstexpr |
◆ MIN_RAMP_TIME_MS
| uint16_t Device::Motors::MIN_RAMP_TIME_MS = 100 |
|
staticconstexpr |
◆ NUM_MOTORS
| uint8_t Device::Motors::NUM_MOTORS = 2 |
|
staticconstexpr |
The documentation for this class was generated from the following files: