ui/get_path_length_idx: line_x[i] shoud be less than or equal to path_height (#23336)

* start loop index from 1

* use  islessequal

* use build in <=
pull/23326/head
Dean Lee 3 years ago committed by GitHub
parent 960e0cf6a7
commit 9295066dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      selfdrive/ui/ui.cc

@ -36,7 +36,7 @@ static bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y,
static int get_path_length_idx(const cereal::ModelDataV2::XYZTData::Reader &line, const float path_height) {
const auto line_x = line.getX();
int max_idx = 0;
for (int i = 0; i < TRAJECTORY_SIZE && line_x[i] < path_height; ++i) {
for (int i = 1; i < TRAJECTORY_SIZE && line_x[i] <= path_height; ++i) {
max_idx = i;
}
return max_idx;

Loading…
Cancel
Save