ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
|
Finite State Machine for heading control based on IMU data. More...
#include <heading.h>
Public Types | |
enum | state { S0_INIT , S1_IDLE , S2_RUN } |
typedef enum HEADING::state | state_t |
Public Member Functions | |
HEADING () | |
Constructor for the HEADING class. | |
int32_t | get_M1_eff (void) |
Retrieves the motor 1 effort calculated by the heading controller. | |
int32_t | get_M2_eff (void) |
Retrieves the motor 2 effort calculated by the heading controller. | |
void | run (void) |
Executes one iteration of the heading FSM and PID controller. |
Finite State Machine for heading control based on IMU data.
Uses a PID control loop to drive motor efforts to reduce heading error.
enum HEADING::state |
HEADING::HEADING | ( | ) |
Constructor for the HEADING class.
Initializes FSM state to S0_INIT.
int32_t HEADING::get_M1_eff | ( | void | ) |
Retrieves the motor 1 effort calculated by the heading controller.
Returns the current motor 1 effort calculated by the heading controller.
int32_t HEADING::get_M2_eff | ( | void | ) |
Retrieves the motor 2 effort calculated by the heading controller.
Returns the current motor 2 effort calculated by the heading controller.
void HEADING::run | ( | void | ) |
Executes one iteration of the heading FSM and PID controller.
Executes one iteration of the heading control FSM.
Based on IMU Euler angle data and a commanded heading setpoint, calculates a control effort using PID logic and outputs motor efforts.