openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

#pragma once
#include <vector>
#include "cereal/messaging/messaging.h"
#include "common/util.h"
#include "selfdrive/modeld/models/commonmodel.h"
#include "selfdrive/modeld/runners/run.h"
#define CALIB_LEN 3
3 years ago
#define OUTPUT_SIZE 84
#define REG_SCALE 0.25f
3 years ago
typedef struct DriverStateResult {
float face_orientation[3];
3 years ago
float face_orientation_std[3];
float face_position[2];
3 years ago
float face_position_std[2];
float face_prob;
float left_eye_prob;
float right_eye_prob;
float left_blink_prob;
float right_blink_prob;
3 years ago
float sunglasses_prob;
float occluded_prob;
float ready_prob[4];
float not_ready_prob[2];
3 years ago
} DriverStateResult;
typedef struct DMonitoringModelResult {
DriverStateResult driver_state_lhd;
DriverStateResult driver_state_rhd;
float poor_vision;
float wheel_on_right;
float dsp_execution_time;
3 years ago
} DMonitoringModelResult;
typedef struct DMonitoringModelState {
RunModel *m;
bool is_rhd;
float output[OUTPUT_SIZE];
std::vector<uint8_t> cropped_buf;
std::vector<float> net_input_buf;
float calib[CALIB_LEN];
} DMonitoringModelState;
void dmonitoring_init(DMonitoringModelState* s);
3 years ago
DMonitoringModelResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height, float *calib);
void dmonitoring_publish(PubMaster &pm, uint32_t frame_id, const DMonitoringModelResult &model_res, float execution_time, kj::ArrayPtr<const float> raw_pred);
void dmonitoring_free(DMonitoringModelState* s);