Class DRVMotor
Motor driver for the DRV8833 H-bridge IC.
#include <motor.hpp>
Inherits the following classes: Motor
Public Functions
| Type | Name |
|---|---|
| DRVMotor (int pi, int in1, int in2, int frequency, MotorType motor_type) |
|
| virtual void | coast () override Let the motor coast (no braking force). |
| virtual void | forward (float duty) override Drive forward at the given PWM duty cycle [0, 1]. |
| virtual void | hard_brake () override Apply electronic braking immediately. |
| virtual void | reverse (float duty) override Drive in reverse at the given PWM duty cycle [0, 1]. |
| virtual void | set_speed (float speed) override Set motor speed in [-1, 1] (negative = reverse). |
Public Functions inherited from Motor
See Motor
| Type | Name |
|---|---|
| virtual void | coast () = 0 Let the motor coast (no braking force). |
| virtual void | forward (float duty) = 0 Drive forward at the given PWM duty cycle [0, 1]. |
| virtual void | hard_brake () = 0 Apply electronic braking immediately. |
| virtual void | reverse (float duty) = 0 Drive in reverse at the given PWM duty cycle [0, 1]. |
| virtual void | set_speed (float speed) = 0 Set motor speed in [-1, 1] (negative = reverse). |
| virtual | ~Motor () = default |
Public Functions Documentation
function DRVMotor
DRVMotor::DRVMotor (
int pi,
int in1,
int in2,
int frequency,
MotorType motor_type
)
Parameters:
pipigpio instance handlein1GPIO pin for IN1in2GPIO pin for IN2frequencyPWM frequency in Hzmotor_typeWhich side this motor drives
function coast
Let the motor coast (no braking force).
virtual void DRVMotor::coast () override
Implements Motor::coast
function forward
Drive forward at the given PWM duty cycle [0, 1].
virtual void DRVMotor::forward (
float duty
) override
Implements Motor::forward
function hard_brake
Apply electronic braking immediately.
virtual void DRVMotor::hard_brake () override
Implements Motor::hard_brake
function reverse
Drive in reverse at the given PWM duty cycle [0, 1].
virtual void DRVMotor::reverse (
float duty
) override
Implements Motor::reverse
function set_speed
Set motor speed in [-1, 1] (negative = reverse).
virtual void DRVMotor::set_speed (
float speed
) override
Implements Motor::set_speed
The documentation for this class was generated from the following file controls/sae_2025_ws/src/payload/include/payload/motor.hpp