Skip to content

Commit

Permalink
FW RWTO: add throttle_ramp_time parameter RWTO_RAMP_TIME
Browse files Browse the repository at this point in the history
 * add throttle_ramp_time parameter support fixed wing runway takeoff
  • Loading branch information
jinchengde authored and dagar committed Oct 14, 2019
1 parent 7e2fb6b commit 13c3ae3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ RunwayTakeoff::RunwayTakeoff(ModuleParams *parent) :
_initialized(false),
_initialized_time(0),
_init_yaw(0),
_climbout(false),
_throttle_ramp_time(2 * 1e6)
_climbout(false)
{
}

Expand All @@ -79,7 +78,7 @@ void RunwayTakeoff::update(float airspeed, float alt_agl,

switch (_state) {
case RunwayTakeoffState::THROTTLE_RAMP:
if (hrt_elapsed_time(&_initialized_time) > _throttle_ramp_time) {
if (hrt_elapsed_time(&_initialized_time) > _param_rwto_ramp_time.get() * 1e6f) {
_state = RunwayTakeoffState::CLAMPED_TO_RUNWAY;
}

Expand Down Expand Up @@ -195,7 +194,7 @@ float RunwayTakeoff::getThrottle(float tecsThrottle)
{
switch (_state) {
case RunwayTakeoffState::THROTTLE_RAMP: {
float throttle = hrt_elapsed_time(&_initialized_time) / (float)_throttle_ramp_time *
float throttle = (hrt_elapsed_time(&_initialized_time) / (float)_param_rwto_ramp_time.get() * 1e6f) *
_param_rwto_max_thr.get();
return throttle < _param_rwto_max_thr.get() ?
throttle :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class __EXPORT RunwayTakeoff : public ModuleParams
hrt_abstime _initialized_time;
float _init_yaw;
bool _climbout;
unsigned _throttle_ramp_time;
matrix::Vector2f _start_wp;

DEFINE_PARAMETERS(
Expand All @@ -110,6 +109,7 @@ class __EXPORT RunwayTakeoff : public ModuleParams
(ParamFloat<px4::params::RWTO_MAX_PITCH>) _param_rwto_max_pitch,
(ParamFloat<px4::params::RWTO_MAX_ROLL>) _param_rwto_max_roll,
(ParamFloat<px4::params::RWTO_AIRSPD_SCL>) _param_rwto_airspd_scl,
(ParamFloat<px4::params::RWTO_RAMP_TIME>) _param_rwto_ramp_time,
(ParamFloat<px4::params::FW_AIRSPD_MIN>) _param_fw_airspd_min,
(ParamFloat<px4::params::FW_CLMBOUT_DIFF>) _param_fw_clmbout_diff
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,15 @@ PARAM_DEFINE_FLOAT(RWTO_MAX_ROLL, 25.0);
* @group Runway Takeoff
*/
PARAM_DEFINE_FLOAT(RWTO_AIRSPD_SCL, 1.3);

/**
* Throttle ramp up time for runway takeoff
*
* @unit s
* @min 1.0
* @max 15.0
* @decimal 2
* @increment 0.1
* @group Runway Takeoff
*/
PARAM_DEFINE_FLOAT(RWTO_RAMP_TIME, 2.0f);

0 comments on commit 13c3ae3

Please sign in to comment.