Skip to content

Commit

Permalink
land_detector: added parameter for manual position stick takeoff thre…
Browse files Browse the repository at this point in the history
…shold
  • Loading branch information
MaEtUgR committed Feb 28, 2017
1 parent 9c2dd48 commit fe10b9e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/land_detector/MulticopterLandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ MulticopterLandDetector::MulticopterLandDetector() : LandDetector(),
_paramHandle.freefall_trigger_time = param_find("LNDMC_FFALL_TTRI");
_paramHandle.manual_stick_down_threshold = param_find("LNDMC_MAN_DWNTHR");
_paramHandle.altitude_max = param_find("LNDMC_ALT_MAX");
_paramHandle.manual_stick_up_position_takeoff_threshold = param_find("LNDMC_POS_UPTHR");
}

void MulticopterLandDetector::_initialize_topics()
Expand Down Expand Up @@ -125,7 +126,7 @@ void MulticopterLandDetector::_update_params()
_freefall_hysteresis.set_hysteresis_time_from(false, (hrt_abstime)(1e6f * _params.freefall_trigger_time));
param_get(_paramHandle.manual_stick_down_threshold, &_params.manual_stick_down_threshold);
param_get(_paramHandle.altitude_max, &_params.altitude_max);

param_get(_paramHandle.manual_stick_up_position_takeoff_threshold, &_params.manual_stick_up_position_takeoff_threshold);
}


Expand Down Expand Up @@ -273,7 +274,7 @@ float MulticopterLandDetector::_get_takeoff_throttle()
/* Should be above 0.5 because below that we do not gain altitude and won't take off.
* Also it should be quite high such that we don't accidentally take off when using
* a spring loaded throttle and have a useful vertical speed to start with. */
return 0.75f;
return _params.manual_stick_up_position_takeoff_threshold;
}

/* Manual/attitude mode */
Expand Down
2 changes: 2 additions & 0 deletions src/modules/land_detector/MulticopterLandDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class MulticopterLandDetector : public LandDetector
param_t freefall_trigger_time;
param_t manual_stick_down_threshold;
param_t altitude_max;
param_t manual_stick_up_position_takeoff_threshold;
} _paramHandle;

struct {
Expand All @@ -108,6 +109,7 @@ class MulticopterLandDetector : public LandDetector
float freefall_trigger_time;
float manual_stick_down_threshold;
float altitude_max;
float manual_stick_up_position_takeoff_threshold;
} _params;

int _vehicleLocalPositionSub;
Expand Down
14 changes: 14 additions & 0 deletions src/modules/land_detector/land_detector_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ PARAM_DEFINE_FLOAT(LNDMC_FFALL_TTRI, 0.3);
*/
PARAM_DEFINE_FLOAT(LNDMC_MAN_DWNTHR, 0.15f);

/**
* Manual position flight stick up threshold for taking off
*
* When controlling manually in position mode the throttle stick value (0 to 1)
* has to get above this threshold after arming in order to take off.
*
* @min 0
* @max 1
* @decimal 2
*
* @group Land Detector
*/
PARAM_DEFINE_FLOAT(LNDMC_POS_UPTHR, 0.65f);

/**
* Fixedwing max horizontal velocity
*
Expand Down

0 comments on commit fe10b9e

Please sign in to comment.