Midnight Sun Firmware
Loading...
Searching...
No Matches
cruise_control.h
1#pragma once
2
3/************************************************************************************************
4 * @file cruise_control.h
5 *
6 * @brief Header file for front controller cruise control handling
7 *
8 * @date 2026-02-03
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdint.h>
14
15/* Inter-component Headers */
16#include "status.h"
17
18/* Intra-component Headers */
19#include "front_controller.h"
20
27#define CC_MIN_THRESHOLD 0.5f
28#define CC_KP 0.00000005
29#define ACCELERATION_LIMIT_M_S2 1
30#define ACCELERATION_LIMIT_KM_HS ACCELERATION_LIMIT_M_S2 * 3.6
31#define ACCELERATION_LIMIT_PER_1000HZ_CYCLE ACCELERATION_LIMIT_KM_HS / 1000
32#define CURRENT_STEP_LIMIT 0.0001
33
34typedef struct CruiseControlStorage {
35 float current_motor_velocity;
36 float target_motor_velocity;
37 float set_current;
39
46
53
StatusCode cruise_control_init(FrontControllerStorage *storage)
Initializes the cruise control module.
Definition: cruise_control.c:77
StatusCode cruise_control_run()
Runs one cruise control calculation cycle. Called within motor_can.c when cruise control mode is on.
Definition: cruise_control.c:30
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Definition: cruise_control.h:34
Front Controller storage.
Definition: front_controller.h:72