Skip to content

Commit

Permalink
AP_NavEKF3: don't fuse zero distance
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Aug 11, 2024
1 parent 46ebfcc commit 088ece0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/AP_NavEKF3/AP_NavEKF3_RngBcnFusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ void NavEKF3_core::SelectRngBcnFusion()
rngBcn.receiverPos.zero();
// correct for time offset and range rate
Vector3F deltaPosNED = stateStruct.position - dataDelayed.beacon_posNED;
const ftype rangeRate = stateStruct.velocity.xy()*(deltaPosNED.xy().normalized());
const auto &deltaxy = deltaPosNED.xy();
if (deltaxy.length() < 1) {
continue;
}
const ftype rangeRate = stateStruct.velocity.xy()*(deltaxy.normalized());
ftype delaySec = 0.001f * (ftype)((double)dataDelayed.delay_ms + (double)imuDataDelayed.time_ms - (double)dataDelayed.time_ms);
delaySec = constrain_ftype(delaySec, -1.0f, 1.0f);
const ftype rangeCorrection = delaySec * rangeRate;
Expand Down

0 comments on commit 088ece0

Please sign in to comment.