Skip to main content
. 2019 Mar 20;10(3):198. doi: 10.3390/mi10030198
Algorithm 1 Two-stage EKF for WiFi/MEMS integration.
Step 1: Initialize the attitude-determination EKF
D^0=[0.5π  0  0]T, P10=diag([111]), k=1
Step 2: Attitude-determination EKF
Fk−1=(∂fk−1/∂D)|D^k−1+, where fk−1(·) is the system model defined in Equation (12)
P1k−=Fk−1P1,k−1+Fk−1T+Q1,k−1
D^k−=fk−1(D^k−1+,uk−1,0), where uk−1=[ωx,k−1  ωy,k−1  ωz,k−1]T
Hk=(∂Tk−1/∂D)|D^k−×[0  0  1]T
K1k=P1k−HkT(HkP1k−HkT+R1k)−1
D^k+=D^k−+K1k(Ak−Tk−1[0  0  1]T)
P1k+=(I−K1kHk)P1k−, where I is the identity matrix
Step 3: k=k+1 and return to Step 2
Step 4: Initialize the position-tracking EKF
B^0=[0.6  0  0.6  0.5π]T, P20=diag([0.010.010.010.01]), k=1
Step 5: Position-tracking EKF
Gk−1=(∂gk−1/∂B)|B^k−1+, where gk−1(·) is the system model defined in Equation (21)
P2k−=Gk−1P2,k−1+Gk−1T+Q2,k−1
B^k−=gk−1(B^k−1+,0)
K2k=P2k−(P2k−+R2k)−1
B^k+=B^k−+K2k(Ck−B^k−)
P2k+=(I−K2k)P2k−
Step 6: k=k+1 and return to Step 5