Skip to content

Commit

Permalink
FwPositionControl: don't do takeoff help for vtol
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
RomanBapst authored and dagar committed Apr 30, 2019
1 parent 5d7a82b commit 2bd8b51
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,11 @@ FixedwingPositionControl::update_desired_altitude(float dt)
bool
FixedwingPositionControl::in_takeoff_situation()
{
// a VTOL does not need special takeoff handling
if (_vehicle_status.is_vtol) {
return false;
}

// in air for < 10s
const hrt_abstime delta_takeoff = 10_s;

Expand All @@ -797,9 +802,6 @@ FixedwingPositionControl::do_takeoff_help(float *hold_altitude, float *pitch_lim
if (in_takeoff_situation()) {
*hold_altitude = _takeoff_ground_alt + _parameters.climbout_diff;
*pitch_limit_min = radians(10.0f);

} else {
*pitch_limit_min = _parameters.pitch_limit_min;
}
}

Expand Down Expand Up @@ -1041,10 +1043,10 @@ FixedwingPositionControl::control_position(const Vector2f &curr_pos, const Vecto
/* update desired altitude based on user pitch stick input */
bool climbout_requested = update_desired_altitude(dt);

/* 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
*/
float pitch_limit_min{0.0f};
// 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 steering into ground
// this will only affect planes and not VTOL
float pitch_limit_min = _parameters.pitch_limit_min;
do_takeoff_help(&_hold_alt, &pitch_limit_min);

/* throttle limiting */
Expand Down Expand Up @@ -1143,10 +1145,10 @@ FixedwingPositionControl::control_position(const Vector2f &curr_pos, const Vecto
/* update desired altitude based on user pitch stick input */
bool climbout_requested = update_desired_altitude(dt);

/* 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
*/
float pitch_limit_min{0.0f};
// 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 steering into ground
// this will only affect planes and not VTOL
float pitch_limit_min = _parameters.pitch_limit_min;
do_takeoff_help(&_hold_alt, &pitch_limit_min);

/* throttle limiting */
Expand Down

0 comments on commit 2bd8b51

Please sign in to comment.