Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a9e97fe
creation of file sensor_data_processing
caiussouza Mar 2, 2023
4fe37f6
creation of moving average logic
caiussouza Mar 2, 2023
b77eab7
completing the moving average
caiussouza Mar 2, 2023
b148b00
cross validation sketch
caiussouza Mar 2, 2023
ea57e3c
cross validation logic implemented
caiussouza Mar 5, 2023
c45a78f
security architecture sketch
caiussouza Mar 5, 2023
de6a3c9
Merge branch 'develop' of https://github.com/Tesla-UFMG/ECU into feat…
caiussouza Mar 6, 2023
fd5d772
cross validation task development
caiussouza Mar 6, 2023
9660b35
creation of timer
caiussouza Mar 7, 2023
4f91fe0
debugging
caiussouza Mar 7, 2023
a2e083a
bug fixing
caiussouza Mar 8, 2023
e911744
bug fixing
caiussouza Mar 9, 2023
4288f83
building errors fixed
caiussouza Mar 9, 2023
233fbe4
ready for tests
caiussouza Mar 9, 2023
ca7452c
moving average fixing
caiussouza Mar 14, 2023
c378251
pr ready version
caiussouza Mar 14, 2023
b619d25
Merge branch 'develop' of https://github.com/Tesla-UFMG/ECU into feat…
caiussouza Mar 17, 2023
67af997
refactoring
caiussouza Mar 17, 2023
e68d337
datalogging function added
caiussouza Mar 17, 2023
877245f
ready for tests
caiussouza Mar 17, 2023
283f0d5
clang format fixing
caiussouza Mar 17, 2023
2a23b7d
clang tidy fixing
caiussouza Mar 18, 2023
55d37eb
clang format
caiussouza Mar 18, 2023
9afa923
fixing
caiussouza Mar 18, 2023
9812801
Warnings fixing
caiussouza Mar 21, 2023
bd66c2f
flag number fixing
caiussouza Apr 3, 2023
97edb1c
flag neme fixing
caiussouza Apr 3, 2023
cca8756
Merge branch 'develop' of https://github.com/Tesla-UFMG/ECU into feat…
caiussouza Apr 3, 2023
7fb72a3
merge conflicts fixing
caiussouza Apr 3, 2023
41fc941
clang format
caiussouza Apr 3, 2023
f18bf21
.ioc fixing
caiussouza Apr 4, 2023
0defa6f
variable name refactor on ioc
caiussouza Apr 4, 2023
d76d67b
now the task works for all the time the car is active
caiussouza Apr 4, 2023
ff6bc57
atualizando ids de can
caiussouza Apr 20, 2023
a07503b
reverting can ids changes
caiussouza May 12, 2023
133028e
ready for tests
caiussouza May 16, 2023
787aa83
security arch implemented for all 4 speed sensors
caiussouza May 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.1971965462" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv5-d16" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.434450183" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1189751738" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.314650556" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.5 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32H743VITx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Drivers/STM32H7xx_HAL_Driver/Inc || || || USE_HAL_DRIVER | STM32H743xx || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32H743VITX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.314650556" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32H743VITx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Drivers/STM32H7xx_HAL_Driver/Inc || || || USE_HAL_DRIVER | STM32H743xx || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32H743VITX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.808710097" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="100" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.490691857" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/ECU}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1096357141" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.796568143" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
Expand Down Expand Up @@ -113,7 +114,8 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.250658686" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv5-d16" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1204726074" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="true" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.607280753" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1018201956" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.5 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32H743VITx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Drivers/STM32H7xx_HAL_Driver/Inc || || || USE_HAL_DRIVER | STM32H743xx || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32H743VITX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1018201956" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32H743VITx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Middlewares/Third_Party/FreeRTOS/Source/include | ../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F | ../Drivers/CMSIS/Include | ../Core/Inc | ../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32H7xx/Include | ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 | ../Drivers/STM32H7xx_HAL_Driver/Inc || || || USE_HAL_DRIVER | STM32H743xx || || Drivers | Core/Startup | Middlewares | Core || || || ${workspace_loc:/${ProjName}/STM32H743VITX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1127082935" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="100" valueType="string"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1407912381" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/ECU}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.839194533" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.326150318" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
Expand Down
4 changes: 3 additions & 1 deletion Core/Inc/CAN/CAN_IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
CAN_GENERAL_LIST_DATA(ID_SPEED_RL, 104, 2) \
CAN_GENERAL_LIST_DATA(ID_SPEED_RR, 104, 3) \
CAN_GENERAL_LIST_DATA(ID_REGEN_BRAKE_STATE, 106, 0) \
CAN_GENERAL_LIST_DATA(ID_IMU_BSE_ERROR, 106, 2) \
CAN_GENERAL_LIST_DATA(ID_IMU_SPEED_ERROR, 106, 3) \
CAN_GENERAL_LIST_DATA(ID_SPEED_L_MOTOR, 110, 0) \
CAN_GENERAL_LIST_DATA(ID_TORQUE_L_MOTOR, 110, 1) \
CAN_GENERAL_LIST_DATA(ID_POWER_L_MOTOR, 110, 2) \
Expand Down Expand Up @@ -84,7 +86,7 @@ typedef struct {
CAN_general_list_e message_to_send[4];
} datalog_send_t;

