mirror of https://github.com/ArduPilot/ardupilot
Copter: add RTL_CONE_SLOPE
This commit is contained in:
parent
dcd16696a2
commit
3800c66f07
|
@ -128,6 +128,14 @@ const AP_Param::Info Copter::var_info[] = {
|
|||
// @User: Standard
|
||||
GSCALAR(rtl_altitude, "RTL_ALT", RTL_ALT),
|
||||
|
||||
// @Param: RTL_CONE_SLOPE
|
||||
// @DisplayName: RTL cone slope
|
||||
// @Description: Defines a cone above home which determines maximum climb
|
||||
// @Range: 0.5 10.0
|
||||
// @Increment: .1
|
||||
// @User: Standard
|
||||
GSCALAR(rtl_cone_slope, "RTL_CONE_SLOPE", RTL_CONE_SLOPE),
|
||||
|
||||
// @Param: RTL_SPEED
|
||||
// @DisplayName: RTL speed
|
||||
// @Description: Defines the speed in cm/s which the aircraft will attempt to maintain horizontally while flying home. If this is set to zero, WPNAV_SPEED will be used instead.
|
||||
|
|
|
@ -217,7 +217,8 @@ public:
|
|||
// 135 : reserved for Solo until features merged with master
|
||||
//
|
||||
k_param_rtl_speed_cms = 135,
|
||||
k_param_fs_batt_curr_rtl, // 136
|
||||
k_param_fs_batt_curr_rtl,
|
||||
k_param_rtl_cone_slope, // 137
|
||||
|
||||
//
|
||||
// 140: Sensor parameters
|
||||
|
@ -380,6 +381,7 @@ public:
|
|||
|
||||
AP_Int16 rtl_altitude;
|
||||
AP_Int16 rtl_speed_cms;
|
||||
AP_Float rtl_cone_slope;
|
||||
AP_Float sonar_gain;
|
||||
|
||||
AP_Int8 failsafe_battery_enabled; // battery failsafe enabled
|
||||
|
|
|
@ -484,10 +484,22 @@
|
|||
# define RTL_ALT 1500 // default alt to return to home in cm, 0 = Maintain current altitude
|
||||
#endif
|
||||
|
||||
#ifndef RTL_CONE_SLOPE
|
||||
# define RTL_CONE_SLOPE 3.0f // slope of RTL cone. 0 = No cone
|
||||
#endif
|
||||
|
||||
#ifndef RTL_ALT_MIN
|
||||
# define RTL_ALT_MIN 200 // min height above ground for RTL (i.e 2m)
|
||||
#endif
|
||||
|
||||
#ifndef RTL_ABS_MIN_CLIMB
|
||||
# define RTL_ABS_MIN_CLIMB 250 // absolute minimum initial climb
|
||||
#endif
|
||||
|
||||
#ifndef RTL_MIN_CONE_SLOPE
|
||||
# define RTL_MIN_CONE_SLOPE 0.5f // absolute minimum initial climb
|
||||
#endif
|
||||
|
||||
#ifndef RTL_CLIMB_MIN_DEFAULT
|
||||
# define RTL_CLIMB_MIN_DEFAULT 0 // vehicle will always climb this many cm as first stage of RTL
|
||||
#endif
|
||||
|
|
|
@ -430,6 +430,10 @@ float Copter::rtl_compute_return_alt_above_origin(float rtl_return_dist)
|
|||
// maximum of current altitude + climb_min and rtl altitude
|
||||
float ret = MAX(current_loc.alt + MAX(0, g.rtl_climb_min), MAX(g.rtl_altitude, RTL_ALT_MIN));
|
||||
|
||||
if (g.rtl_cone_slope >= RTL_MIN_CONE_SLOPE) { // don't allow really shallow slopes
|
||||
ret = MAX(current_loc.alt, MIN(ret, MAX(rtl_return_dist*g.rtl_cone_slope, current_loc.alt+RTL_ABS_MIN_CLIMB)));
|
||||
}
|
||||
|
||||
#if AC_FENCE == ENABLED
|
||||
// ensure not above fence altitude if alt fence is enabled
|
||||
if ((fence.get_enabled_fences() & AC_FENCE_TYPE_ALT_MAX) != 0) {
|
||||
|
|
Loading…
Reference in New Issue