Skip to content

Commit

Permalink
Plane: Remove takeoff recalculation dead code
Browse files Browse the repository at this point in the history
The takeoff calculation changes introduced in c15fa7b and 6ce6ef8 mean
the heading no longer gets recalculated at TKOFF_LVL_ALT. Removed the
related code as it never runs.
  • Loading branch information
rubenp02 committed Jan 15, 2025
1 parent 64bb0ad commit b39795c
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions ArduPlane/mode_takeoff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,6 @@ void ModeTakeoff::update()
gcs().send_text(MAV_SEVERITY_INFO, "Autoland direction= %u",int(plane.takeoff_state.initial_direction.heading));
}
#endif
// We update the waypoint to follow once we're past TKOFF_LVL_ALT or we
// pass the target location. The check for target location prevents us
// flying towards a wrong location if we can't climb.
// This will correct any yaw estimation errors (caused by EKF reset
// or compass interference from max throttle), since it's using position bearing.
const float altitude_cm = plane.current_loc.alt - start_loc.alt;
if (plane.flight_stage == AP_FixedWing::FlightStage::TAKEOFF
&& plane.steer_state.hold_course_cd == -1 // This is the enter-once flag.
&& (altitude_cm >= (level_alt * 100.0f) || start_loc.get_distance(plane.current_loc) >= dist)
) {
const float direction = start_loc.get_bearing_to(plane.current_loc) * 0.01;
plane.next_WP_loc = start_loc;
plane.next_WP_loc.offset_bearing(direction, dist);
plane.next_WP_loc.alt += alt*100.0;
plane.steer_state.hold_course_cd = wrap_360_cd(direction*100); // Necessary to allow Plane::takeoff_calc_roll() to function.
}

// We finish the initial level takeoff if we climb past
// TKOFF_ALT or we pass the target location. The check for
// target location prevents us flying forever if we can't climb.
Expand Down

0 comments on commit b39795c

Please sign in to comment.