#define QUANT_RESERVED_ID 50
#define QUANT_RESERVED_ID 52
#define WORDS_PER_ID 4

// INVERTER
Expand Down
27 changes: 27 additions & 0 deletions Core/Inc/dynamic_controls/security_architecture.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* security_architecture.h
*
* Created on: Mar 7, 2023
* Author: caius
*/

#ifndef INC_DYNAMIC_CONTROLS_SECURITY_ARCHITECTURE_H_
#define INC_DYNAMIC_CONTROLS_SECURITY_ARCHITECTURE_H_

// TODO(caius): add the threshold values and the timer time

#include "stdbool.h"
#include "stdint.h"

#define IMU_NULL_ACCEL_MARGIN_ERROR 1
#define NULL_SPEED_MARGIN_ERROR 1

#define CROSS_VALIDATION_ERROR_TIME 1
#define CROSS_VALIDATION_DELAY 1

bool is_there_imu_bse_error();
bool is_there_imu_speed_error();
void cross_validation_error_callback();
void cross_validation_status_datalog();

#endif /* INC_DYNAMIC_CONTROLS_SECURITY_ARCHITECTURE_H_ */
26 changes: 26 additions & 0 deletions Core/Inc/sensors/sensor_data_processing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* sensor_data_processing.h
*
* Created on: Mar 2, 2023
* Author: caius
*/

#ifndef INC_SENSORS_SENSOR_DATA_PROCESSING_H_
#define INC_SENSORS_SENSOR_DATA_PROCESSING_H_

#include "stdbool.h"
#include "stdint.h"

#define MAX_BUFFER_SIZE 100

typedef struct {
float buffer[MAX_BUFFER_SIZE];
uint8_t index;
uint8_t size;
bool max_points_reached;
} moving_average_t;

// void moving_average(float* mov_avg, float const* data);
float get_add_moving_average(moving_average_t* moving_average, float const data);

#endif /* INC_SENSORS_SENSOR_DATA_PROCESSING_H_ */
9 changes: 9 additions & 0 deletions Core/Inc/util/CMSIS_extra/global_variables_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
typedef struct {
uint16_t wheels[4];
} SPEEDS_t;
typedef struct {
int16_t accel_axes[3];
} IMU_ACCEL_t;

typedef uint16_t FRONT_AVG_SPEED_t;
typedef uint16_t REAR_AVG_SPEED_t;
typedef uint16_t STEERING_WHEEL_t;
Expand All @@ -30,6 +34,10 @@ typedef modos SELECTED_MODE_t;
{ \
{ 0, 0, 0, 0 } \
}
#define IMU_ACCEL_DEFAULT_VALUE \
{ \
{ 0, 0, 0 } \
}
#define FRONT_AVG_SPEED_DEFAULT_VALUE 0
#define REAR_AVG_SPEED_DEFAULT_VALUE 0
#define STEERING_WHEEL_DEFAULT_VALUE 0
Expand All @@ -44,6 +52,7 @@ typedef modos SELECTED_MODE_t;

