|
|
|
|
@@ -325,14 +325,6 @@ void model_publish_v2(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
|
|
|
plan_mhp_max_idx = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
float valid_len = net_outputs.plan[plan_mhp_max_idx*(PLAN_MHP_GROUP_SIZE) + 30*32];
|
|
|
|
|
valid_len = fmin(MODEL_PATH_DISTANCE, fmax(MIN_VALID_LEN, valid_len));
|
|
|
|
|
int valid_len_idx = 0;
|
|
|
|
|
for (int i=1; i<TRAJECTORY_SIZE; i++) {
|
|
|
|
|
if (valid_len >= X_IDXS[valid_len_idx]){
|
|
|
|
|
valid_len_idx = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float * best_plan = &net_outputs.plan[plan_mhp_max_idx*(PLAN_MHP_GROUP_SIZE)];
|
|
|
|
|
float plan_t_arr[TRAJECTORY_SIZE];
|
|
|
|
|
@@ -342,12 +334,12 @@ void model_publish_v2(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
|
|
|
|
|
|
|
|
auto position = framed.initPosition();
|
|
|
|
|
fill_xyzt(position, best_plan, PLAN_MHP_COLUMNS, 0, plan_t_arr);
|
|
|
|
|
auto orientation = framed.initOrientation();
|
|
|
|
|
fill_xyzt(orientation, best_plan, PLAN_MHP_COLUMNS, 3, plan_t_arr);
|
|
|
|
|
auto velocity = framed.initVelocity();
|
|
|
|
|
fill_xyzt(velocity, best_plan, PLAN_MHP_COLUMNS, 6, plan_t_arr);
|
|
|
|
|
fill_xyzt(velocity, best_plan, PLAN_MHP_COLUMNS, 3, plan_t_arr);
|
|
|
|
|
auto orientation = framed.initOrientation();
|
|
|
|
|
fill_xyzt(orientation, best_plan, PLAN_MHP_COLUMNS, 9, plan_t_arr);
|
|
|
|
|
auto orientation_rate = framed.initOrientationRate();
|
|
|
|
|
fill_xyzt(orientation_rate, best_plan, PLAN_MHP_COLUMNS, 9, plan_t_arr);
|
|
|
|
|
fill_xyzt(orientation_rate, best_plan, PLAN_MHP_COLUMNS, 12, plan_t_arr);
|
|
|
|
|
|
|
|
|
|
// lane lines
|
|
|
|
|
auto lane_lines = framed.initLaneLines(4);
|
|
|
|
|
@@ -411,9 +403,17 @@ void model_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
|
|
|
plan_mhp_max_idx = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// x pos at 10s is a good valid_len
|
|
|
|
|
float valid_len = net_outputs.plan[plan_mhp_max_idx*(PLAN_MHP_GROUP_SIZE) + 30*32];
|
|
|
|
|
// clamp to 5 and MODEL_PATH_DISTANCE
|
|
|
|
|
float valid_len = 0;
|
|
|
|
|
float valid_len_candidate;
|
|
|
|
|
for (int i=1; i<TRAJECTORY_SIZE; i++) {
|
|
|
|
|
valid_len_candidate = net_outputs.plan[plan_mhp_max_idx*(PLAN_MHP_GROUP_SIZE) + 30*i];
|
|
|
|
|
if (valid_len_candidate >= valid_len){
|
|
|
|
|
valid_len = valid_len_candidate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// clamp to 10 and MODEL_PATH_DISTANCE
|
|
|
|
|
valid_len = fmin(MODEL_PATH_DISTANCE, fmax(MIN_VALID_LEN, valid_len));
|
|
|
|
|
int valid_len_idx = 0;
|
|
|
|
|
for (int i=1; i<TRAJECTORY_SIZE; i++) {
|
|
|
|
|
|