Skip to content

Commit

Permalink
ui: fix flipped experimental path acceleration (#33026)
Browse files Browse the repository at this point in the history
* fix

* clean up

* better comment

* Update selfdrive/ui/qt/onroad/annotated_camera.cc
  • Loading branch information
sshane authored Jul 19, 2024
1 parent 07fcc48 commit 0907b30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions selfdrive/ui/qt/onroad/annotated_camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0907b30

Please sign in to comment.