modeld: remove modeldata.h (#30423)

* remove modeldata.h

* remove TRAJECTORY_SIZE
This commit is contained in:
Dean Lee 2023-11-19 14:45:26 +08:00 committed by GitHub
parent c055fdc853
commit 335237aea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 46 deletions

View File

@ -1,38 +0,0 @@
#pragma once
#include <array>
#include "common/mat.h"
#include "system/hardware/hw.h"
const int TRAJECTORY_SIZE = 33;
const int LAT_MPC_N = 16;
const int LON_MPC_N = 32;
const float MIN_DRAW_DISTANCE = 10.0;
const float MAX_DRAW_DISTANCE = 100.0;
const float RYG_GREEN = 0.01165;
const float RYG_YELLOW = 0.06157;
template <typename T, size_t size>
constexpr std::array<T, size> build_idxs(float max_val) {
std::array<T, size> result{};
for (int i = 0; i < size; ++i) {
result[i] = max_val * ((i / (double)(size - 1)) * (i / (double)(size - 1)));
}
return result;
}
constexpr auto T_IDXS = build_idxs<double, TRAJECTORY_SIZE>(10.0);
constexpr auto T_IDXS_FLOAT = build_idxs<float, TRAJECTORY_SIZE>(10.0);
constexpr auto X_IDXS = build_idxs<double, TRAJECTORY_SIZE>(192.0);
constexpr auto X_IDXS_FLOAT = build_idxs<float, TRAJECTORY_SIZE>(192.0);
const mat3 FCAM_INTRINSIC_MATRIX = (mat3){{2648.0, 0.0, 1928.0 / 2,
0.0, 2648.0, 1208.0 / 2,
0.0, 0.0, 1.0}};
// tici ecam focal probably wrong? magnification is not consistent across frame
// Need to retrain model before this can be changed
const mat3 ECAM_INTRINSIC_MATRIX = (mat3){{567.0, 0.0, 1928.0 / 2,
0.0, 567.0, 1208.0 / 2,
0.0, 0.0, 1.0}};

View File

@ -163,7 +163,6 @@ common/ratekeeper.h
common/watchdog.cc
common/watchdog.h
common/modeldata.h
common/mat.h
common/timing.h

View File

@ -38,7 +38,7 @@ static bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y,
int get_path_length_idx(const cereal::XYZTData::Reader &line, const float path_height) {
const auto line_x = line.getX();
int max_idx = 0;
for (int i = 1; i < TRAJECTORY_SIZE && line_x[i] <= path_height; ++i) {
for (int i = 1; i < line_x.size() && line_x[i] <= path_height; ++i) {
max_idx = i;
}
return max_idx;
@ -84,10 +84,10 @@ void update_model(UIState *s,
const cereal::UiPlan::Reader &plan) {
UIScene &scene = s->scene;
auto plan_position = plan.getPosition();
if (plan_position.getX().size() < TRAJECTORY_SIZE){
if (plan_position.getX().size() < model.getPosition().getX().size()) {
plan_position = model.getPosition();
}
float max_distance = std::clamp(plan_position.getX()[TRAJECTORY_SIZE - 1],
float max_distance = std::clamp(*(plan_position.getX().end() - 1),
MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE);
// update lane lines

View File

@ -3,7 +3,6 @@
#include <map>
#include <memory>
#include <string>
#include <optional>
#include <QObject>
#include <QTimer>
@ -13,9 +12,10 @@
#include <QTransform>
#include "cereal/messaging/messaging.h"
#include "common/modeldata.h"
#include "common/mat.h"
#include "common/params.h"
#include "common/timing.h"
#include "system/hardware/hw.h"
const int UI_BORDER_SIZE = 30;
const int UI_HEADER_HEIGHT = 420;
@ -24,7 +24,18 @@ const int UI_FREQ = 20; // Hz
const int BACKLIGHT_OFFROAD = 50;
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
const mat3 DEFAULT_CALIBRATION = {{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }};
const float MIN_DRAW_DISTANCE = 10.0;
const float MAX_DRAW_DISTANCE = 100.0;
constexpr mat3 DEFAULT_CALIBRATION = {{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }};
constexpr mat3 FCAM_INTRINSIC_MATRIX = (mat3){{2648.0, 0.0, 1928.0 / 2,
0.0, 2648.0, 1208.0 / 2,
0.0, 0.0, 1.0}};
// tici ecam focal probably wrong? magnification is not consistent across frame
// Need to retrain model before this can be changed
constexpr mat3 ECAM_INTRINSIC_MATRIX = (mat3){{567.0, 0.0, 1928.0 / 2,
0.0, 567.0, 1208.0 / 2,
0.0, 0.0, 1.0}};
constexpr vec3 default_face_kpts_3d[] = {
{-5.98, -51.20, 8.00}, {-17.64, -49.14, 8.00}, {-23.81, -46.40, 8.00}, {-29.98, -40.91, 8.00}, {-32.04, -37.49, 8.00},

View File

@ -13,7 +13,6 @@
#include "system/camerad/imgproc/utils.h"
#include "common/clutil.h"
#include "common/modeldata.h"
#include "common/swaglog.h"
#include "common/util.h"
#include "system/hardware/hw.h"