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

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.

Detailed Description

Finite State Machine for heading control based on IMU data.

Uses a PID control loop to drive motor efforts to reduce heading error.

Member Enumeration Documentation

◆ state

Enumerator
S0_INIT 

Initialization state.

S1_IDLE 

Idle state (waiting for control activation)

S2_RUN 

Active heading control loop.

Constructor & Destructor Documentation

◆ HEADING()

HEADING::HEADING ( )

Constructor for the HEADING class.

Initializes FSM state to S0_INIT.

Member Function Documentation

◆ get_M1_eff()

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.

Returns
Signed effort for motor 1.
Signed 32-bit PWM effort value for motor 1.

◆ get_M2_eff()

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.

Returns
Signed effort for motor 2.
Signed 32-bit PWM effort value for motor 2.

◆ run()

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.


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