Skip to content

Commit

Permalink
optimized queries for min_z
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Oct 5, 2023
1 parent dcbae87 commit 96837ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mpc_tracker/mpc_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1814,9 +1814,11 @@ double MpcTracker::checkTrajectoryForCollisions(int& first_collision_index) {
// we are not avoiding any collisions, so we slowly reduce the collision avoidance offset to return to normal flight
collision_free_altitude_ -= 2.0 / (1.0 / dt1);

if (collision_free_altitude_ < common_handlers_->safety_area.getMinZ()) {
double safety_area_min_z = common_handlers_->safety_area.getMinZ();

collision_free_altitude_ = common_handlers_->safety_area.getMinZ();
if (collision_free_altitude_ < safety_area_min_z) {

collision_free_altitude_ = safety_area_min_z;
}
}

Expand Down

0 comments on commit 96837ac

Please sign in to comment.