mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-29 20:18:31 -04:00
Plane: rapid climb in QRTL if below target altitude
This commit is contained in:
parent
4666b25258
commit
66d3668ac4
@ -1208,12 +1208,16 @@ void QuadPlane::land_controller(void)
|
|||||||
case QLAND_POSITION2:
|
case QLAND_POSITION2:
|
||||||
if (plane.control_mode == QRTL) {
|
if (plane.control_mode == QRTL) {
|
||||||
plane.ahrs.get_position(plane.current_loc);
|
plane.ahrs.get_position(plane.current_loc);
|
||||||
plane.auto_state.wp_proportion = location_path_proportion(plane.current_loc,
|
float target_altitude = plane.next_WP_loc.alt;
|
||||||
plane.prev_WP_loc, plane.next_WP_loc);
|
if (land.slow_descent) {
|
||||||
float target_altitude = linear_interpolate(plane.prev_WP_loc.alt,
|
// gradually descend as we approach target
|
||||||
plane.next_WP_loc.alt,
|
plane.auto_state.wp_proportion = location_path_proportion(plane.current_loc,
|
||||||
plane.auto_state.wp_proportion,
|
plane.prev_WP_loc, plane.next_WP_loc);
|
||||||
0, 1);
|
target_altitude = linear_interpolate(plane.prev_WP_loc.alt,
|
||||||
|
plane.next_WP_loc.alt,
|
||||||
|
plane.auto_state.wp_proportion,
|
||||||
|
0, 1);
|
||||||
|
}
|
||||||
pos_control->set_alt_target(target_altitude - plane.home.alt);
|
pos_control->set_alt_target(target_altitude - plane.home.alt);
|
||||||
} else {
|
} else {
|
||||||
pos_control->set_alt_target_from_climb_rate(0, plane.G_Dt, false);
|
pos_control->set_alt_target_from_climb_rate(0, plane.G_Dt, false);
|
||||||
@ -1370,6 +1374,7 @@ void QuadPlane::init_qrtl(void)
|
|||||||
// use do_RTL() to setup next_WP_loc
|
// use do_RTL() to setup next_WP_loc
|
||||||
plane.do_RTL(plane.home.alt + qrtl_alt*100UL);
|
plane.do_RTL(plane.home.alt + qrtl_alt*100UL);
|
||||||
plane.prev_WP_loc = plane.current_loc;
|
plane.prev_WP_loc = plane.current_loc;
|
||||||
|
land.slow_descent = (plane.current_loc.alt > plane.next_WP_loc.alt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -257,6 +257,7 @@ private:
|
|||||||
Vector2f target_velocity;
|
Vector2f target_velocity;
|
||||||
float max_speed;
|
float max_speed;
|
||||||
Vector3f target;
|
Vector3f target;
|
||||||
|
bool slow_descent:1;
|
||||||
} land;
|
} land;
|
||||||
|
|
||||||
enum frame_class {
|
enum frame_class {
|
||||||
|
Loading…
Reference in New Issue
Block a user