Zap'Em Blast'Em Robots
robots that play laser tag!
Loading...
Searching...
No Matches
ControllerTask Struct Reference

Structure that defines the controller task. More...

#include <controller_task.h>

Data Fields

int32_t dir
int32_t state
int32_t num_states
uint32_t chan1
uint32_t chan2
int32_t pot_zero
int32_t des_pos
uint32_t prev_time
uint32_t current_time
uint32_t prev_ticks
float k_p
float k_i
uint32_t adc_val
int32_t integral_error
TIM_HandleTypeDef * htim_encoder
TIM_HandleTypeDef * htim_dt
ADC_HandleTypeDef * hadc
motor_tmotor
encoder_tencoder
float prev_error
controller_fcn_t state_list []

Detailed Description

Structure that defines the controller task.

Contains all configuration, timing, control, and peripheral references needed to manage a motor control task using state functions.

Field Documentation

◆ adc_val

uint32_t adc_val

Current potentiometer ADC value

◆ chan1

uint32_t chan1

Motor channel 1

◆ chan2

uint32_t chan2

Motor channel 2

◆ current_time

uint32_t current_time

Current time reading

◆ des_pos

int32_t des_pos

Desired position in ticks

◆ dir

int32_t dir

Direction of movement

◆ encoder

encoder_t* encoder

Pointer to encoder object

◆ hadc

ADC_HandleTypeDef* hadc

ADC handle for potentiometer

◆ htim_dt

TIM_HandleTypeDef* htim_dt

Timer for delta time calc

◆ htim_encoder

TIM_HandleTypeDef* htim_encoder

Timer for encoder ticks

◆ integral_error

int32_t integral_error

Integrated error term

◆ k_i

float k_i

Integral gain

◆ k_p

float k_p

Proportional gain

◆ motor

motor_t* motor

Pointer to motor object

◆ num_states

int32_t num_states

Total number of states

◆ pot_zero

int32_t pot_zero

Zero offset from ADC pot

◆ prev_error

float prev_error

Previous PID error

◆ prev_ticks

uint32_t prev_ticks

Last encoder tick value

◆ prev_time

uint32_t prev_time

Previous time reading

◆ state

int32_t state

Current state index

◆ state_list

controller_fcn_t state_list[]

Function pointer list for states


The documentation for this struct was generated from the following file: