ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
|
Finite State Machine class for robot balance control. More...
#include <balance.h>
Public Types | |
enum | state { S0_INIT , S1_IDLE , S2_RUN } |
typedef enum BALANCE::state | state_t |
Public Member Functions | |
BALANCE () | |
Constructor for the BALANCE class. | |
int32_t | get_M1_eff (void) |
Returns the motor effort for motor 1. | |
int32_t | get_M2_eff (void) |
Returns the motor effort for motor 2. | |
void | run (void) |
Executes the FSM logic and PID balance control. |
Finite State Machine class for robot balance control.
enum BALANCE::state |
BALANCE::BALANCE | ( | ) |
Constructor for the BALANCE class.
Initializes the FSM to the S0_INIT state.
int32_t BALANCE::get_M1_eff | ( | void | ) |
Returns the motor effort for motor 1.
Retrieves the calculated effort for motor 1.
int32_t BALANCE::get_M2_eff | ( | void | ) |
Returns the motor effort for motor 2.
Retrieves the calculated effort for motor 2.
void BALANCE::run | ( | void | ) |
Executes the FSM logic and PID balance control.
Executes one iteration of the balance FSM.
This function handles state transitions and PID-based control logic using IMU data to maintain robot balance.