ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
|
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. |
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).
enum MOTOR_TASK::state |
MOTOR_TASK::MOTOR_TASK | ( | ) |
Constructor for the MOTOR_TASK class.
Initializes the FSM state and configures motor and encoder objects.
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.