Skip to content

Class SNMotor

ClassList > SNMotor

  • #include <motor.hpp>

Inherits the following classes: Motor

Public Functions

Type Name
SNMotor (int pi, int pwm_pin, 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 SNMotor

SNMotor::SNMotor (
    int pi,
    int pwm_pin,
    int in1,
    int in2,
    int frequency,
    MotorType motor_type
) 

function coast

Let the motor coast (no braking force).

virtual void SNMotor::coast () override

Implements Motor::coast


function forward

Drive forward at the given PWM duty cycle [0, 1].

virtual void SNMotor::forward (
    float duty
) override

Implements Motor::forward


function hard_brake

Apply electronic braking immediately.

virtual void SNMotor::hard_brake () override

Implements Motor::hard_brake


function reverse

Drive in reverse at the given PWM duty cycle [0, 1].

virtual void SNMotor::reverse (
    float duty
) override

Implements Motor::reverse


function set_speed

Set motor speed in [-1, 1] (negative = reverse).

virtual void SNMotor::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