FrogPilot 0.9.7

This commit is contained in:
FrogAi
2024-06-27 10:22:08 -07:00
parent da00915ac8
commit b705b02e70
682 changed files with 181798 additions and 1348 deletions
+197 -2
View File
@@ -1,5 +1,6 @@
#pragma once
#include <iostream>
#include <memory>
#include <string>
@@ -14,8 +15,12 @@
#include "common/mat.h"
#include "common/params.h"
#include "common/timing.h"
#include "selfdrive/ui/qt/network/wifi_manager.h"
#include "selfdrive/ui/qt/util.h"
#include "system/hardware/hw.h"
#include "selfdrive/frogpilot/ui/qt/widgets/frogpilot_controls.h"
const int UI_BORDER_SIZE = 30;
const int UI_HEADER_HEIGHT = 420;
@@ -50,6 +55,13 @@ typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
// FrogPilot statuses
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
STATUS_CONDITIONAL_OVERRIDDEN,
STATUS_EXPERIMENTAL_MODE_ACTIVE,
STATUS_NAVIGATION_ACTIVE,
STATUS_TRAFFIC_MODE_ACTIVE,
} UIStatus;
enum PrimeType {
@@ -67,6 +79,13 @@ const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(0x91, 0x9b, 0x95, 0xf1),
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
// FrogPilot colors
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
[STATUS_CONDITIONAL_OVERRIDDEN] = QColor(0xff, 0xff, 0x00, 0xf1),
[STATUS_EXPERIMENTAL_MODE_ACTIVE] = QColor(0xda, 0x6f, 0x25, 0xf1),
[STATUS_NAVIGATION_ACTIVE] = QColor(0x31, 0xa1, 0xee, 0xf1),
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1),
};
@@ -86,7 +105,7 @@ typedef struct UIScene {
QPolygonF road_edge_vertices[2];
// lead
QPointF lead_vertices[2];
QPointF lead_vertices[6];
// DMoji state
float driver_pose_vals[3];
@@ -95,12 +114,173 @@ typedef struct UIScene {
float driver_pose_coss[3];
vec3 face_kpts_draw[std::size(default_face_kpts_3d)];
bool navigate_on_openpilot = false;
cereal::LongitudinalPersonality personality;
float light_sensor = -1;
bool started, ignition, is_metric, map_on_left, longitudinal_control;
bool world_objects_visible = false;
uint64_t started_frame;
// FrogPilot variables
bool acceleration_path;
bool adjacent_path;
bool adjacent_path_metrics;
bool always_on_lateral;
bool always_on_lateral_active;
bool big_map;
bool blind_spot_left;
bool blind_spot_path;
bool blind_spot_right;
bool brake_lights_on;
bool cem_status;
bool compass;
bool conditional_experimental;
bool cpu_metrics;
bool downloading_update;
bool driver_camera_in_reverse;
bool dynamic_path_width;
bool dynamic_pedals_on_ui;
bool enabled;
bool experimental_mode;
bool experimental_mode_via_tap;
bool fahrenheit;
bool force_onroad;
bool frogpilot_panel_active;
bool frogs_go_moo;
bool full_map;
bool gpu_metrics;
bool hide_alerts;
bool hide_csc_ui;
bool hide_lead_marker;
bool hide_map_icon;
bool hide_max_speed;
bool hide_speed;
bool hide_speed_limit;
bool ip_metrics;
bool jerk_metrics;
bool lateral_tuning_metrics;
bool lead_metrics;
bool left_curve;
bool live_valid;
bool map_open;
bool memory_metrics;
bool model_randomizer;
bool model_ui;
bool mtsc_enabled;
bool no_logging;
bool no_uploads;
bool numerical_temp;
bool online;
bool onroad_distance_button;
bool parked;
bool pedals_on_ui;
bool radarless_model;
bool rainbow_path;
bool random_events;
bool red_light;
bool reverse;
bool road_name_ui;
bool rotating_wheel;
bool screen_recorder;
bool show_blind_spot;
bool show_fps;
bool show_speed_limit_offset;
bool show_speed_limits;
bool show_stopping_point;
bool show_stopping_point_metrics;
bool sidebar_metrics;
bool signal_metrics;
bool speed_limit_changed;
bool speed_limit_controller;
bool speed_limit_overridden;
bool speed_limit_sources;
bool speed_limit_vienna;
bool standby_mode;
bool standstill;
bool static_pedals_on_ui;
bool steering_metrics;
bool stopped_timer;
bool storage_left_metrics;
bool storage_used_metrics;
bool tethering_enabled;
bool traffic_mode;
bool traffic_mode_active;
bool turn_signal_left;
bool turn_signal_right;
bool unlimited_road_ui_length;
bool use_si_metrics;
bool use_stock_colors;
bool use_stock_wheel;
bool use_wheel_speed;
bool vtsc_controlling_curve;
bool vtsc_enabled;
bool wake_up_screen;
double fps;
float acceleration;
float acceleration_jerk;
float acceleration_jerk_difference;
float dashboard_speed_limit;
float friction;
float lane_detection_width;
float lane_line_width;
float lane_width_left;
float lane_width_right;
float lat_accel;
float lead_detection_probability;
float mtsc_speed;
float navigation_speed_limit;
float path_edge_width;
float path_width;
float road_edge_width;
float speed_jerk;
float speed_jerk_difference;
float speed_limit;
float speed_limit_map;
float speed_limit_offset;
float speed_limit_overridden_speed;
float steer;
float unconfirmed_speed_limit;
float upcoming_maneuver_distance;
float upcoming_speed_limit;
float vtsc_speed;
int bearing_deg;
int camera_view;
int conditional_status;
int desired_follow;
int driver_camera_timer;
int map_style;
int minimum_lane_change_speed;
int model_length;
int screen_brightness = -1;
int screen_brightness_onroad = -1;
int screen_timeout;
int screen_timeout_onroad;
int started_timer;
int steering_angle_deg;
int tethering_config;
std::string speed_limit_source;
QColor lane_lines_color;
QColor lead_marker_color;
QColor path_color;
QColor path_edges_color;
QColor sidebar_color1;
QColor sidebar_color2;
QColor sidebar_color3;
QJsonObject frogpilot_toggles;
QPolygonF track_adjacent_vertices[6];
QPolygonF track_edge_vertices;
QString model;
QString model_name;
} UIScene;
class UIState : public QObject {
@@ -128,12 +308,23 @@ public:
QTransform car_space_transform;
// FrogPilot variables
Params params_memory{"/dev/shm/params"};
WifiManager *wifi = nullptr;
signals:
void uiUpdate(const UIState &s);
void offroadTransition(bool offroad);
void primeChanged(bool prime);
void primeTypeChanged(PrimeType prime_type);
// FrogPilot signals
void driveRated();
void reviewModel();
void themeUpdated();
void togglesUpdated();
private slots:
void update();
@@ -175,7 +366,7 @@ signals:
void interactiveTimeout();
public slots:
void resetInteractiveTimeout(int timeout = -1);
void resetInteractiveTimeout(int timeout = -1, int timeout_onroad = -1);
void update(const UIState &s);
};
@@ -190,3 +381,7 @@ void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &drivers
void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::XYZTData::Reader &line);
void update_line_data(const UIState *s, const cereal::XYZTData::Reader &line,
float y_off, float z_off, QPolygonF *pvd, int max_idx, bool allow_invert);
// FrogPilot functions
void ui_update_frogpilot_params(UIState *s);
void ui_update_theme(UIState *s);