ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
Loading...
Searching...
No Matches
MOTOR_TASK Class Reference

Finite State Machine for low-level motor control. More...

#include <motor_task.h>

Public Types

enum  state { S0_INIT , S1_IDLE , S2_RUN }
typedef enum MOTOR_TASK::state state_t

Public Member Functions

 MOTOR_TASK ()
 Constructor for the MOTOR_TASK class.
void run (void)
 Executes one iteration of the motor control task.

Detailed Description

Finite State Machine for low-level motor control.

Handles PID control for two motors using encoder feedback. Receives setpoints from higher-level modules (e.g., balance or heading).

Member Enumeration Documentation

◆ state

Enumerator
S0_INIT 

Initialization state.

S1_IDLE 

Idle (standby) state.

S2_RUN 

Active motor control loop.

Constructor & Destructor Documentation

◆ MOTOR_TASK()

MOTOR_TASK::MOTOR_TASK ( )

Constructor for the MOTOR_TASK class.

Initializes the FSM state and configures motor and encoder objects.

Member Function Documentation

◆ run()

void MOTOR_TASK::run ( void )

Executes one iteration of the motor control task.

Executes one iteration of the MOTOR_TASK FSM.

Updates encoder data, applies PID logic, and adjusts PWM outputs.

Manages motor state transitions, runs PID control using encoder feedback, and integrates control efforts from balance and heading modules.


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