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

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.

Detailed Description

Finite State Machine class for robot balance control.

Member Enumeration Documentation

◆ state

Enumerator
S0_INIT 

Initialization state.

S1_IDLE 

Idle state.

S2_RUN 

Running control loop.

Constructor & Destructor Documentation

◆ BALANCE()

BALANCE::BALANCE ( )

Constructor for the BALANCE class.

Initializes the FSM to the S0_INIT state.

Member Function Documentation

◆ get_M1_eff()

int32_t BALANCE::get_M1_eff ( void )

Returns the motor effort for motor 1.

Retrieves the calculated effort for motor 1.

Returns
Effort for motor 1 (M1) as a signed 32-bit integer.
Motor 1 effort as a signed 32-bit integer.

◆ get_M2_eff()

int32_t BALANCE::get_M2_eff ( void )

Returns the motor effort for motor 2.

Retrieves the calculated effort for motor 2.

Returns
Effort for motor 2 (M2) as a signed 32-bit integer.
Motor 2 effort as a signed 32-bit integer.

◆ run()

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.


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