Midnight Sun Firmware
Loading...
Searching...
No Matches
front_controller.h
1#pragma once
2
3/************************************************************************************************
4 * @file front_controller.h
5 *
6 * @brief Header file for front_controller
7 *
8 * @date 2025-07-19
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdbool.h>
14#include <stdint.h>
15
16/* Inter-component Headers */
17#include "status.h"
18
19/* Intra-component Headers */
20
27/* Forward declarations */
28struct PowerSenseStorage;
31
33#define FRONT_CONTROLLER_ACCEL_INPUT_DEADZONE 0.02f
34
36#define FRONT_CONTROLLER_ACCEL_REMAP_MIN 0.10f
37
39#define FRONT_CONTROLLER_ACCEL_CURVE_EXPONENT 2.0f
40
42#define FRONT_CONTROLLER_ACCEL_LPF_ALPHA 0.25f
43
47typedef struct {
55
59typedef struct {
65 struct PowerSenseStorage *power_sense_storage;
69 struct OpdStorage *opd_storage;
70
73
82
StatusCode front_controller_init(FrontControllerStorage *storage, FrontControllerConfig *config)
Initialize the front controller interface.
Definition: front_controller.c:49
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Definition: accel_pedal.h:32
Definition: brake_pedal.h:31
Front Controller configuration data.
Definition: front_controller.h:47
float brake_low_pass_filter_alpha
Definition: front_controller.h:53
float accel_low_pass_filter_alpha
Definition: front_controller.h:51
float accel_input_deadzone
Definition: front_controller.h:48
float accel_input_curve_exponent
Definition: front_controller.h:50
float accel_input_remap_min
Definition: front_controller.h:49
float brake_pedal_deadzone
Definition: front_controller.h:52
Front Controller storage.
Definition: front_controller.h:59
struct AccelPedalStorage * accel_pedal_storage
Definition: front_controller.h:66
struct Ws22MotorCanStorage * ws22_motor_can_storage
Definition: front_controller.h:68
struct BrakePedalStorage * brake_pedal_storage
Definition: front_controller.h:67
FrontControllerConfig * config
Definition: front_controller.h:71
bool brake_enabled
Definition: front_controller.h:60
float accel_percentage
Definition: front_controller.h:63
uint32_t vehicle_speed_kph
Definition: front_controller.h:62
struct PowerSenseStorage * power_sense_storage
Definition: front_controller.h:65
Definition: opd.h:34
WS22 motor CAN interface storage structure.
Definition: ws22_motor_can.h:96