Visuals - Developer UI - Lateral Metrics
Display various metrics related to the lateral performance of openpilot.
This commit is contained in:
parent
5ca48bea57
commit
119e63952b
@ -351,6 +351,33 @@ void OnroadWindow::paintEvent(QPaintEvent *event) {
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
QString logicsDisplayString = QString();
|
||||
if (scene.show_tuning) {
|
||||
if (!scene.live_valid) {
|
||||
logicsDisplayString += "Friction: Calculating... | Lateral Acceleration: Calculating...";
|
||||
} else {
|
||||
logicsDisplayString += QString("Friction: %1 | Lateral Acceleration: %2")
|
||||
.arg(scene.friction, 0, 'f', 3)
|
||||
.arg(scene.lat_accel, 0, 'f', 3);
|
||||
}
|
||||
}
|
||||
if (logicsDisplayString.endsWith(" | ")) {
|
||||
logicsDisplayString.chop(3);
|
||||
}
|
||||
|
||||
if (!logicsDisplayString.isEmpty()) {
|
||||
p.setFont(InterFont(28, QFont::DemiBold));
|
||||
p.setRenderHint(QPainter::TextAntialiasing);
|
||||
p.setPen(Qt::white);
|
||||
|
||||
int logicsWidth = p.fontMetrics().horizontalAdvance(logicsDisplayString);
|
||||
int logicsX = (rect.width() - logicsWidth) / 2;
|
||||
int logicsY = rect.top() + 27;
|
||||
|
||||
p.drawText(logicsX, logicsY, logicsDisplayString);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
// ***** onroad widgets *****
|
||||
|
@ -270,6 +270,9 @@ static void update_state(UIState *s) {
|
||||
}
|
||||
if (sm.updated("liveTorqueParameters")) {
|
||||
auto torque_params = sm["liveTorqueParameters"].getLiveTorqueParameters();
|
||||
scene.friction = torque_params.getFrictionCoefficientFiltered();
|
||||
scene.lat_accel = torque_params.getLatAccelFactorFiltered();
|
||||
scene.live_valid = torque_params.getLiveValid();
|
||||
}
|
||||
if (sm.updated("wideRoadCameraState")) {
|
||||
auto cam_state = sm["wideRoadCameraState"].getWideRoadCameraState();
|
||||
@ -330,6 +333,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
scene.show_signal = border_metrics && params.getBool("SignalMetrics");
|
||||
scene.show_steering = border_metrics && params.getBool("ShowSteering");
|
||||
scene.fps_counter = developer_ui && params.getBool("FPSCounter");
|
||||
scene.show_tuning = developer_ui && scene.has_auto_tune && params.getBool("LateralMetrics");
|
||||
|
||||
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
||||
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
||||
|
@ -203,7 +203,9 @@ typedef struct UIScene {
|
||||
bool experimental_mode;
|
||||
bool experimental_mode_via_screen;
|
||||
bool fps_counter;
|
||||
bool has_auto_tune;
|
||||
bool holiday_themes;
|
||||
bool live_valid;
|
||||
bool map_open;
|
||||
bool online;
|
||||
bool onroad_distance_button;
|
||||
@ -222,6 +224,7 @@ typedef struct UIScene {
|
||||
bool show_slc_offset;
|
||||
bool show_slc_offset_ui;
|
||||
bool show_steering;
|
||||
bool show_tuning;
|
||||
bool speed_limit_changed;
|
||||
bool speed_limit_controller;
|
||||
bool speed_limit_overridden;
|
||||
@ -237,9 +240,11 @@ typedef struct UIScene {
|
||||
bool vtsc_controlling_curve;
|
||||
|
||||
float adjusted_cruise;
|
||||
float friction;
|
||||
float lane_detection_width;
|
||||
float lane_width_left;
|
||||
float lane_width_right;
|
||||
float lat_accel;
|
||||
float lead_detection_threshold;
|
||||
float speed_limit;
|
||||
float speed_limit_offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user