mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Avoidance: Change the determination place of the index value.
This commit is contained in:
parent
c7a89d5aa0
commit
75f744591e
@ -213,15 +213,15 @@ void AP_Avoidance::add_obstacle(const uint32_t obstacle_timestamp_ms,
|
|||||||
} else if (oldest_timestamp < obstacle_timestamp_ms) {
|
} else if (oldest_timestamp < obstacle_timestamp_ms) {
|
||||||
// replace this very old entry with this new data
|
// replace this very old entry with this new data
|
||||||
index = oldest_index;
|
index = oldest_index;
|
||||||
|
} else {
|
||||||
|
// no room for this (old?!) data
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_obstacles[index].src = src;
|
_obstacles[index].src = src;
|
||||||
_obstacles[index].src_id = src_id;
|
_obstacles[index].src_id = src_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == -1) {
|
|
||||||
// no room for this (old?!) data
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_obstacles[index]._location = loc;
|
_obstacles[index]._location = loc;
|
||||||
_obstacles[index]._velocity = vel_ned;
|
_obstacles[index]._velocity = vel_ned;
|
||||||
_obstacles[index].timestamp_ms = obstacle_timestamp_ms;
|
_obstacles[index].timestamp_ms = obstacle_timestamp_ms;
|
||||||
|
Loading…
Reference in New Issue
Block a user