typedef enum {
SPEEDS,
IMU_ACCEL,
WHEEL_ENCODER_SPEEDS,
FRONT_AVG_SPEED,
REAR_AVG_SPEED,
Expand Down
9 changes: 5 additions & 4 deletions Core/Inc/util/global_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef enum modos_desempenho {
AUTOX
} race_mode_t;

typedef struct // struct de modo
typedef struct // struct de modo
{
int tor_max; // torque maximo (de 0 a 4000)
int vel_max; // velocidade maxima (de 0 a 9000)
Expand Down Expand Up @@ -121,9 +121,10 @@ typedef enum {
#define DYNAMIC_CONTROL_FLAG (1 << 3)

// Warning flags (No actions necessary)
#define REGEN_WARN_FLAG (1 << 10)
#define DYNAMIC_CONTROL_WARN_FLAG (1 << 11)
#define FLASH_SAVE_LIMIT_FLAG (1 << 12)
#define REGEN_WARN_FLAG (1 << 10)
#define DYNAMIC_CONTROL_WARN_FLAG (1 << 11)
#define FLASH_SAVE_LIMIT_FLAG (1 << 12)
#define CROSS_VALIDATION_ERROR_WARN_FLAG (1 << 13)
// Soft error flags (RTD keeps on, torque ref to inverter is set to 0)

#define BSE_ERROR_FLAG (1 << 16) // FSAE Rules: EV.5.7 (2021)
Expand Down
3 changes: 2 additions & 1 deletion Core/Inc/util/global_instances.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern osThreadId_t t_pilot_resetHandle;
extern osThreadId_t t_inverter_comm_errorHandle;
extern osThreadId_t t_odometer_saveHandle;
extern osThreadId_t t_dynamic_controls_choiceHandle;
extern osThreadId_t t_cross_validationHandle;

// EVENT FLAGS
extern osEventFlagsId_t e_ECU_control_flagsHandle;
Expand All @@ -45,11 +46,11 @@ extern osMutexId_t m_state_parameter_mutexHandle;
// TIMERS
extern osTimerId_t tim_SU_F_errorHandle;
extern osTimerId_t tim_APPS_errorHandle;
;
extern osTimerId_t tim_inverter_BUS_OFF_errorHandle;
extern osTimerId_t tim_inverter_readyHandle;
extern osTimerId_t tim_inverter_can_transmit_errorHandle;
extern osTimerId_t tim_left_inv_errorHandle;
extern osTimerId_t tim_right_inv_errorHandle;
extern osTimerId_t tim_cross_validation_errorHandle;

#endif /* INC_GLOBAL_INSTANCES_H_ */
2 changes: 1 addition & 1 deletion Core/Src/CAN/inverter_can_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void right_inv_error_callback() {
}

static void precharge_monitor() {
// start the timer only when the flag is reseted and the timer is not alredy
// start the timer only when the flag is reseted and the timer is not already
Comment thread
caiussouza marked this conversation as resolved.
// running to avoid restarting the timer
if (!get_individual_flag(e_ECU_control_flagsHandle, INVERTER_READY_FLAG)) {
if (!osTimerIsRunning(tim_inverter_readyHandle)) {
Expand Down
6 changes: 4 additions & 2 deletions Core/Src/driver_settings/dynamic_controls_choice.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ void dynamic_controls_choice(void* argument) {
if (is_RTD_active()) {
continue;
}
const bool is_DYNAMIC_CONTROL_active =
const bool is_dynamic_control_active =
get_individual_flag(e_ECU_control_flagsHandle, DYNAMIC_CONTROL_FLAG);

if (!is_DYNAMIC_CONTROL_active) {
if (!is_dynamic_control_active) {
osEventFlagsSet(e_ECU_control_flagsHandle, DYNAMIC_CONTROL_FLAG);
osEventFlagsClear(e_ECU_control_flagsHandle,
CROSS_VALIDATION_ERROR_WARN_FLAG);
} else {
osEventFlagsClear(e_ECU_control_flagsHandle, DYNAMIC_CONTROL_FLAG);
}
Expand Down
98 changes: 98 additions & 0 deletions Core/Src/dynamic_controls/security_architecture.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* security_architecture.c
*
* Created on: 2 de mar de 2023
* Author: caius
*/

#include "dynamic_controls/security_architecture.h"

#include "CAN/general_can_data_manager.h"
#include "datalogging/datalog_handler.h"
#include "sensors/sensor_data_processing.h"
#include "util/global_instances.h"
#include "util/util.h"

static moving_average_t speedFL_mov_avg;
static moving_average_t speedFR_mov_avg;
static moving_average_t speedRL_mov_avg;
static moving_average_t speedRR_mov_avg;
static moving_average_t IMU_long_accel_mov_avg;

static BRAKE_STATUS_t bse_active;

static float speedFL_mov_ave_value;
static float speedFR_mov_ave_value;
static float speedRL_mov_ave_value;
static float speedRR_mov_ave_value;
static float IMU_long_accel_mov_ave_value;

static bool imu_bse_error_status;
static bool imu_speed_error_status;

void cross_validation(void* argument) {
UNUSED(argument);

for (;;) {
ECU_ENABLE_BREAKPOINT_DEBUG();

float IMU_long_accel_data = (float)general_get_value(accelerometer_z);

SPEEDS_t speed_var = get_global_var_value(SPEEDS);

float speedFL_data = (float)speed_var.wheels[FRONT_LEFT];
float speedFR_data = (float)speed_var.wheels[FRONT_RIGHT];
float speedRL_data = (float)speed_var.wheels[REAR_LEFT];
float speedRR_data = (float)speed_var.wheels[REAR_RIGHT];

bse_active = get_global_var_value(BRAKE_STATUS);

IMU_long_accel_mov_ave_value =
get_add_moving_average(&IMU_long_accel_mov_avg, IMU_long_accel_data);

speedFL_mov_ave_value = get_add_moving_average(&speedFL_mov_avg, speedFL_data);
speedFR_mov_ave_value = get_add_moving_average(&speedFR_mov_avg, speedFR_data);
speedRL_mov_ave_value = get_add_moving_average(&speedRL_mov_avg, speedRL_data);
speedRR_mov_ave_value = get_add_moving_average(&speedRR_mov_avg, speedRR_data);

imu_bse_error_status = is_there_imu_bse_error();
imu_speed_error_status = is_there_imu_speed_error();

if (imu_bse_error_status || imu_speed_error_status) {
osTimerStart(tim_cross_validation_errorHandle, CROSS_VALIDATION_ERROR_TIME);
}

else {
osTimerStop(tim_cross_validation_errorHandle);
}
cross_validation_status_datalog();
osDelay(CROSS_VALIDATION_DELAY);
}
Comment thread
caiussouza marked this conversation as resolved.
}

bool is_there_imu_bse_error() {
if (bse_active && (IMU_long_accel_mov_ave_value > IMU_NULL_ACCEL_MARGIN_ERROR)) {
return true;
}
return false;
}

bool is_there_imu_speed_error() {
if (((speedFR_mov_ave_value < NULL_SPEED_MARGIN_ERROR)
|| (speedFL_mov_ave_value < NULL_SPEED_MARGIN_ERROR)
|| (speedRL_mov_ave_value < NULL_SPEED_MARGIN_ERROR)
|| (speedRR_mov_ave_value < NULL_SPEED_MARGIN_ERROR))
&& (IMU_long_accel_mov_ave_value > IMU_NULL_ACCEL_MARGIN_ERROR)) {
return true;
}
return false;
}

void cross_validation_error_callback() {
osEventFlagsSet(e_ECU_control_flagsHandle, CROSS_VALIDATION_ERROR_WARN_FLAG);
}

void cross_validation_status_datalog() {
log_data(ID_IMU_BSE_ERROR, imu_bse_error_status);
log_data(ID_IMU_SPEED_ERROR, imu_speed_error_status);
}
Loading