Skip to content

Commit

Permalink
Sub: set inFlight to true if sub descends or rangefinder value decreases
Browse files Browse the repository at this point in the history
  • Loading branch information
clydemcqueen committed Jun 24, 2024
1 parent ca42df2 commit 423c019
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/AP_NavEKF3/AP_NavEKF3_VehicleStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,17 @@ void NavEKF3_core::detectFlight()
}

if (!onGround) {
#if APM_BUILD_TYPE(APM_BUILD_ArduSub)
// If depth has increased since arming, then we definitely are diving
if ((stateStruct.position.z - posDownAtTakeoff) > 1.5f) {
inFlight = true;
}

// If rangefinder has decreased since arming, then we definitely are diving
if ((rangeDataNew.rng - rngAtStartOfFlight) < -0.5f) {
inFlight = true;
}
#else
// If height has increased since exiting on-ground, then we definitely are flying
if ((stateStruct.position.z - posDownAtTakeoff) < -1.5f) {
inFlight = true;
Expand All @@ -392,6 +403,7 @@ void NavEKF3_core::detectFlight()
if ((rangeDataNew.rng - rngAtStartOfFlight) > 0.5f) {
inFlight = true;
}
#endif

// If more than 5 seconds since likely_flying was set
// true, then set inFlight true
Expand Down

0 comments on commit 423c019

Please sign in to comment.