FwPositionControl: don't do takeoff help for vtol

- takeoff help is used for fixed wings, it increases the altitude setpoint
after a launch. A vtol does not need this as it's already sufficiently
high up in the air.

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2018-07-26 09:29:54 +02:00 committed by Daniel Agar
parent 5d7a82b8e2
commit 2bd8b517c5
1 changed files with 13 additions and 11 deletions

View File

@ -783,6 +783,11 @@ FixedwingPositionControl::update_desired_altitude(float dt)
bool bool
FixedwingPositionControl::in_takeoff_situation() FixedwingPositionControl::in_takeoff_situation()
{ {
// a VTOL does not need special takeoff handling
if (_vehicle_status.is_vtol) {
return false;
}
// in air for < 10s // in air for < 10s
const hrt_abstime delta_takeoff = 10_s; const hrt_abstime delta_takeoff = 10_s;
@ -797,9 +802,6 @@ FixedwingPositionControl::do_takeoff_help(float *hold_altitude, float *pitch_lim
if (in_takeoff_situation()) { if (in_takeoff_situation()) {
*hold_altitude = _takeoff_ground_alt + _parameters.climbout_diff; *hold_altitude = _takeoff_ground_alt + _parameters.climbout_diff;
*pitch_limit_min = radians(10.0f); *pitch_limit_min = radians(10.0f);
} else {
*pitch_limit_min = _parameters.pitch_limit_min;
} }
} }
@ -1041,10 +1043,10 @@ FixedwingPositionControl::control_position(const Vector2f &curr_pos, const Vecto
/* update desired altitude based on user pitch stick input */ /* update desired altitude based on user pitch stick input */
bool climbout_requested = update_desired_altitude(dt); bool climbout_requested = update_desired_altitude(dt);
/* if we assume that user is taking off then help by demanding altitude setpoint well above ground // if we assume that user is taking off then help by demanding altitude setpoint well above ground
* and set limit to pitch angle to prevent stearing into ground // and set limit to pitch angle to prevent steering into ground
*/ // this will only affect planes and not VTOL
float pitch_limit_min{0.0f}; float pitch_limit_min = _parameters.pitch_limit_min;
do_takeoff_help(&_hold_alt, &pitch_limit_min); do_takeoff_help(&_hold_alt, &pitch_limit_min);
/* throttle limiting */ /* throttle limiting */
@ -1143,10 +1145,10 @@ FixedwingPositionControl::control_position(const Vector2f &curr_pos, const Vecto
/* update desired altitude based on user pitch stick input */ /* update desired altitude based on user pitch stick input */
bool climbout_requested = update_desired_altitude(dt); bool climbout_requested = update_desired_altitude(dt);
/* if we assume that user is taking off then help by demanding altitude setpoint well above ground // if we assume that user is taking off then help by demanding altitude setpoint well above ground
* and set limit to pitch angle to prevent stearing into ground // and set limit to pitch angle to prevent steering into ground
*/ // this will only affect planes and not VTOL
float pitch_limit_min{0.0f}; float pitch_limit_min = _parameters.pitch_limit_min;
do_takeoff_help(&_hold_alt, &pitch_limit_min); do_takeoff_help(&_hold_alt, &pitch_limit_min);
/* throttle limiting */ /* throttle limiting */