PER Firmware
Loading...
Searching...
No Matches
control_loop.c File Reference

Main torque vectoring control loop. More...

#include <stdint.h>
#include "can_library/generated/TORQUE_VECTOR.h"
#include "common/utils/max.h"
#include "sensors.h"
#include "vcu.h"
Include dependency graph for control_loop.c:

Functions

void control_init (void)
 
static void report_vcu_settings ()
 
void vcu_driver_request_CALLBACK (void)
 
static bool is_any_crit_stale ()
 
void control_loop ()
 

Variables

static pVCU_struct pVCU
 
static xVCU_struct xVCU
 
static yVCU_struct yVCU
 
volatile vcu_mode_t vcu_mode = VCU_MODE_TUNING
 
volatile bool is_tv_enabled = true
 
volatile bool is_regen_enabled = true
 
volatile vcu_settings_data_t vcu_settings [5]
 
volatile uint32_t last_vcu_settings_tx = 0
 

Detailed Description

Main torque vectoring control loop.

Author
Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
Trevor Koessler (tkoes.nosp@m.sle@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)

Function Documentation

◆ control_init()

void control_init ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ control_loop()

void control_loop ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_any_crit_stale()

static bool is_any_crit_stale ( )
inlinestatic
Here is the caller graph for this function:

◆ report_vcu_settings()

static void report_vcu_settings ( )
inlinestatic
Here is the caller graph for this function:

◆ vcu_driver_request_CALLBACK()

void vcu_driver_request_CALLBACK ( void )
Here is the call graph for this function:

Variable Documentation

◆ is_regen_enabled

volatile bool is_regen_enabled = true

◆ is_tv_enabled

volatile bool is_tv_enabled = true

◆ last_vcu_settings_tx

volatile uint32_t last_vcu_settings_tx = 0

◆ pVCU

pVCU_struct pVCU
static

◆ vcu_mode

volatile vcu_mode_t vcu_mode = VCU_MODE_TUNING

◆ vcu_settings

volatile vcu_settings_data_t vcu_settings[5]
Initial value:
= {
[VCU_MODE_ACCEL] = {
.lateral_gain = 50,
.longitudinal_gain = 50,
.electronic_brake_bias = 50
},
[VCU_MODE_SKIDPAD] = {
.lateral_gain = 50,
.longitudinal_gain = 50,
.electronic_brake_bias = 50
},
[VCU_MODE_AUTOCROSS] = {
.lateral_gain = 50,
.longitudinal_gain = 50,
.electronic_brake_bias = 50
},
[VCU_MODE_ENDURANCE] = {
.lateral_gain = 50,
.longitudinal_gain = 50,
.electronic_brake_bias = 50
},
[VCU_MODE_TUNING] = {
.lateral_gain = 50,
.longitudinal_gain = 50,
.electronic_brake_bias = 50
}
}

◆ xVCU

xVCU_struct xVCU
static

◆ yVCU

yVCU_struct yVCU
static