mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-28 19:33:44 +08:00
ui: fix flipped experimental path acceleration (#33026)
* fix
* clean up
* better comment
* Update selfdrive/ui/qt/onroad/annotated_camera.cc
old-commit-hash: 0907b30d7b
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user