Quantcast
Channel: ArduPilot Discourse - Latest topics
Viewing all articles
Browse latest Browse all 46988

A small problem in EKF2/3 in function NavEKF3_core::alignMagStateDeclination()

$
0
0

@luweikxy wrote:

Hello, I find a small problem in EKF2/3 in function NavEKF3_core::alignMagStateDeclination(), this function calls function NavEKF3_core::FuseDeclination(float declErr), the question is that FuseDeclination() here seems no useful. Because that in alignMagStateDeclination(), stateStruct.earth_magfield has already been set to:

stateStruct.earth_magfield.x = magLengthNE cosf(magDecAng);
stateStruct.earth_magfield.y = magLengthNE sinf(magDecAng);
So in FuseDeclination(), this peice os code eques to zero:

// Calculate the innovation
float innovation = atan2f(magE , magN) - magDecAng;
Why innovation is zero? Because here:

float magN = stateStruct.earth_magfield.x; = magLengthNE cosf(magDecAng);
float magE = stateStruct.earth_magfield.y; = magLengthNE sinf(magDecAng);
So atan2f(magE , magN) = magDecAng! Because both magDecAng in the two function are set by

float magDecAng = use_compass() ? ahrs->getcompass()->get_declination() : 0;
and called very closely, so the two magDecAng are supposed to the same. So the innovation is zero, so FuseDeclination() called here seems of no ues, the only use I think is to reduce the P (error between estimated value and true value).

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 46988


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>