diff --git a/common/modeldata.h b/common/modeldata.h deleted file mode 100644 index 6dc02cc792..0000000000 --- a/common/modeldata.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#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 -constexpr std::array build_idxs(float max_val) { - std::array 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(10.0); -constexpr auto T_IDXS_FLOAT = build_idxs(10.0); -constexpr auto X_IDXS = build_idxs(192.0); -constexpr auto X_IDXS_FLOAT = build_idxs(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}}; diff --git a/release/files_common b/release/files_common index 53720aa05a..46c2c26a5b 100644 --- a/release/files_common +++ b/release/files_common @@ -163,7 +163,6 @@ common/ratekeeper.h common/watchdog.cc common/watchdog.h -common/modeldata.h common/mat.h common/timing.h diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 03df2cf57a..7b2d24b53a 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -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 diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index dc180eebfb..d9a03344b6 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -13,9 +12,10 @@ #include #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}, diff --git a/system/camerad/cameras/camera_common.cc b/system/camerad/cameras/camera_common.cc index 23b28357da..d2c7a35f6e 100644 --- a/system/camerad/cameras/camera_common.cc +++ b/system/camerad/cameras/camera_common.cc @@ -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"