|
|
@ -9,9 +9,6 @@ |
|
|
|
#include "common/params.h" |
|
|
|
#include "common/params.h" |
|
|
|
#include "driving.h" |
|
|
|
#include "driving.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PATH_IDX 0 |
|
|
|
#define PATH_IDX 0 |
|
|
|
#define LL_IDX PATH_IDX + MODEL_PATH_DISTANCE*2 + 1 |
|
|
|
#define LL_IDX PATH_IDX + MODEL_PATH_DISTANCE*2 + 1 |
|
|
|
#define RL_IDX LL_IDX + MODEL_PATH_DISTANCE*2 + 2 |
|
|
|
#define RL_IDX LL_IDX + MODEL_PATH_DISTANCE*2 + 2 |
|
|
@ -48,17 +45,14 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DESIRE |
|
|
|
#ifdef DESIRE |
|
|
|
s->prev_desire = (float*)malloc(DESIRE_LEN * sizeof(float)); |
|
|
|
s->prev_desire = std::make_unique<float[]>(DESIRE_LEN); |
|
|
|
for (int i = 0; i < DESIRE_LEN; i++) s->prev_desire[i] = 0.0; |
|
|
|
s->pulse_desire = std::make_unique<float[]>(DESIRE_LEN); |
|
|
|
s->pulse_desire = (float*)malloc(DESIRE_LEN * sizeof(float)); |
|
|
|
s->m->addDesire(s->pulse_desire.get(), DESIRE_LEN); |
|
|
|
for (int i = 0; i < DESIRE_LEN; i++) s->pulse_desire[i] = 0.0; |
|
|
|
|
|
|
|
s->m->addDesire(s->pulse_desire, DESIRE_LEN); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef TRAFFIC_CONVENTION |
|
|
|
#ifdef TRAFFIC_CONVENTION |
|
|
|
s->traffic_convention = (float*)malloc(TRAFFIC_CONVENTION_LEN * sizeof(float)); |
|
|
|
s->traffic_convention = std::make_unique<float[]>(TRAFFIC_CONVENTION_LEN); |
|
|
|
for (int i = 0; i < TRAFFIC_CONVENTION_LEN; i++) s->traffic_convention[i] = 0.0; |
|
|
|
s->m->addTrafficConvention(s->traffic_convention.get(), TRAFFIC_CONVENTION_LEN); |
|
|
|
s->m->addTrafficConvention(s->traffic_convention, TRAFFIC_CONVENTION_LEN); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<char> result = read_db_bytes("IsRHD"); |
|
|
|
std::vector<char> result = read_db_bytes("IsRHD"); |
|
|
|
if (result.size() > 0) { |
|
|
|
if (result.size() > 0) { |
|
|
@ -79,8 +73,6 @@ void model_init(ModelState* s, cl_device_id device_id, cl_context context, int t |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, |
|
|
|
ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, |
|
|
|
cl_mem yuv_cl, int width, int height, |
|
|
|
cl_mem yuv_cl, int width, int height, |
|
|
|
mat3 transform, void* sock, |
|
|
|
mat3 transform, void* sock, |
|
|
@ -100,7 +92,6 @@ ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q, |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//for (int i = 0; i < OUTPUT_SIZE + TEMPORAL_SIZE; i++) { printf("%f ", s->output[i]); } printf("\n");
|
|
|
|
//for (int i = 0; i < OUTPUT_SIZE + TEMPORAL_SIZE; i++) { printf("%f ", s->output[i]); } printf("\n");
|
|
|
|
|
|
|
|
|
|
|
|
float *new_frame_buf = frame_prepare(&s->frame, q, yuv_cl, width, height, transform); |
|
|
|
float *new_frame_buf = frame_prepare(&s->frame, q, yuv_cl, width, height, transform); |
|
|
@ -163,7 +154,6 @@ void poly_fit(float *in_pts, float *in_stds, float *out, int valid_len) { |
|
|
|
out[3] = y0; |
|
|
|
out[3] = y0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void fill_path(cereal::ModelData::PathData::Builder path, const float * data, bool has_prob, const float offset) { |
|
|
|
void fill_path(cereal::ModelData::PathData::Builder path, const float * data, bool has_prob, const float offset) { |
|
|
|
float points_arr[MODEL_PATH_DISTANCE]; |
|
|
|
float points_arr[MODEL_PATH_DISTANCE]; |
|
|
|
float stds_arr[MODEL_PATH_DISTANCE]; |
|
|
|
float stds_arr[MODEL_PATH_DISTANCE]; |
|
|
|