Skip to content

Commit

Permalink
MpcTracker: fxd bug with under-safety-area takeoff
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Mar 6, 2024
1 parent 8b70172 commit 67655a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mpc_tracker/mpc_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,14 +1790,15 @@ double MpcTracker::checkTrajectoryForCollisions(int& first_collision_index) {
}
u++;
}

if (!avoiding_collision_) {

auto dt1 = mrs_lib::get_mutexed(mutex_dt1_, dt1_);

// 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);

double safety_area_min_z = common_handlers_->safety_area.getMinZ("");
double safety_area_min_z = std::numeric_limits<double>::lowest();

if (collision_free_altitude_ < safety_area_min_z) {

Expand Down Expand Up @@ -2059,7 +2060,7 @@ void MpcTracker::calculateMPC() {

} else {

minimum_collison_free_altitude_ = common_handlers_->safety_area.getMinZ("");
minimum_collison_free_altitude_ = std::numeric_limits<double>::lowest();
}

double max_speed_x = constraints.horizontal_speed;
Expand Down

0 comments on commit 67655a3

Please sign in to comment.