Skip to content

Commit ec9b867

Browse files
committed
LP-598 clean-ups
- AltitudeAtState is corrected to be a positive altitude above ground. - remove unneeded call to StabilizationDesiredGet() - update timeout values in descriptions so they match the code
1 parent 18f5e76 commit ec9b867

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

flight/modules/PathFollower/vtolautotakeofffsm.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ void VtolAutoTakeoffFSM::setState(StatusVtolAutoTakeoffStateOptions newState, St
248248
if (newState != STATUSVTOLAUTOTAKEOFF_STATE_INACTIVE) {
249249
PositionStateData positionState;
250250
PositionStateGet(&positionState);
251-
float takeOffDown = 0.0f;
251+
float altitudeAboveGround = 0.0f;
252252
if (mAutoTakeoffData->takeOffLocation.Status == TAKEOFFLOCATION_STATUS_VALID) {
253-
takeOffDown = mAutoTakeoffData->takeOffLocation.Down;
253+
altitudeAboveGround = mAutoTakeoffData->takeOffLocation.Down - positionState.Down;
254254
}
255-
mAutoTakeoffData->fsmAutoTakeoffStatus.AltitudeAtState[newState] = positionState.Down - takeOffDown;
255+
mAutoTakeoffData->fsmAutoTakeoffStatus.AltitudeAtState[newState] = altitudeAboveGround;
256256
assessAltitude();
257257
}
258258

@@ -266,6 +266,7 @@ void VtolAutoTakeoffFSM::setState(StatusVtolAutoTakeoffStateOptions newState, St
266266
(this->*sAutoTakeoffStateTable[mAutoTakeoffData->currentState].setup)();
267267
}
268268

269+
// Update StatusVtolAutoTakeoff UAVObject with new status
269270
updateVtolAutoTakeoffFSMStatus();
270271
}
271272

@@ -276,6 +277,7 @@ void VtolAutoTakeoffFSM::setStateTimeout(int32_t count)
276277
mAutoTakeoffData->stateTimeoutCount = count;
277278
}
278279

280+
// Update StatusVtolAutoTakeoff UAVObject
279281
void VtolAutoTakeoffFSM::updateVtolAutoTakeoffFSMStatus()
280282
{
281283
mAutoTakeoffData->fsmAutoTakeoffStatus.State = mAutoTakeoffData->currentState;
@@ -347,10 +349,10 @@ void VtolAutoTakeoffFSM::setup_checkstate(void)
347349
// Assumptions that do not need to be checked if flight mode is AUTOTAKEOFF
348350
// 1. Already armed
349351
// 2. Not in flight. This was checked in plans.c
350-
// 3. User has placed throttle position to more than 50% to allow autotakeoff
352+
// 3. User has placed throttle position to more than 30% to allow autotakeoff
351353

352354
// If pathplanner, we need additional checks
353-
// E.g. if inflight, this mode is just positon hol
355+
// E.g. if inflight, this mode is just position hold
354356
StabilizationDesiredData stabDesired;
355357

356358
StabilizationDesiredGet(&stabDesired);
@@ -407,15 +409,13 @@ void VtolAutoTakeoffFSM::run_slowstart(__attribute__((unused)) uint8_t flTimeout
407409
}
408410
}
409411

410-
// STATE: THRUSTUP spools up motors to vtol min over 5 seconds for effect.
412+
// STATE: THRUSTUP spools up motors to vtol min over 1 second for effect.
411413
// PID loops may be cumulating I terms but that problem needs to be solved
412414
#define THRUSTUP_FINAL_THRUST_AS_RATIO_OF_VTOLMAX 0.8f
413415
void VtolAutoTakeoffFSM::setup_thrustup(void)
414416
{
415417
setStateTimeout(TIMEOUT_THRUSTUP);
416418
mAutoTakeoffData->flZeroStabiHorizontal = false;
417-
StabilizationDesiredData stabDesired;
418-
StabilizationDesiredGet(&stabDesired);
419419
mAutoTakeoffData->sum2 = THRUSTUP_FINAL_THRUST_AS_RATIO_OF_VTOLMAX * vtolPathFollowerSettings->ThrustLimits.Max;
420420
mAutoTakeoffData->sum1 = (mAutoTakeoffData->sum2 - mAutoTakeoffData->boundThrustMax) / (float)TIMEOUT_THRUSTUP;
421421
mAutoTakeoffData->boundThrustMin = vtolPathFollowerSettings->ThrustLimits.Min;

0 commit comments

Comments
 (0)