Skip to content

Commit

Permalink
Copter: Obey RANGEFINDER_ENABLED, AUTOTUNE_ENABLED and AC_TERRAIN bui…
Browse files Browse the repository at this point in the history
…ld macros
  • Loading branch information
amilcarlucas authored and OXINARF committed Mar 15, 2018
1 parent f63388c commit 115ed49
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ArduCopter/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ const AP_Param::Info Copter::var_info[] = {
GSCALAR(rtl_loiter_time, "RTL_LOIT_TIME", RTL_LOITER_TIME),
#endif

#if RANGEFINDER_ENABLED == ENABLED
// @Param: RNGFND_GAIN
// @DisplayName: Rangefinder gain
// @Description: Used to adjust the speed with which the target altitude is changed when objects are sensed below the copter
// @Range: 0.01 2.0
// @Increment: 0.01
// @User: Standard
GSCALAR(rangefinder_gain, "RNGFND_GAIN", RANGEFINDER_GAIN_DEFAULT),
#endif

// @Param: FS_BATT_ENABLE
// @DisplayName: Battery Failsafe Enable
Expand Down Expand Up @@ -777,6 +779,7 @@ const AP_Param::Info Copter::var_info[] = {
GOBJECT(avoidance_adsb, "AVD_", AP_Avoidance_Copter),
#endif

#if AUTOTUNE_ENABLED == ENABLED
// @Param: AUTOTUNE_AXES
// @DisplayName: Autotune axis bitmask
// @Description: 1-byte bitmap of axes to autotune
Expand All @@ -798,6 +801,7 @@ const AP_Param::Info Copter::var_info[] = {
// @Range: 0.001 0.006
// @User: Standard
GSCALAR(autotune_min_d, "AUTOTUNE_MIN_D", 0.001f),
#endif

// @Group: NTF_
// @Path: ../libraries/AP_Notify/AP_Notify.cpp
Expand All @@ -812,12 +816,14 @@ const AP_Param::Info Copter::var_info[] = {
GSCALAR(throw_motor_start, "THROW_MOT_START", 0),
#endif

#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
// @Param: TERRAIN_FOLLOW
// @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.
// @Values: 0:Do Not Use in RTL and Land,1:Use in RTL and Land
// @User: Standard
GSCALAR(terrain_follow, "TERRAIN_FOLLOW", 0),
#endif

// @Group:
// @Path: Parameters.cpp
Expand Down
7 changes: 7 additions & 0 deletions ArduCopter/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ class Parameters {
AP_Int16 rtl_altitude;
AP_Int16 rtl_speed_cms;
AP_Float rtl_cone_slope;
#if RANGEFINDER_ENABLED == ENABLED
AP_Float rangefinder_gain;
#endif

AP_Int8 failsafe_battery_enabled; // battery failsafe enabled
AP_Float fs_batt_voltage; // battery voltage below which failsafe will be triggered
Expand Down Expand Up @@ -460,7 +462,10 @@ class Parameters {
#if MODE_THROW_ENABLED == ENABLED
AP_Int8 throw_motor_start;
#endif

#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
AP_Int8 terrain_follow;
#endif

AP_Int16 rc_speed; // speed of fast RC Channels in Hz

Expand All @@ -473,9 +478,11 @@ class Parameters {
AP_Float acro_rp_expo;

// Autotune
#if AUTOTUNE_ENABLED == ENABLED
AP_Int8 autotune_axis_bitmask;
AP_Float autotune_aggressiveness;
AP_Float autotune_min_d;
#endif

// Note: keep initializers here in the same order as they are declared
// above.
Expand Down
2 changes: 2 additions & 0 deletions ArduCopter/tuning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ void Copter::tuning() {
break;
#endif

#if RANGEFINDER_ENABLED == ENABLED
case TUNING_RANGEFINDER_GAIN:
// set rangefinder gain
g.rangefinder_gain.set(tuning_value);
break;
#endif

#if 0
// disabled for now - we need accessor functions
Expand Down

0 comments on commit 115ed49

Please sign in to comment.