ui: fix flipped experimental path acceleration (#33026)

* fix

* clean up

* better comment

* Update selfdrive/ui/qt/onroad/annotated_camera.cc
old-commit-hash: 0907b30d7b
pull/33029/head
Shane Smiskol 10 months ago committed by GitHub
parent 91db4a0908
commit 6c4afa3ef2
  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