ui: fix flipped experimental path acceleration (#33026)

* fix

* clean up

* better comment

* Update selfdrive/ui/qt/onroad/annotated_camera.cc
pull/33031/head
Shane Smiskol 11 months ago committed by GitHub
parent 07fcc4825f
commit 0907b30d7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      selfdrive/ui/qt/onroad/annotated_camera.cc

@ -177,10 +177,11 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
for (int i = 0; i < max_len; ++i) {
// Some points are out of frame
if (scene.track_vertices[i].y() < 0 || scene.track_vertices[i].y() > height()) continue;
int track_idx = (scene.track_vertices.length() / 2) - i; // flip idx to start from top
if (scene.track_vertices[track_idx].y() < 0 || scene.track_vertices[track_idx].y() > height()) continue;
// Flip so 0 is bottom of frame
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
float lin_grad_point = (height() - scene.track_vertices[track_idx].y()) / height();
// speed up: 120, slow down: 0
float path_hue = fmax(fmin(60 + acceleration[i] * 35, 120), 0);

Loading…
Cancel
Save