update for new CAN dbc (incomplete), add more NamedFields, allow mission select without confirmation, set default mission select state to manual
This commit is contained in:
@ -6,11 +6,11 @@ typedef enum {
|
||||
MISSION_NONE = 0,
|
||||
MISSION_ACCEL = 1,
|
||||
MISSION_SKIDPAD = 2,
|
||||
MISSION_AUTOX = 3,
|
||||
MISSION_TRACKDRIVE = 4,
|
||||
MISSION_EBS = 5,
|
||||
MISSION_INSPECTION = 6,
|
||||
MISSION_MANUAL = 7
|
||||
MISSION_TRACKDRIVE = 3,
|
||||
MISSION_BRAKETEST = 4,
|
||||
MISSION_INSPECTION = 5,
|
||||
MISSION_AUTOX = 6,
|
||||
MISSION_MANUAL = 7,
|
||||
} Mission;
|
||||
|
||||
#endif // __INC_STW_DEFINES_H
|
||||
|
||||
@ -7,10 +7,9 @@ extern "C" {
|
||||
|
||||
#include "params.h"
|
||||
#include "stw_defines.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define NUM_CONES 12
|
||||
|
||||
typedef enum {
|
||||
TS_INACTIVE = 0,
|
||||
TS_ACTIVE = 1,
|
||||
@ -18,7 +17,7 @@ typedef enum {
|
||||
TS_DISCHARGE = 3,
|
||||
TS_ERROR = 4,
|
||||
TS_CHARGING_CHECK = 5,
|
||||
TS_CHARGING = 6
|
||||
TS_CHARGING = 6,
|
||||
} TSState;
|
||||
|
||||
typedef enum {
|
||||
@ -27,41 +26,51 @@ typedef enum {
|
||||
AS_READY = 2,
|
||||
AS_DRIVING = 3,
|
||||
AS_FINISHED = 4,
|
||||
AS_EMERGENCY = 5
|
||||
AS_EMERGENCY = 5,
|
||||
} ASState;
|
||||
|
||||
typedef enum {
|
||||
R2D_NONE = 0,
|
||||
R2D_TSMS = 1,
|
||||
R2D_SDC_CLOSED = 1,
|
||||
R2D_TSACTIVE = 2,
|
||||
R2D_RESETTING_NODES = 3,
|
||||
R2D_RESETTING_COMMS = 4,
|
||||
R2D_WAITING_INIT = 5,
|
||||
R2D_INIT_STAGE1 = 6,
|
||||
R2D_INIT_STAGE2 = 7,
|
||||
R2D_INIT_SUCCESS = 0xF
|
||||
R2D_INIT_SUCCESS = 0xF,
|
||||
} R2DProgress;
|
||||
|
||||
typedef enum {
|
||||
SDC_OFF = 0,
|
||||
SDC_PDU_OK = 1, //
|
||||
SDC_RES_OK = 2,
|
||||
SDC_AMS_OK = 3,
|
||||
SDC_IMD_OK = 4,
|
||||
SDC_BOTS_OK = 5,
|
||||
SDC_SDB_DB_OK = 6, // shut down button dashboard
|
||||
SDC_IS_OK = 7,
|
||||
SDC_BSPD_OK = 8,
|
||||
SDC_SDB_L_OK = 9,
|
||||
SDC_SDB_R_OK = 10,
|
||||
SDC_TSMS_OK = 11,
|
||||
SDC_HVD_OK = 12,
|
||||
} SDCStatus;
|
||||
|
||||
typedef enum {
|
||||
INICHK_START = 0,
|
||||
INICHK_WD_CHECK = 1,
|
||||
INICHK_WD_OK = 2,
|
||||
INICHK_POS_CHK_1 = 3,
|
||||
INICHK_ASB_CHECK_A_1 = 4,
|
||||
INICHK_ASB_CHECK_A_2 = 5,
|
||||
INICHK_SWITCH_B = 6,
|
||||
INICHK_ASB_CHECK_B_1 = 7,
|
||||
INICHK_ASB_CHECK_B_2 = 8,
|
||||
INICHK_SWITCH_A = 9,
|
||||
INICHK_ASB_CHECK_AB_1 = 10,
|
||||
INICHK_ASB_CHECK_AB_2 = 11,
|
||||
INICHK_POS_CHK_2 = 12,
|
||||
INICHK_WAIT_TS = 13,
|
||||
INICHK_DONE = 14,
|
||||
INICHK_ERROR = 15
|
||||
} IniChkState;
|
||||
INICHK_ASB_CHECK_1 = 3,
|
||||
INICHK_ASB_CHECK_2 = 4,
|
||||
INICHK_WAIT_TS = 5,
|
||||
INICHK_EBS_CHECK_A = 6,
|
||||
INICHK_EBS_CHECK_B = 7,
|
||||
INICHK_DONE = 8,
|
||||
INICHK_ERROR = 9,
|
||||
} InitialCheckupState;
|
||||
|
||||
const char *inichkstate_str(IniChkState state);
|
||||
const char *inichkstate_str(InitialCheckupState state);
|
||||
|
||||
typedef enum {
|
||||
AMS_ERROR_NONE = 0x00,
|
||||
@ -69,7 +78,7 @@ typedef enum {
|
||||
AMS_ERROR_SLAVE_PANIC = 0x02,
|
||||
AMS_ERROR_SHUNT_TIMEOUT = 0x03,
|
||||
AMS_ERROR_SHUNT_OVERCURRENT = 0x04,
|
||||
AMS_ERROR_SHUNT_OVERTEMP = 0x05
|
||||
AMS_ERROR_SHUNT_OVERTEMP = 0x05,
|
||||
} AMSErrorKind;
|
||||
typedef enum {
|
||||
AMS_SLAVEPANIC_OVERTEMP = 0x00,
|
||||
@ -77,9 +86,21 @@ typedef enum {
|
||||
AMS_SLAVEPANIC_OVERVOLTAGE = 0x02,
|
||||
AMS_SLAVEPANIC_UNDERVOLTAGE = 0x03,
|
||||
AMS_SLAVEPANIC_TOO_FEW_TEMP = 0x04,
|
||||
AMS_SLAVEPANIC_OPENWIRE = 0x05
|
||||
AMS_SLAVEPANIC_OPENWIRE = 0x05,
|
||||
} AMSSlavePanicKind;
|
||||
|
||||
typedef struct {
|
||||
AMSErrorKind kind;
|
||||
uint8_t arg;
|
||||
} AMSError;
|
||||
|
||||
typedef struct {
|
||||
float wss_fl; // in km/h
|
||||
float wss_fr; // in km/h
|
||||
float wss_rl; // in km/h
|
||||
float wss_rr; // in km/h
|
||||
} WheelSpeeds;
|
||||
|
||||
typedef struct {
|
||||
float tire_fl;
|
||||
float tire_fr;
|
||||
@ -91,12 +112,10 @@ typedef struct {
|
||||
float brake_rl;
|
||||
float brake_rr;
|
||||
|
||||
float inv_l;
|
||||
float inv_r;
|
||||
float mot_l;
|
||||
float mot_r;
|
||||
float bat_l;
|
||||
float bat_r;
|
||||
float inv_1;
|
||||
float inv_2;
|
||||
float mot_1;
|
||||
float mot_2;
|
||||
} Temperatures;
|
||||
|
||||
typedef struct {
|
||||
@ -105,82 +124,96 @@ typedef struct {
|
||||
} ConePosition;
|
||||
|
||||
typedef struct {
|
||||
TSState ts_state;
|
||||
ASState as_state;
|
||||
Mission active_mission;
|
||||
|
||||
int sdc_closed;
|
||||
int pdu_sdc_active;
|
||||
int imd_ok;
|
||||
int sdcl_state[3];
|
||||
|
||||
R2DProgress r2d_progress;
|
||||
struct {
|
||||
int invl_ready : 1;
|
||||
int invr_ready : 1;
|
||||
int sdc_bfl : 1;
|
||||
int sdc_brl : 1;
|
||||
int sdc_acc : 1;
|
||||
int sdc_hvb : 1;
|
||||
int err_sdc : 1;
|
||||
int err_ams : 1;
|
||||
int err_pdu : 1;
|
||||
int err_ini_chk : 1;
|
||||
int err_con_mon : 1;
|
||||
int err_scs : 1;
|
||||
int err_sbspd : 1;
|
||||
int err_appsp : 1;
|
||||
int err_as : 1;
|
||||
int err_ros : 1;
|
||||
int err_res : 1;
|
||||
int err_invl : 1;
|
||||
int err_invr : 1;
|
||||
} errors;
|
||||
struct {
|
||||
AMSErrorKind kind;
|
||||
uint8_t arg;
|
||||
} last_ams_error;
|
||||
// AMS / TS system
|
||||
struct {
|
||||
uint8_t id;
|
||||
AMSSlavePanicKind kind;
|
||||
uint32_t arg;
|
||||
} last_ams_slave_panic;
|
||||
IniChkState ini_chk_state;
|
||||
TSState ts_state;
|
||||
bool sdc_closed;
|
||||
uint8_t soc_ts;
|
||||
float min_cell_volt; // in V
|
||||
float max_cell_temp; // in °C
|
||||
bool imd_ok; // latest IMD measurement
|
||||
bool tsal_green;
|
||||
bool imd_error; // latched imd error
|
||||
bool ams_error; // latched ams error
|
||||
|
||||
unsigned lap_count;
|
||||
float lap_last;
|
||||
float lap_best;
|
||||
AMSError last_ams_error;
|
||||
|
||||
// dcdc temp not in temps because temps only contains temperatures with multiple instances
|
||||
float dcdc_temp; // in °C
|
||||
float dcdc_current; // in A
|
||||
|
||||
float ts_current; // in A
|
||||
float ts_voltage_bat; // in V
|
||||
float ts_voltage_veh; // in V
|
||||
float shunt_temperature; // in °C
|
||||
|
||||
Temperatures temps;
|
||||
|
||||
float min_cell_volt;
|
||||
float max_cell_temp;
|
||||
int soc_ts;
|
||||
float lap_time_best; // in s
|
||||
float lap_time_last; // in s
|
||||
float sector_time_best; // in s
|
||||
float sector_time_last; // in s
|
||||
|
||||
float lv_bat_voltage;
|
||||
int soc_lv;
|
||||
WheelSpeeds wheel_speeds; // all in km/h
|
||||
uint16_t distance_session; // in m
|
||||
|
||||
float ts_current;
|
||||
float ts_voltage_bat;
|
||||
float ts_voltage_veh;
|
||||
float tank_pressure_1;
|
||||
float tank_pressure_2;
|
||||
|
||||
float speed;
|
||||
uint8_t apps_percent;
|
||||
float brake_pressure_f;
|
||||
float brake_pressure_r;
|
||||
int8_t steering_angle;
|
||||
float speed; // in m/s
|
||||
uint8_t lap_count;
|
||||
uint8_t sector_count;
|
||||
|
||||
float brake_press_f;
|
||||
float brake_press_r;
|
||||
float hyd_press_a;
|
||||
float hyd_press_b;
|
||||
R2DProgress r2d_progress;
|
||||
struct {
|
||||
bool err_pdu : 1;
|
||||
bool err_res : 1;
|
||||
bool err_as : 1;
|
||||
bool err_apps_plausible : 1;
|
||||
bool err_soft_bspd : 1;
|
||||
bool err_scs : 1; // system critical signals
|
||||
bool err_con_mon : 1; // continuous monitoring of autonomous system
|
||||
bool err_initial_checkup : 1; // initial checkup
|
||||
bool err_inv_1 : 1;
|
||||
bool err_inv_2 : 1;
|
||||
bool err_ams : 1;
|
||||
bool err_sdc : 1; // sdc err = not closed
|
||||
} errors;
|
||||
SDCStatus sdc_status;
|
||||
bool inv_1_ready;
|
||||
bool inv_2_ready;
|
||||
float energy_per_lap;
|
||||
InitialCheckupState initial_checkup_state;
|
||||
|
||||
float distance_total;
|
||||
// autonomous system
|
||||
Mission active_mission;
|
||||
ASState as_state;
|
||||
|
||||
uint32_t last_jetson_msg;
|
||||
uint32_t last_epsc_msg;
|
||||
int as_ok;
|
||||
float desired_angle;
|
||||
float measured_angle;
|
||||
float desired_speed;
|
||||
float inv_velocity_1;
|
||||
float inv_velocity_2;
|
||||
|
||||
ConePosition cone_pos[NUM_CONES];
|
||||
int16_t inv_torque_demanded_1;
|
||||
int16_t inv_torque_demanded_2;
|
||||
int16_t inv_torque_desired_1;
|
||||
int16_t inv_torque_desired_2;
|
||||
|
||||
uint16_t inv_control_word_1;
|
||||
uint16_t inv_control_word_2;
|
||||
int16_t inv_torque_actual_1;
|
||||
int16_t inv_torque_actual_2;
|
||||
|
||||
uint16_t inv_errors_1;
|
||||
uint16_t inv_errors_2;
|
||||
uint16_t inv_warnings_1;
|
||||
uint16_t inv_warnings_2;
|
||||
|
||||
ParamType last_param_confirmed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user