Copter: Obey RANGEFINDER_ENABLED, AUTOTUNE_ENABLED and AC_TERRAIN build macros

This commit is contained in:
Dr.-Ing. Amilcar Do Carmo Lucas 2018-03-15 13:39:26 +01:00 committed by Francisco Ferreira
parent f63388cb07
commit 115ed491c0
3 changed files with 15 additions and 0 deletions

View File

@ -169,6 +169,7 @@ const AP_Param::Info Copter::var_info[] = {
GSCALAR(rtl_loiter_time, "RTL_LOIT_TIME", RTL_LOITER_TIME), GSCALAR(rtl_loiter_time, "RTL_LOIT_TIME", RTL_LOITER_TIME),
#endif #endif
#if RANGEFINDER_ENABLED == ENABLED
// @Param: RNGFND_GAIN // @Param: RNGFND_GAIN
// @DisplayName: Rangefinder gain // @DisplayName: Rangefinder gain
// @Description: Used to adjust the speed with which the target altitude is changed when objects are sensed below the copter // @Description: Used to adjust the speed with which the target altitude is changed when objects are sensed below the copter
@ -176,6 +177,7 @@ const AP_Param::Info Copter::var_info[] = {
// @Increment: 0.01 // @Increment: 0.01
// @User: Standard // @User: Standard
GSCALAR(rangefinder_gain, "RNGFND_GAIN", RANGEFINDER_GAIN_DEFAULT), GSCALAR(rangefinder_gain, "RNGFND_GAIN", RANGEFINDER_GAIN_DEFAULT),
#endif
// @Param: FS_BATT_ENABLE // @Param: FS_BATT_ENABLE
// @DisplayName: Battery Failsafe Enable // @DisplayName: Battery Failsafe Enable
@ -777,6 +779,7 @@ const AP_Param::Info Copter::var_info[] = {
GOBJECT(avoidance_adsb, "AVD_", AP_Avoidance_Copter), GOBJECT(avoidance_adsb, "AVD_", AP_Avoidance_Copter),
#endif #endif
#if AUTOTUNE_ENABLED == ENABLED
// @Param: AUTOTUNE_AXES // @Param: AUTOTUNE_AXES
// @DisplayName: Autotune axis bitmask // @DisplayName: Autotune axis bitmask
// @Description: 1-byte bitmap of axes to autotune // @Description: 1-byte bitmap of axes to autotune
@ -798,6 +801,7 @@ const AP_Param::Info Copter::var_info[] = {
// @Range: 0.001 0.006 // @Range: 0.001 0.006
// @User: Standard // @User: Standard
GSCALAR(autotune_min_d, "AUTOTUNE_MIN_D", 0.001f), GSCALAR(autotune_min_d, "AUTOTUNE_MIN_D", 0.001f),
#endif
// @Group: NTF_ // @Group: NTF_
// @Path: ../libraries/AP_Notify/AP_Notify.cpp // @Path: ../libraries/AP_Notify/AP_Notify.cpp
@ -812,12 +816,14 @@ const AP_Param::Info Copter::var_info[] = {
GSCALAR(throw_motor_start, "THROW_MOT_START", 0), GSCALAR(throw_motor_start, "THROW_MOT_START", 0),
#endif #endif
#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
// @Param: TERRAIN_FOLLOW // @Param: TERRAIN_FOLLOW
// @DisplayName: Terrain Following use control // @DisplayName: Terrain Following use control
// @Description: This enables terrain following for RTL and LAND flight modes. To use this option TERRAIN_ENABLE must be 1 and the GCS must support sending terrain data to the aircraft. In RTL the RTL_ALT will be considered a height above the terrain. In LAND mode the vehicle will slow to LAND_SPEED 10m above terrain (instead of 10m above home). This parameter does not affect AUTO and Guided which use a per-command flag to determine if the height is above-home, absolute or above-terrain. // @Description: This enables terrain following for RTL and LAND flight modes. To use this option TERRAIN_ENABLE must be 1 and the GCS must support sending terrain data to the aircraft. In RTL the RTL_ALT will be considered a height above the terrain. In LAND mode the vehicle will slow to LAND_SPEED 10m above terrain (instead of 10m above home). This parameter does not affect AUTO and Guided which use a per-command flag to determine if the height is above-home, absolute or above-terrain.
// @Values: 0:Do Not Use in RTL and Land,1:Use in RTL and Land // @Values: 0:Do Not Use in RTL and Land,1:Use in RTL and Land
// @User: Standard // @User: Standard
GSCALAR(terrain_follow, "TERRAIN_FOLLOW", 0), GSCALAR(terrain_follow, "TERRAIN_FOLLOW", 0),
#endif
// @Group: // @Group:
// @Path: Parameters.cpp // @Path: Parameters.cpp

View File

@ -390,7 +390,9 @@ public:
AP_Int16 rtl_altitude; AP_Int16 rtl_altitude;
AP_Int16 rtl_speed_cms; AP_Int16 rtl_speed_cms;
AP_Float rtl_cone_slope; AP_Float rtl_cone_slope;
#if RANGEFINDER_ENABLED == ENABLED
AP_Float rangefinder_gain; AP_Float rangefinder_gain;
#endif
AP_Int8 failsafe_battery_enabled; // battery failsafe enabled AP_Int8 failsafe_battery_enabled; // battery failsafe enabled
AP_Float fs_batt_voltage; // battery voltage below which failsafe will be triggered AP_Float fs_batt_voltage; // battery voltage below which failsafe will be triggered
@ -460,7 +462,10 @@ public:
#if MODE_THROW_ENABLED == ENABLED #if MODE_THROW_ENABLED == ENABLED
AP_Int8 throw_motor_start; AP_Int8 throw_motor_start;
#endif #endif
#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
AP_Int8 terrain_follow; AP_Int8 terrain_follow;
#endif
AP_Int16 rc_speed; // speed of fast RC Channels in Hz AP_Int16 rc_speed; // speed of fast RC Channels in Hz
@ -473,9 +478,11 @@ public:
AP_Float acro_rp_expo; AP_Float acro_rp_expo;
// Autotune // Autotune
#if AUTOTUNE_ENABLED == ENABLED
AP_Int8 autotune_axis_bitmask; AP_Int8 autotune_axis_bitmask;
AP_Float autotune_aggressiveness; AP_Float autotune_aggressiveness;
AP_Float autotune_min_d; AP_Float autotune_min_d;
#endif
// Note: keep initializers here in the same order as they are declared // Note: keep initializers here in the same order as they are declared
// above. // above.

View File

@ -140,10 +140,12 @@ void Copter::tuning() {
break; break;
#endif #endif
#if RANGEFINDER_ENABLED == ENABLED
case TUNING_RANGEFINDER_GAIN: case TUNING_RANGEFINDER_GAIN:
// set rangefinder gain // set rangefinder gain
g.rangefinder_gain.set(tuning_value); g.rangefinder_gain.set(tuning_value);
break; break;
#endif
#if 0 #if 0
// disabled for now - we need accessor functions // disabled for now - we need accessor functions