Skip to main content
. 2016 Jan 26;16(2):153. doi: 10.3390/s16020153
Algorithm A2
for each measured sample from the sensors do
   ωkbgyroscopesample
  Prediction
      Predict the quaternion and the magnetic disturbance
                x^k=[q^kbnb^knm]=[exp(Ω(ωk1b)Ts)0303I3][q^k1bn+b^k1nm+]
      Process noise covariance matrix
                 Qk1=[(σgTs2)2Ξ(q^k1bn+)I3Ξ(q^k1bn+)T04×303×4σ2bI3]
  Update:
        compute R^bn=quaternionToMatrix(q^bn)
        yk=[ykmagykacc],ykmagmagnetometersampleykaccaccelerometersample
       Sensor data validation
                Racc={I3σ2a,if   |yaccR^bngn|<εacc,                        otherwise
               Rmag={I3σ2m,if   |ymagR^bn(hnb^knm)|<εmag,                        otherwise
                R=[RmagRacc]
      Jacobian calculation
              H=[Ψ(q^kbn,hn+b^knm)RbnΨ(q^kbn,gn)03]
        x^+KalmanUpdate (x^, Qk1, yk, H, R)
end for