Basic principles of the strapdown inertial navigation system (SINS) using the outputs of strapdown gyros and
accelerometers are explained, and the main equations are described. A mathematical model of SINS is established,
and its Matlab implementation is developed. The theory is illustrated by six examples which are static status, straight
line movement, circle movement, s-shape movement, and two sets of real static data.
1. Introduction
Many navigation books and papers on inertial navigation system (INS) provide readers with the basic principle of INS. Some also superficially describe simulation methods and rarely provide the free code which can be used by new INS users to help them understand the theory and develop INS applications. Commercial simulation software is available but is not free. The objective of this paper is to develop an easy-to-understand step-by-step development method for simulating INS. Here we consider the most popular INS which is the strapdown inertial navigation system (SINS). The mathematical operations required in our work are mostly matrix manipulations and more generally basic linear algebra [1]. In this paper, Matlab [2] is chosen as the simulation environment. It is a popular computing environment to perform complex matrix calculations and to produce sophisticated graphics in a relatively easy manner. A large collection of Matlab scripts are now available for a wide variety of applications and are often used for university courses. Matlab is also becoming more and more popular in industrial research centers in the design and simulation stages.
The main purposes of this paper are to establish a mathematical model and to develop a comprehensive Matlab implementation for SINS. The structure of the proposed mathematical model and Matlab simulation of SINS is shown in Figure 1. In Section 2, the INS-related orthogonal coordinates (the body frame, the inertial frame, the Earth frame, the navigation frame, the ENU-frame, and the wander azimuth navigation frame) are described and figures to illustrate the relationship between the frames are provided. The basic principle of SINS is described in the wander azimuth navigation frame (p-frame). In Section 3, two important direction cosine matrices (DCMs), the vehicle attitude DCM and the position DCM, and the related important attitude and position angles are defined. In Section 4, the simulation for data generation of gyros and accelerometers is described in ENU-frame. Instead of p-frame, ENU-frame is chosen because the outputs of gyros and accelerometers are easier to obtain in this frame. The Matlab implementation is given and described step by step. Four kinds of scenarios (static, straight, circle, and s-shape) are set as examples of different kinds of vehicle trajectories. In Section 5, the mathematical model of SINS is set up and the calculation steps in p-frame are provided. In Section 6, the required initial parameters and other initial data calculation for the SINS model are given for the different simulation scenarios. In Section 7, Matlab implementation code functions are listed and described. Further, simulation results for the four above-mentioned scenarios are presented; two examples from real SINS experiment data are also provided to verify the validity of the developed codes. Finally, conclusions are drawn. Mathematical details are given in Appendices A–D.
The schema of the proposed mathematical model and Matlab simulation of SINS.
2. Principles
A fundamental aspect of inertial navigation is the precise definition of a number of Cartesian coordinate reference frames. Each frame is an orthogonal, right-handed, coordinate frame or axis set. For all the coordinate frames used in this paper, a positive rotation about each axis is taken to be in a clockwise direction looking along the axis from the origin, as indicated in Figure 2. A negative rotation corresponds to an anti-clockwise direction. This convention is used throughout this paper. It is also worth pointing out that a change in attitude of a body, which is subjected to a series of rotations about different axes, is not only a function of the rotation angles, but also on the order in which the rotations occur. In this paper, the following coordinate frames are used [3].
The body frame (b-frame): the b-frame, depicted in Figure 2, is an orthogonal axis set which has its origin at the center of the vehicle, point P, and is aligned with the pitch Pxb axis, roll Pyb axis, and yaw Pzb axis of the vehicle in which the navigation system is installed.
The inertial frame (i-frame): the i-frame, depicted in Figure 3, has its origin at the center of the Earth and its axes nonrotating with respect to fixed stars; these axes are denoted by Oxi, Oyi, and Ozi, with Ozi being coincident with the Earth polar axis.
The Earth frame (e-frame): the e-frame, depicted in Figure 3, has its origin at the center of the Earth and axes nonrotating with respect to the Earth; these axes are denoted by Oxe, Oye, and Oze. The axis Oze is the Earth polar axis. The axis Oxe is along the intersection of the plane of the Greenwich meridian and the Earth equatorial plane. The Earth frame rotates with respect to the inertial frame at a rate ωie about the axis Ozi.
The navigation frame (n-frame): the n-frame, depicted in Figure 3, is a local geographic navigation frame which has its origin at the location of the navigation system, point P (the navigation system is fixed inside the vehicle and we assume that the navigation system is located exactly at the center of the vehicle), and axes aligned with the directions of east PE, north PN and the local vertical up PU. When the n-frame is defined in this way, it is called the “ENU-frame.” The turn rate of the navigation frame with respect to the Earth-fixed frame, ωen, is governed by the motion of the point P with respect to the Earth. This is often referred to as the transport rate.
The wander azimuth navigation frame (p-frame): the p-frame, depicted in Figure 3, may be used to avoid the singularities in the computation which occur at the poles of the n-frame. Like the n-frame, it is of a local level but rotates through the wander angle about the local vertical. Here we do not call this frame w-frame (w for wander) for notation clarity since w and ω may look similar when printed. Letter p in p-frame stands for platform; indeed the wander azimuth navigation frame is of a local level and thus forms a horizontal platform.
The b-frame illustration and the definition of axis rotations.
The Reference Frames.
In this paper, we choose the p-frame as the navigation frame for vehicle trajectory calculation, for the following reason. In the local geographic navigation frame mechanization, the n-frame is required to rotate continuously as the system moves over the surface of the Earth in order to keep its PyN axis pointing to the true north. In order to achieve this condition worldwide, the n-frame must rotate at much greater rates about its PzU axis as the navigation system moves over the surface of the Earth in the polar regions, compared to the rates required at lower latitudes. It is clear that near the polar areas the local geographic navigation frame must rotate about its PzU axis rapidly in order to maintain the PyN axis pointing to the pole. The heading direction will abruptly change by 180∘ when moving past the pole. In the most extreme case, the turn rate becomes infinite when passing over the pole. One way of avoiding the singularity, and also providing a navigation system with worldwide capability, is to adopt a wander azimuth mechanization in which the z-component of ωepp is always set to zero, that is, ωepzp=0. A wander axis system is a local level frame which moves over the Earth surface with the moving vehicle, as depicted in Figure 3. However, as the name implies, the azimuth angle α between PyN axis and Pyp axis varies with the vehicle position on Earth. This variation is chosen in order to avoid discontinuities in the orientation of the wander frame with respect to Earth as the vehicle passes over either the north or south pole.
In the remainder of this section, the main principle of SINS in the p-frame is described.
Along the same lines as in [3], a navigation equation for a wander azimuth system can be constructed as follows:v̇ep=Cbpfb-(2Cepωiee+ωepp)vep+gp,
where Cbp is the direction cosine matrix used to transform the measured specific force vector in b-frame into p-frame. This matrix propagates in accordance with the following equation:Ċbp=CbpΩpbb,
where Ωpbb is the skew symmetric form of ωpbb, the b-frame angular rate with respect to the p-frame.
Equation (1) is integrated to generate estimates of the vehicle speed in the wander azimuth frame, vep. This is then used to generate the turn rate of the wander frame with respect to the Earth frame, ωepp. The direction cosine matrix which relates the wander frame to the Earth frame, Cep, may be updated using the following equation:Ċpe=CpeΩepp,(Ċpe)T=(Ωepp)T(Cpe)T=-Ωepp(Cpe)T,
where the superscript T means matrix transposition.
Since (Ċpe)T=Ċep, (Cpe)T=Cep and skew symmetric matrix is (Ωepp)T=-Ωepp (see Appendix A), (4) can be rewritten asĊep=-ΩeppCep,
where Ωepp is a skew symmetric matrix formed from the elements of the angular rate vector ωepp; we could have ωepp=-ωpee when the rotation angles are reciprocal. Because the z-component of ωepp is set to zero, ωepzp=0, the matrix expression of ωepp is ωepp=[ωepxpωepyp0]T. This process is implemented iteratively and enables any singularities to be avoided.
In the next section, the two important DCMs, the vehicle attitude DCM and vehicle position DCM, are defined, as well as the vehicle-attitude-related attitude angles and vehicle-position-related position angles.
3. Direction Cosine Matrices (DCMs)
In this section, the vehicle attitude DCM with the corresponding attitude angles and the vehicle position DCM with the corresponding position angles are described separately.
3.1. Vehicle Attitude DCM Cbp
The definition of the rotation sequence from p-frame to b-frame is (see Figure 4)xpypzp→zp,ψGxe′ye′ze′→yp′′,θxe′′ye′′ze′′→yp′′,γxbybzb,
where ψG is the gird azimuth angle (0–360°), θ is the pitch angle (−90°–90°), and γ is the roll angle (−180°–180°). The above rotation can be written in the following matrix form:Cpb=C3C2C1=[cosγ0-sinγ010sinγ0cosγ][1000cosθsinθ0-sinθcosθ]×[cosψGsinψG0-sinψGcosψG0001].
The Relation Between b-Frame and p-Frame.
The vehicle attitude DCM Tbp is then obtained asCbp=(Cpb)T=[cosγcosψG-sinγsinθsinψG-cosθsinψGsinγcosψG+cosγsinθsinψGcosγsinψG+sinγsinθcosψGcosθcosψGsinγsinψG-cosγsinθcosψG-sinγcosθsinθcosγcosθ].
For the p-frame system, the angle between the grid north yp and the true north yN is the wander azimuth angle α. So the angle between the horizontal projection along yp′ axis of the vehicle’s vertical axis zb and the real north yN is the heading angle ψ. We have thatψ=ψG+α.
So the direction cosine matrix Cbn from b-frame to n-frame isCbn=[cosγcosψ-sinγsinθsinψ-cosθsinψsinγcosψ+cosγsinθsinψcosγsinψ+sinγsinθcosψcosθcosψsinγsinψ-cosγsinθcosψ-sinγcosθsinθcosγcosθ].
The gimbal angles ψ, θ, and γ and the gimbal rates ψ̇, θ̇, and γ̇ are related to the body rate ωnbb, which is the turn rate of the b-frame with respect to n-frame and measured in b-frame as follows:[ωnbxbωnbybωnbzb]=[0γ̇0]+C3[θ̇00]+C3C2[00ψ̇]=[cosγθ̇-sinγcosθψ̇γ̇+sinθψ̇sinγθ̇+cosγcosθψ̇].
3.2. Vehicle Position DCM Cep
Position matrix Cep is the DCM from e-frame to p-frame. It has the following rotating sequence (see Figure 5):xeyeze→ze,λxe′ye′ze′→yp′′,90∘-φxe′′ye′′ze′′→zp′′,90∘xEyNzU→zU,αxpypzp,
where λ is the longitude angle (−180°–180°), φ is the latitude angle (−90°–90°), and α is the wander azimuth angle (0–360°). The above rotation can be written in the following matrix form:Cep=[-sinαsinφcosλ-cosαsinλ-sinαsinφsinλ+cosαcosλsinαcosφ-cosαsinφcosλ+sinαsinλ-cosαsinφsinλ-sinαcosλcosαcosψcosφcosλcosφsinλsinφ].
The Relation Between e-Frame and p-Frame.
In Section 4, a trajectory simulation method in the ENU-frame is described step by step to generate sensor data. In Section 5, a trajectory and attitude simulator method in the p-frame is described step by step to derive the desired trajectory and attitude from the simulated sensor data or real sensor data; Section 6 provides the initial parameters and initial data calculation.
4. Sensor Data Generator
The Purpose of Trajectory Simulation is to Generate Data of the 3 Orthogonal Gyros and the 3 Orthogonal Accelerometers According to the Designed Trajectory. It is Mentioned in Section 2 That p-Frame is Set up to Avoid the Singularities When the Vehicle Passes Over Either the North or South Pole. But in Most Applications, The SINS Systems Are Seldom Operated under This Extreme Environment. The ENU-Frame Can be Implemented Easier Than p-Frame, so it is Chosen as the Navigation Frame. Figure 6 Shows the Whole Process of the SINS Principal in the ENU-Frame Mechanization. First, The Vehicle Trajectory in the ENU-Frame is Set. Then, The Sensor Ideal Output is Derived using the Inverse Principle of INS. The Sensor Simulation Data Can be Obtained by Adding Noise to the Ideal Data. Then, we Use the Simulated Sensor Data to Derive the Noise-Corrupted Simulated Trajectory. Besides, The Difference Between the Ideal and Simulated State Vectors Can be Set as the Input for the Observed Measurements in the Kalman Filter.
SINS ENU-Frame Mechanization.
4.1. The Initial Parameters
For the designed trajectory, the initial parameters are
initial position, latitude φ0, longitude λ0, height h0;
initial velocity v=[vE0,vN0,vU0];
the designed variation of acceleration a, which varies with time according to the designed trajectory;
the designed variations of the attitude angles, pitch θ, roll γ, and heading ψ, and attitude angle rates, θ̇, γ̇, and ψ̇, which vary with time according to the designed trajectory.
4.2. The Update of Velocity
The velocity is updated asv⟵v+aΔt,
where Δt is the time step.
4.3. The Update of Position
The position is updated aslatitude: L⟵L+vNΔtRN,longitude: λ⟵λ+vEΔtsecLREaltitude: h⟵h+vUΔt.,
4.4. The Update of Attitude
The attitude angles are updated aspitch: θ⟵θ+Δθ,roll: γ⟵γ+Δγ,heading: ψ⟵ψ+Δψ.
The attitude rates are updated aspitch: θ̇⟵θ̇+Δθ̇,roll:γ̇⟵γ̇+Δγ̇,heading: ψ̇⟵ψ̇+Δψ̇.
The expressions for Δθ, Δγ, Δψ, Δθ̇, Δγ̇, and Δψ̇ depend on the designed trajectory.
The direction cosine matrix Cbn can be calculated using matrix expression (10). We have that Cnb=(Cbn)T.
4.5. Gyro Data Generator
The output of the gyros isωibb=(I-Sg)(Cnb(ωien+ωenn)+ωnbb)+ɛb,
where ωibb is the simulated actual output, I is the 3×3 unit matrix, Sg is the 3×3 diagonal matrix whose diagonal elements correspond to the 3 gyros’ scale factor errors, and ɛb is the gyro’s drift and can be simulated as the sum of a constant noise and a random white noise: ɛb=ɛconstb+ɛrandomb:ωien=[0ωiecosLωiesinL].
In a static base, ωnbb is equal to zero, whereas, in a moving base it is obtained asωnbb=[cosγθ̇-sinγcosθψ̇γ̇+sinθψ̇sinγθ̇+cosγcosθψ̇].
ωenn is related to velocity v=[vE,vN,vU]T and can be expressed asωenn=[-vNRNvEREvEtanLRN].
4.6. Accelerometer Data Generator
The measurement of the accelerometer is the specific force:fb=(I-Sa)Cnbfn+ηb,fn=a+(2ωien+ωenn)×v-g,
where fb is the simulated actual output, I is the 3×3 unit matrix. Sa is the 3×3 diagonal matrix whose diagonal elements correspond to the 3 accelerometers’ scale factor errors, ηb is the bias considered as the sum of a constant noise and a random white noise ηb=ηconstb+ηrandomb. g=[00g]T, and g=9.7803+0.051799C332-0.94114×10-6h(m/s2), where C33 is the 9th element of Cep and h is the vehicle altitude.
4.7. Examples
For four examples of static, straight line, circle, and s-shape situations, details will be given next under the conditions that the vehicle is moving on the surface of the Earth with no attitude change except for the heading angle, which means that the pitch angle, roll angle, and altitude are constants during the simulation process:Δθ=0,Δγ=0,Δθ̇=0,Δγ̇=0,
The calculation method for the other parameters for the four situations is described as follows.
5. Mathematical Model and Trajectory Calculation Steps
After the Gyro and Accelerometer Data Are Simulated using the Method Described in the Previous Section under the Designed Scenario, The Next Step we Have to do is to Figure Out the Mathematical Model of SINS and the Calculation Steps to Process the Sensor Data to Get the Calculated Trajectories. Based on the Basic Principles of Strapdown Inertial Navigation System [4], we Draw the Mathematical Model in the p-Frame Mechanization in Figure 7. The Calculation Steps Are Described Below. Although the Situation That the Vehicle Passes Over Either the North or South Pole Seldom Happens, The Universal p-Frame is Still Chosen Instead of the Simpler ENU-Frame to Give a Navigation Illustration in a Different Frame.
SINS p-Frame Mechanization.
5.1. Quaternion Q Update and Optimal Normalization
There are three kinds of strapdown attitude representations: DCM, Euler angle, and quaternion. In this paper, we choose quaternion. The reason why quaternion is chosen is explained in [3].
The quaternion formed by a rotating body frame around the platform frame isQ=q0+q1ib+q2jb+q3kb.
The update for the quaternion can be obtained by solving the following quaternion differential equation:[q̇0q̇1q̇2q̇3]=12[0-ωpbxb-ωpbyb-ωpbzbωpbxb0ωpbzb-ωpbybωpbyb-ωpbzb0ωpbxbωpbzbωpbyb-ωpbxb0][q0q1q2q3].
Based on the Euclide norm minimized indicator [4], the optimal normalization for the quaternion isQ⟵Qq02+q12+q22+q32.
5.2. Cbp Calculation
Cbp is vehicle attitude DCM which transforms the measured angle in the b-frame to the p-frame, with its 9 components Tij,i,j=1,2,3. (Here we use Tij to distinguish it from the components Cij,i,j=1,2,3 of Cep which is used below.)
After obtaining q0, q1, q2, and q3 using (29), Cbp can be calculated asCbp=[T11T12T13T21T22T23T31T32T33]=[q02+q12-q22-q322(q1q2-q0q3)2(q1q3+q0q2)2(q1q2+q0q3)q02-q12+q22-q322(q2q3-q0q1)2(q1q3-q0q2)2(q2q3+q0q1)q02-q12-q22+q32].
5.3. Specific Force Transformation from fb in b-Frame to fp in p-Frame
The specific force fb in the b-frame can be transformed to fp in the p-frame by multiplication with DCM Cbp:fp=Cbpfb,[fxpfypfzp]=Cbp[fxbfybfzb],
5.4. Velocity vep Calculation
The velocity vep update can be obtained by solving the following differential equation:v̇ep=fp-(2ωiep+ωepp)vep+gp,[v̇xv̇yv̇z]=[fxpfypfzp]-[00g]+[02ωiezp-(2ωieyp+ωepyp)-2ωiezp02ωiexp+ωepxp2ωieyp+ωepyp-(2ωiexp+ωepxp)0]×[vxvyvz].
The ground speed is the vehicle velocity projection on the horizontal plane:vg=vx2+vy2.
5.5. Position Matrix Cep Update
The update for the position matrix Cep can be obtained by solving the following differential equation, noticing that ωepzp=0:Ċep=-ΩeppCep,Cep=[C11C12C13C21C22C23C31C32C33],[Ċ11Ċ12Ċ13Ċ21Ċ22Ċ23Ċ31Ċ32Ċ33]=[00-ωepyp00ωepxpωepyp-ωepxp0][C11C12C13C21C22C23C31C32C33].
5.6. Position Angular Velocity ωepp Update
In the chosen wander azimuth navigation frame, we have ωepzp=0, and[ωepxpωepyp]=[-1τa-1Ryp1Rxp1τa][vexpveyp],
where1Ryp=1Re(1-eC332+2eC232),1Rxp=1Re(1-eC332+2eC132),1τa=2eReC13C23,
where the elements of position matrix Cep can be obtained using (35).
We Have Thatωiep=Cepωiee=[C11C12C13C21C22C23C31C32C33][00ωie]=[ωieC13ωieC23ωieC33],ωpbb=ωibb-ωipb=ωibb-(Cbp)-1(ωiep+ωepp),
5.8. Attitude Angle Calculation
The relation between attitude matrix Cbp and the three attitude angles, grid azimuth angle ψG, pitch angle θ, and roll angle γ, isCbp=[cosγcosψG-sinγsinθsinψG-cosθsinψGsinγcosψG+cosγsinθsinψGcosγsinψG+sinγsinθcosψGcosθcosψGsinγsinψG-cosγsinθcosψG-sinγcosθsinθcosγcosθ].
Thus, the principal values of ψG, θ, and γ areθprincipal=sin-1T32,γprincipal=tan-1-T31T33,φGprincipal=tan-1-T12T22.
Considering the defined range of the angles, the expressions of the real values of ψG, θ, γ, and areθ⟵θprincipal,γ⟵{γprincipal,ifT33>0,γprincipal+180∘,ifT33<0,γprincipal<0,γprincipal-180∘,ifT33<0,γprincipal>0,ψG⟵{ψGprincipal,ifT22>0,ψGprincipal>0,ψGprincipal+360∘,ifT22>0,ψGprincipal<0,ψGprincipal+180∘,ifT22<0.
5.9. Position Angle Calculation
The relation between position matrix Cep and the 3 position angles, longitude λ, latitude φ, and wander azimuth angle α, isCep=[-sinαsinφcosλ-cosαsinλ-sinαsinφsinλ+cosαcosλsinαcosφ-cosαsinφcosλ+sinαsinλ-cosαsinφsinλ-sinαcosλcosαcosψcosφcosλcosφsinλsinφ].
Thus, the principal values of φ, λ, and α areφprincipal=sin-1C33,λprincipal=tan-1C32C31,αprincipal=tan-1C13C23.
Considering the defined range of the angles, the expressions of the real values of φ, λ, and α areφ⟵φprincipal,λ⟵{λprincipal,ifC31>0,λprincipal+180∘,ifC31<0,λprincipal<0,λprincipal-180∘,ifC31<0,λprincipal>0,α⟵{αprincipal,ifC23>0,αprincipal>0,αprincipal+360∘,ifC23>0,αprincipal<0,αprincipal+180∘,ifC23<0.
5.10. Heading Angle Calculation
The heading angle ψ is calculated asψ=ψG+α.
To make sure that ψ will not be out of range, we should determine it according toψ⟵{ψ,ifψ<360∘,ψ-360∘,ifψ≥360∘.
5.11. Velocity ven in n-Frame Calculation
We Have Thatven=[vEvNvU]=[veypcosα-vexpsinαveypsinα+vexpcosαvezp].
5.12. Altitude Calculation
For the calculation of the altitude, damped methods should be used because it diverges with time. To simplify problems, in our simulations, we set the altitude to zero, that is, surface of the Earth.
5.13. Local Gravity g Calculation
The local gravity g is calculated as [5]g=9.7803+0.051799C332-0.94114×10-6h(m/s2),
where C33=sinφ, φ is the latitude and h is the altitude above sea level.
Before we carry out the implementation of the above described mathematical model of SINS, we have to know the initial parameters of the system, which will be described in the following Section.
6. Initial Parameters and Initial Data Calculation
For the calculations in Section 5, we first need to know the given initial parameters and the corresponding initial data.
6.1. Initial Parameters
Initial position, latitude φ0, longitude λ0, height h0. The values of these parameters should be the same as the corresponding ones in Section 4.1.
Initial wander azimuth angle α0. We could choose α0=0 at the very beginning. The value should be the same as the corresponding ones in Section 4.1.
Initial velocity vE0, vN0, vU0.
If barometric altimeter applied, initial external reference height href0 can be supplied.
6.2. Initial Alignment Data
Initial attitude matrix is determined by initial alignment process Cb0p. Cb0p=Cb0n when α0=0.
Initial position matrix is determined by initial alignment process Ce0p. Ce0p=Ce0n when α0=0.
6.3. Initial Data Calculation
Initial attitude angles φ0, λ0, and α0 determination: The initial attitude angles ψG0, θ0, and γ0 can be calculated using (41) and (42). Because α0=0, heading angle ψ0=ψG0.
Initial quaternion calculation: From the diagonal elements in (31) and the quaternion constraint equation, we have that
q02+q12-q22-q32=T11,q02-q12+q22-q32=T22,q02-q12-q22+q32=T33,q02+q12+q22+q32=1,
The solution to (50)
|q1|=121+T11-T22-T33,|q2|=121-T11+T22-T33,|q3|=121-T11-T22+T33,|q0|=1-q12-q22-q32.
Assuming q0 to be positive, according to (31), we have that
sign(q0)=sign(1),sign(q1)=sign(T32-T23),sign(q2)=sign(T13-T31),sign(q3)=sign(T21-T12).
Initial position matrix Ce0p: Substituting initial position, latitude φ0, longitude λ0 and initial wander azimuth α0=0 into (43), we can obtain the initial position matrix Ce0p.
Initial Earth angular velocity ωie0p and initial attitude angular velocity ωpb0b calculations: use (38) and (39).
Initial position angular velocity ωep0p calculation: use (36) and (37).
Initial gravity g0 calculation: use (49) and element C33 in Ce0p.
Initial ground velocity vg0 calculation: use (34).
At this point, the whole SINS model, including sensor data generator and initial parameters, is fully described. The following Section will provide a Matlab implementation of the SINS theory.
7. Matlab Implementation and Simulation Examples
First, the Matlab program structure and the main codes are given. The Matlab implementation is illustrated using six examples: static, straight, circle, s-shape, and the other two from real SINS experimental data.
7.1. Matlab Implementation and Codes
The program structure is given in Figure 8. The program starts from “Begin” and ends at “Stop.” The gyro and accelerometer data are obtained either from a sensor data generator described in Section 4 or from the real SINS experiment logged files. Processing the sensor data with the initial parameters, using the method described in Section 5, we get the attitude, velocity and position values of the system at specific times. After all data are processed, the program will stop and the results will be provided.
SINS Program Structure.
The main Matlab codes are presented next.
Initial settings:
initSettings.m contains initial parameters and constants used in the simulation project.
Trajectory part:
initialCalculation_static.m gives the initial calculation for the static situation;
trajectorySimulater_static.m simulates gyro and accelerometer data for the static situation;
initialCalculation_straight.m gives the initial calculation for the straight line situation;
trajectorySimulater_straight.m simulates gyro and accelerometer data for the straight line situation;
initialCalculation_cirlce.m gives the initial calculation for the circle situation;
trajectorySimulater_circle.m simulates gyro and accelerometer data for the circle situation;
initialCalculation_Sshape.m gives the initial calculation for the s-shape situation;
trajectorySimulater_Sshape.m simulates gyro and accelerometer data for the s-shape situation;
Simulation part:
INSmain.m is the main program; the simulation starts from here;
AltitudeParamete.m calculates the four damping parameters to damp the altitude error according to the input parameters k4 and τ, to be used with the external reference altitude;
InitializePosition.m gives the initial position initLong, initLat, initAlt, the external reference altitude extAlt, and the wander azimuth angle wanderAzimuth; it calculates the initial position matrix and then orthogonalizes the matrix;
InitializeAttitude.m gives the initial alignment error and calculates the attitude matrix (strapdown matrix);
InitializeQuaternion.m calculates the quaternion according to the input attitude matrix;
ComputeAngularVelocity.m calculates the position angular velocity, earth angular velocity, and position angle increment in the p-frame and resets the gyroscopes and accelerometers;
ComputeQuaternionRungeKutta.m computes the quaternion using Runge-Kutta method [6]; see Appendices B and C;
ComputeAttitudeMatrix.m computes the attitude matrix and transfers the raw data of the accelerometers to the p-frame;
ComputeVelocity.m computes the velocity, in the wander azimuth frame (p-frame) and ENU-frame, the ground velocity and altitude;
ComputePositionMatrix.m computes the position matrix.
ComputePosition.m computes latitude, longitude and wanderAzimuth;
ComputeAttitudeAngle.m computes the attitude angle of pitchAngle, tiltAngle, gridAzimuth and courseAngle;
OrthogonalizeMatrix.m computes matrix orthogonalization; see Appendix D;
QuaCofMatrix.m is called by ComputeQuaternionRungeKutta.m;
PlotResult.m plots the results of the simulation project.
7.2. Simulation Examples
In this subsection, there are 6 SINS simulation examples. Example 1 is the static situation simulation, where the vehicle trajectory in the n-frame is a fixed point. Example 2 is the straight line situation simulation, where the vehicle trajectory in the n-frame is a straight line. Example 3 is the circle situation simulation, where the vehicle trajectory in the n-frame is a circle. Example 4 is the s-shape situation simulation, where the vehicle trajectory in the n-frame is an s-shape line. Here, high-accuracy SINS simulation is applied to the four situations. The initial latitude and longitude errors are set to be 1 minute. The simulation time is set to 3600 seconds. The initial positions are dependent on the designed trajectories.
In order to verity the validity of the Matlab codes further, two sets of real static data are used, and we refer to these as Examples 5 and 6. The two sets of real data, set A and set B, are collected from the same SINS in the same place but at different times. The 2 data sets are 24 hours long.
All the errors (the angle error, the velocity error, and the position error) will contribute to the distance error in the INS trajectory calculation. Thus, the distance error is a key index of an INS system. The distance error will increase with time, so it is always associated with a time stamp.
Example 1 (Static situation simulation).
The static situation is the most basic and simple situation where the output of the gyro is the Earth rotating angular velocity and the output of the accelerometer is the gravity. Figure 9 shows the designed true trajectory. Figure 10 shows the difference between the calculated angle and the true angle. Figure 11 shows the differences between the calculated PV (position and velocity) and the true PV. The maximum value of the distance error in 1 hour is 3.5 nm (nautical mile).
The designed trajectory of static simulation.
Angle error of static simulation.
Position and velocity error of static simulation.
Example 2 (Straight line situation simulation).
The straight line situation corresponds to a vehicle moving along the northwest direction. Figure 12 shows the designed true trajectory. Figure 13 shows the difference between the calculated angle and the true angle. Figure 14 shows the differences between the calculated PV and the true PV. The maximum value of the distance error in 1 hour is 3.7 nm.
The designed trajectory of straight line simulation.
Angle error of straight line simulation.
Position and velocity error of straight line simulation.
Example 3 (Circle situation simulation).
The circle situation corresponds to a vehicle moving along a circle. Figure 15 shows the designed true trajectory. Figure 16 shows the difference between the calculated angle and the true angle. Figure 17 shows the difference between the calculated PV and the true PV. The maximum value of the distance error in 1 hour is 3.0 nm.
The designed trajectory of circle simulation.
Angle error of circle simulation.
Position and velocity error of circle simulation.
Example 4 (S-shape situation simulation).
The s-shape situation corresponds to a vehicle moving along an s-shaped line. Figure 18 shows the designed true trajectory of s-shape situation simulation. Figure 19 shows the difference between the calculated angle and the true angle. Figure 20 shows the differences between the calculated PV and the true PV. The maximum value of the distance error in 1 hour is 3.3 nm.
The designed trajectory of s-shape simulation.
Angle error of s-shape simulation.
Position and velocity error of s-shape simulation.
Example 5 (Real static data set A simulation).
First, we process data set A [7]. Figure 21 shows the trajectory for the real data set A; from the figure we can conclude that the system is static. In Figure 22, the red line corresponds to the three attitude angle errors of the real system, while the blue line corresponds to the three attitude angle errors processed by the Matlab code. We can also show that the difference between the red and blue lines is negligible. In Figure 23, the red line corresponds to the position and velocity errors of the real system, while the blue line corresponds to the position and velocity errors processed by the Matlab code. We can also see that the difference between the red and blue lines is negligible and this validates the correctness of the Matlab code. The error described by the red lines (output from the real system) is slightly smaller than that described by the blue lines (simulation). This is due to the fact that the real system is processed in a much higher rate and thus its input is more accurate than the simulated system.
The trajectory of real data set A.
Angle error of real data set A.
Position and velocity error of real data set A.
Example 6 (Real static data set B simulation).
Figure 24 shows the trajectory of the real data set B; from the figure we can conclude that the system is static too. In Figure 25, the red line corresponds to the three attitude angle errors of the real system, while the blue line corresponds to the three attitude angle errors obtained by the Matlab code when applied to the real raw sensor data set B. We can also see that the difference between the red and blue lines is negligible. In Figure 26, the red line corresponds to the position and velocity errors of the real system, while the blue line corresponds to the position and velocity errors obtained by the Matlab code when applied to the real raw sensor data set B. We can also see that the difference between the red and blue lines is negligible, and this further validates the correctness of the Matlab code.
The trajectory of real data set B.
Angle error of real data set B.
Position and Velocity Error of Real Data Set B.
8. Conclusions
In this paper, a mathematical model for the strapdown inertial navigation system (SINS) is built and its Matlab implementation is developed. First, a number of Cartesian coordinate reference frames that relate to SINS are introduced, the basic principle of SINS in the wander azimuth navigation frame (p-frame) is explained, and the main equations are described. Second, the important attitude direction cosine matrix and position direction cosine matrix in the p-frame are defined in detail. Third, the mathematical model for SINS simulation is described in detail. Fourth, a trajectory simulator model is set up to generate data from three orthogonal gyros and three orthogonal accelerometers. The initial parameters and initial data calculations for the mathematical model are also carried out. Finally, a Matlab implementation of SINS is developed. The proposed simulation method is illustrated with four examples, static, straight line, circle, and s-shape trajectories; details are given under the condition that the pitch angle, roll angle, and altitude are constant during the simulation process. Further, two sets of real experimental data are processed to verify the validity of the Matlab code.
AppendicesA. Symmetric Matrix Basic Operation
For a vector ω=[ωxωyωz]T, its skew symmetric matrix Ω isΩ=[0-ωzωyωz0-ωx-ωyωx0].
We can easily show thatΩT=-Ω.
B. Fourth-Order Runge-Kutta Method
For numerical analysis, the fourth-order Runge-Kutta method is an important iterative method for the approximation of solutions of ordinary differential equations. Here, in this paper, the fourth-order Runge-Kutta method is adopted to update the quaternion.
The steps for the fourth-order Runge-Kutta method are the following.
Calculate slope k1, the slope at the beginning of the interval, to determine the value of yi+1/2 at the point ti+1/2 using the Euler method:
k1=f(ωi,yi,ti),yi+1/2=yi+τ2k1,
where τ is the time step between time ti and time ti+1, τ=ti+1-ti.
Calculate slope k2, the slope at the midpoint of the interval, to determine the value of yi+1/2′ at the point ti+1/2 using Euler’s method:
k2=f(ωi+1/2,yi+1/2,ti+1/2),yi+1/2′=yi+τ2k2.
Calculate slope k3, again the slope at the midpoint, to determine the yi+1 value:
k3=f(ωi+1/2,yi+1/2′,ti+1/2),yi+1=yi+τk3.
Calculate slope k4, the slope at the end of the interval, with its yi+1 value determined using k3:
k4=f(ωi+1,yi+1,ti+1).
Average the four slopes; greater weights are given to the slopes at the midpoint:
k=16(k1+2k2+2k3+k4).
Finally, using the average slope k, the value of yi+1 is
yi+1=yi+τk.
C. Angular Velocity Extraction
From Appendix B and (29), we need to provide the attitude angular velocity ωpbb in a period of τ/2 to update the quaternion. By inspecting the expression of ωpbb in (39), we know that the variations of ωepp and ωiep are slow, while ωibb changes quickly. So, only ωibb needs to be given in a period of τ/2. We know that ωibb (we next use ω to simplify notation) is the output of gyro which gives data in the form of angle increment Δθi during the time interval τ. For first-order angular velocity extraction, we have thatω=Δθiτ.
In order to provide ω(ti)ω(ti+1/2) and ω(ti+1), we need to do second-order angular velocity extraction:ω(ti)=3Δθi1-Δθi2τ,ω(ti+1/2)=Δθi1+Δθi2τ,ω(ti+1)=-Δθi1+3Δθi2τ,
where Δθi1 is the angle increment from time ti to ti+1/2 and Δθi2 is the angle increment from time ti+1/2 to time ti+1.
D. Matrix Orthogonalization Method
For the direction cosine matrix C, the optimal orthogonalization method is to get Ĉ which makes the following Euclidian function have the minimum value [8]:D=[∑i=13∑j=13(Cij-Ĉij)].1/2
The expression for Ĉ is thusĈ=±C(CTC)-3/2,
where the superscript T means the transpose operator. It is difficult to solve the above equation directly. Instead, we use an iterative method. Assume C0 to be initial matrix, and Cn to be the matrix obtained after n iterations. The iteration process is as follows:C0=C,⋮Cn+1=Cn-12(CnCTCn-C).
If at the n+1 step, the following function:fn=∑i=13∑j=13(Cij-Cijn)2
satisfies fn+1-fn≤ϵ (e.g., ϵ=10-10), then the iteration procedure can be stopped and Cn+1 is taken to be the final result.
Abbreviations and SymbolsSINS:
Strapdown inertial navigation system
DCM:
Direction cosine matrix
O:
Center of the Earth
P:
Center of the vehicle
x,y,z:
3 orthogonal axes or the 3 components of a Cartesian coordinate
b:
Body frame
i:
Inertial frame
e:
Earth frame
n:
Navigation frame
ENU:
East-North-UP navigation frame, which is identical to the n-frame in this paper
p:
Wander azimuth frame
AT:
Transpose of matrix A
vep:
Velocity vector measured in p-frame with respect to e-frame
Cbp:
Vehicle attitude DCM used to transform the measured angle inb-frame to p-frame, with its 9 components Tij,i,j=1,2,3
Cpb:
Transpose of Cbp is used to transform the measured vector in p-frame to b-frame
Cep:
Vehicle position DCM used to transform the measured vector ine-frame to p-frame, with its 9 components Cij,i,j=1,2,3
Cpe:
Transpose of Cep is used to transform the measured vector in p-frame to e-frame
Cbn:
Vehicle attitude DCM used to transform the measured angle inb-frame to n-frame
fp:
Specific force vector measured in p-frame
fn:
Specific force vector measured in n-frame
fb:
Specific force vector measured in b-frame; the output of the 3 accelerometers
ωie:
Constant value of the turn rate of the Earth, ωie=7.2921151467×10-5 rad/s
ωien:
Turn rate of the Earth measured in n-frame
ωibb:
Turn rate of the b-frame with respect to i-frame, which is measured in b-frame; the output of the 3 gyros
ωenn:
Transport rate of the n-frame with respect to e-frame, which is measured in n-frame
ωiee:
Turn rate of the e-frame with respect to i-frame, which is measured in e-frame
ωepp:
Turn rate of the p-frame with respect to e-frame, which is measured in p-frame
ωpee:
Turn rate of the e-frame with respect to p-frame, which is measured in e-frame
ωpbb:
Turn rate of the b-frame with respect to p-frame, which is measured in b-frame
ωnbb:
Turn rate of the b-frame with respect to n-frame, which is measured in b-frame
Ωpbb:
Skew matrix form of ωpbb
Ωepp:
Skew matrix form of ωepp
gp:
Gravity vector measured in p-frame
g:
Local gravity scalar
g0:
Local gravity scalar at sea level
ψG:
Grid azimuth angle of the vehicle in b-frame with respect to p-frame
α:
Wander azimuth angle of p-frame with respect to n-frame
ψ:
Heading angle of the vehicle in b-frame with respect to n-frame
θ:
Grid pitch angle of the vehicle in b-frame with respect to n-frame orp-frame
γ:
Grid roll angle of the vehicle in b-frame with respect to n-frame orp-frame
Δψ:
Increase of the heading angle ψ
Δθ:
Increase of the grid pitch angle θ
Δγ:
Increase of the grid roll angle γ
λ:
Longitude of the vehicle
φ,L:
Latitude of the vehicle
h:
Altitude of the vehicle above the sea level of the Earth
φ0, λ0, h0:
Initial vehicle position (latitude, longitude, height)
Δt:
Time step
a:
Vehicle acceleration
v0=[vE0,vN0,vU0]:
Initial vehicle velocity (east, north, up)
v=[vE,vN,vU]:
Vehicle velocity (east, north, up)
vg:
Vehicle ground velocity
ren:
Vehicle position measured in n-frame with respect to e-frame
e:
Major eccentricity of the ellipsoid of the Earth
Re:
Length of the semi-major axis of the Earth
RN:
Meridian radius of curvature of the Earth
RE:
Transverse radius of curvature of the Earth
Rxp,Ryp:
Free curvature radiuses
1/τa:
Turn torsion
Q:
Quaternion
q1,q2,q3,q4:
Four components of the quaternion Q
Tcircle:
Period of the circle trajectory in simulation
Tsshape:
Period of the s-shape trajectory in simulation
Asshape:
Amplitude of the s-shape trajectory in simulation
PV:
Position and velocity.
SchneiderH.George Philip BarkerN. E.1989New York, NY, USADover PublicationsGilatA.20083rdNew York, NY, USAJohn Wiley & SonsTittertonD. H.WestonJ. L.2004Stevenage, UKInstitution of Engineering and TechnologyChenZ. 1986Beijng, ChinaChina Astronautic Publishing HouseMaybeckP. S.Wander azimuth implimentation algorithm for a strapdown inertial system1973AFFDL-TR-73-80, Tech. Rep.Ohio, USAButcherJ. C.2003New York, NY, USAJohn Wiley & SonsYuanB.2007Changsha, ChinaGraduate School of National University of Defense TechnologyBar-ItzhackI. Y.Iterative optimal orthogonalization of the strapdowm matrix197511130372-s2.0-0016429346