Open-Source, Python-based GNSS-INS Simulation

Mike Horton
4 min readFeb 6, 2018

--

Aceinna has released an open simulation system designed to help people learn, develop and integrate precise navigation systems using Accelerometer and Gyroscope (Rate Sensor) measurements. The open simulation system is based on Python and it assumes some familiarity with GPS and Inertial Measurements Units (IMU).

This is the first in a a series of posts that help introduce the open-source inertial navigation simulator. These posts will cover how to use and extend it in both simple and complex applications. To follow these posts get Python and clone the simulator repo from: https://github.com/Aceinna/gnss-ins-sim

A First Example — A Simulated Allan Variance Curve

A first step to simulate inertial navigation performance is to understand and model errors associated with an inertial sensor package or IMU. There are a number of errors to model which include:

  1. Noise
  2. Bias Instability
  3. Scale and Linearity Errors
  4. Temperature Errors
  5. G sensitvity and G² sensitivity

It is often useful to start with the first two parameters Noise and Bias Instability and then create a full error model. Noise is often referred to as Angle Random Walk (ARW) and Velocity Random Walk (VRW) for rate and acceleration measurements respectively. The bias instability and random walk are easily identified on an Allan Variance plot.

The Aceinna GNSS-INS-SIM package can generate Allan Variance plot automatically from an error model. A user can compare the simulated Allan Variance with real data as a first step to validating their sensor error model.

After cloning GNSS-INS-SIM you will do two core steps:

  1. Create an IMU with an error model and device configuration.
  2. Create a Simulation engine. Configure the simulation engine for an algorithm to simulate and motion profile.To do the first step simple instantiate and IMU object and set a default accuracy level to get started.

Starting with the first step, the code below creates a mid-accuracy IMU without GPS and without a magnetometer (6-axis vs 9-axis).

imu_err = 'mid-accuracy'
imu = imu_model.IMU(accuracy=imu_err, axis=6, gps=False)

A working example is available in the GitHub repo as demo_allan.py . In the demo, a full error model is also defined for reference.

The second step is to create the simulation engine and then specify the Algorithm we want to run, as well as the motion profile to drive the algorithm. Allan Variance measurements are collected from a stationary IMU, so the motion profile is the simplest possible motion profile — stationary. In a full motion simulation the motion profile can be set to a specific driving profile, or a set of flight maneuvers. We will cover using and creating those in upcoming postsIn a full motion simulation, one might set the algorithm to an extended Kalman Filter, but for this first example we will set it to the Allan Variance algorithm and measurement.

fs = 100.0from demo_algorithms import allan_analysis    
algo = allan_analysis.Allan()
sim = imu_sim.Sim([fs, 0.0, 0.0], imu,motion_def_path+"//motion_def-Allan.csv",ref_frame=1,mode=None,env=None, algorithm=algo)

sim.run(1)
sim.plot(['ad_accel', 'ad_gyro'])

Let’s take a minute to review what is going on here. We set the sample rate fs to 100Hz. We next import that Allan Variance algorithm and instantiate it. Then we create a Simulation engine Sim. The simulation engine needs to know what sampling rates to use. The sampling rate vector has three parameters one for the accelerometers and gyros: fs, and then a parameter for GPS and magnetometers — both set to 0.0 in this example.

We also add our previously created mid-accuracy imu to the simulation, link to a motion file ‘motion_def-Allan.csv’ , and finally specify the algorithm we created earlier. The ‘motion_def-Allan.csv’ file simply commands our virtual imu to sit still for 1800 seconds.

Next we run the simulation with a number of trials, in this case 1. The Sim will automatically find the proper x-axis data for Allan analysis results, so to plot it we just specify ad_accel and ad_gyro for Allan deviation of accel and gyro. By calling the plot function we generate the output as shown below.

Allan Variance of Mid Accuracy IMU

Is it Accurate?

A natural question for any simulation is how accurate is it. Capturing the error characteristic of the IMU is a crucial first step to more complex simulation of full GNSS-INS integrated navigation.

The Aceinna IMU381 is a low-cost mid-performance IMU, with gyro performance of better than 5 deg/Hr. In the example Allan Variance tutorial, demo_allan.py, we include a full error model for this device.

This model was then compared to an Allan Variance collected from actual IMU381 hardware. This comparison is shown below.

Comparison of Simulated Allan Variance with Allan Variance collected from Actual IMU381

Next Steps

In our next tutorial, we will show how to generate a motion profile and look at the free drift of an IMU-base navigation system without correction from GPS.

--

--