1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

LP-598 Fix auto-takeoff velocity

Velocity setpoint with the wrong sign, causing the uav to remain on the ground during the first autotakeoff.
This commit is contained in:
Jan NIJS 2018-05-01 19:51:00 +02:00
parent a4c0bcfb1a
commit 18f5e76f3a

View File

@ -132,11 +132,11 @@ void VtolAutoTakeoffController::ObjectiveUpdated(void)
if (mOverride) {
// override pathDesired from PathPlanner with current position,
// as we deliberately don't care about the location of the waypoints on the map
float velocity_down;
float autotakeoff_velocity;
float autotakeoff_height;
PositionStateData positionState;
PositionStateGet(&positionState);
FlightModeSettingsAutoTakeOffVelocityGet(&velocity_down);
FlightModeSettingsAutoTakeOffVelocityGet(&autotakeoff_velocity);
FlightModeSettingsAutoTakeOffHeightGet(&autotakeoff_height);
autotakeoff_height = fabsf(autotakeoff_height);
if (autotakeoff_height < AUTOTAKEOFF_TO_INCREMENTAL_HEIGHT_MIN) {
@ -144,7 +144,7 @@ void VtolAutoTakeoffController::ObjectiveUpdated(void)
} else if (autotakeoff_height > AUTOTAKEOFF_TO_INCREMENTAL_HEIGHT_MAX) {
autotakeoff_height = AUTOTAKEOFF_TO_INCREMENTAL_HEIGHT_MAX;
}
controlDown.UpdateVelocitySetpoint(velocity_down);
controlDown.UpdateVelocitySetpoint(-autotakeoff_velocity);
controlNE.UpdateVelocitySetpoint(0.0f, 0.0f);
controlNE.UpdatePositionSetpoint(positionState.North, positionState.East);
@ -320,9 +320,9 @@ void VtolAutoTakeoffController::UpdateAutoPilot()
// 1. Arming must be done whilst in the AutoTakeOff flight mode
// 2. If the AutoTakeoff flight mode is selected and already armed, requires disarming first
// 3. Wait for armed state
// 4. Once the user increases the throttle position to above 50%, then and only then initiate auto-takeoff.
// 5. Whilst the throttle is < 50% before takeoff, all stick inputs are being ignored.
// 6. If during the autotakeoff sequence, at any stage, if the throttle stick position reduces to less than 10%, landing is initiated.
// 4. Once the user increases the throttle position to above 30%, then and only then initiate auto-takeoff.
// 5. Whilst the throttle is < 30% before takeoff, all stick inputs are being ignored.
// 6. If during the autotakeoff sequence, at any stage, the throttle stick position reduces to less than 10%, landing is initiated.
switch (autotakeoffState) {
case STATUSVTOLAUTOTAKEOFF_CONTROLSTATE_REQUIREUNARMEDFIRST: