Skip to content

Commit

Permalink
Plane: Fix indent in soaring.cpp, use Vector2f.zero() and expand comm…
Browse files Browse the repository at this point in the history
…ent.
  • Loading branch information
samuelctabor committed Jul 21, 2020
1 parent 18f09ec commit 17a44b6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ArduPlane/soaring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ void Plane::update_soaring() {
set_mode(mode_rtl, ModeReason::SOARING_DRIFT_EXCEEDED);
}

// If previous mode was AUTO and there was a previous NAV command, we can use previous and next wps for drift calculation.
// If previous mode was AUTO and there was a previous NAV command, we can use previous and next wps for drift calculation
// with respect to the desired direction of travel. If these vectors are zero, drift will be calculated from thermal start
// position only, without taking account of the desired direction of travel.
Vector2f prev_wp, next_wp;

if (previous_mode->mode_number() == Mode::Number::AUTO) {
AP_Mission::Mission_Command current_nav_cmd = mission.get_current_nav_cmd();
AP_Mission::Mission_Command prev_nav_cmd;

if (!(mission.get_next_nav_cmd(mission.get_prev_nav_cmd_with_wp_index(), prev_nav_cmd) &&
prev_nav_cmd.content.location.get_vector_xy_from_origin_NE(prev_wp) &&
prev_nav_cmd.content.location.get_vector_xy_from_origin_NE(prev_wp) &&
current_nav_cmd.content.location.get_vector_xy_from_origin_NE(next_wp))) {
prev_wp.x = 0.0;
prev_wp.y = 0.0;
next_wp.x = 0.0;
next_wp.y = 0.0;
prev_wp.zero();
next_wp.zero();
}
}

Expand Down

0 comments on commit 17a44b6

Please sign in to comment.