Vehicle State Estimator

Description

In this course, you will learn to write vehicle state estimators using several different algorithms. The objective of such an estimator is to return the most likely position and attitude of the aircraft, given a set of different measurements. The measurements you will be using are 3-axis accelerometers and rate gyroscopes, a magnetometer, GPS, and a barometer. Such an estimator is an integral part of the software of an Attitude and Heading Reference System (AHRS) aboard aircraft. An AHRS consists of a sensor suite and software which interprets the sensor data to obtain attitude and heading information. In addition to attitude and heading, we will deal with position information as well. Sensor fusion will combine the different types of sensor data.

Modern smartphones are equipped with all of these sensors, so you will be able to use the motion data obtained with your smart phone to test your codes. In this sense, this course transcends aerospace applications. You can use these skills for smartphone software which makes use of the phones attitude for other purposes.

Prerequisites

Preferred prerequisites to take this course are decent familiarity with Python (including classes) as well as undergraduate-level linear algebra and basic calculus. Having previously heard of kinematics (e.g. Euler angles, body angular rates, etc.) is helpful, but not required (people who have knowledge roughly equivalent to our Stability and Control I course will have a distinct advantage).

You should also install the Jupyter environment on your computer before taking the course (contact us if you need any assistance – for Mac, Linux, and Windows we recommend you use the free Individual Edition of Anaconda for this).

A smartphone with an integrated sensor suite is an asset to have a more interactive course experience, but it is by no means a prerequisite. We can provide you with prerecorded data from an Apple iPhone instead.

Cost and Duration

The course price is $200. It includes an instructional document, a Jupyter notebook written in Python to help you get started, and 5 hours of 1-on-1 instruction (online via Zoom). Additional 1-on-1 instruction hours can be purchased at $60/hour if desired.

 The course can be completed in ca. 1 month, if the student dedicates approximately 15-20 hours per week to it. But there is no time limit how quickly you have to finish. If you get busy with your life, you can finish later. The five hours of personal instruction which are included in the course will expire one year after course purchase (however, we are not strict about this cut-off and will try to provide you with these five hours even beyond this deadline if we have time, at our discretion).

Course Content

An instructional document consisting of a PDF file will walk you through the tasks of the course. The document introduces you to the different subtopics, lists all relevant equations, which you will need to code up the projects, and contains references, where you can look up the derivations of these equations. You will also be provided with a Jupyter notebook written in Python which contains starter code for the course assignments, which will assist you in completing the tasks. Finally, you will also receive up to 5 hours of personal instruction, where an instructor will answer any questions you may have.

We believe this is the more efficient way of learning than videos. We understand that people like to watch videos, and sometimes animations are useful tools for visualization. But they are a clumsy reference to look things up in retrospect. And for mathematics, you do not need a talking head. You will need to be able to flip through our instructions quickly back and forth and find relevant equations, depending on what you are implementing, and for that a written text is much better suited.

The course consists of the following individual lessons:

Lesson 1: Review of Linear Algebra and Kinematics

We will first review basics kinematics with you. Kinematics is the description of motion in space, both position and attitude. You do not need to have prior education in kinematics. If you have never heard of Euler angles before, you will be fine, though our brief intro will not make you a kinematics expert (we will not cover any other attitude parametrizations, and we will not derive the kinematics equations we use).  However, if you have never heard of linear algebra before, you will struggle. The associated linear algebra review, relegated to an appendix, contains everything you need to refresh your memory, but it really assumes you have seen vector spaces, vectors, matrices, matrix multiplication and basis transformations before.

Lesson 2: Sensor Calibration

You will get a most basic introduction on how to deal with the biases and noise of the sensor suite of your smartphone. To this end, we will discuss calibration of the magnetometer, the 3-axis accelerometers, and the 3-axis rate gyroscopes. You will perform a least-square fit of an ellipsoid to a calibration dataset for the magnetometer, which you will take with your smartphone, and then perform a calibration transformation to map all data points onto a unit sphere at the center of the coordinate system, removing also the bias in the process. If you do not have a smartphone, we will provide you with prerecorded smartphone data.

Lesson 3: Extended Kalman Filter (EKF)

You will implement an extended Kalman filter and an iterated extended Kalman filter algorithm for attitude and position, operating on nine variables of the state vector: position, velocity, and Euler angles. You will test your algorithm against simply numerical simulations of a flying aircraft, which can be generated with the starter code we provide in the Jupyter notebook.

 

Lesson 4: Rauch-Tung-Striebel Smoother

Unlike filters, which can be used in realtime, the Rauch-Tung-Striebel smoother is a smoother: it looks not only at past data, but also at future data to infer position and attitude. This kind of code can only be used on recorded data after the fact. It has the benefit though that is provides a better estimate. It turns out that the Rauch-Tung-Striebel smoother can be implemented by adding a backward pass to the extended Kalman filter, so we can build here on the code developed in the previous lesson.

Lesson 5: Sigmapoint Kalman Filter (SPKF) / Unscented Kalman Filter (UKF)

Rather than relying on derivatives as the EKF, the sigmapoint Kalman filter (also called unscented Kalman filter) tracks specific points in the probability distribution, as they are passed through nonlinear functions. This makes it often easier to implement than the EKF and can sometimes provide better results. One should not forget, however, that these sigmapoints are still only an approximation to the actual probability distribution.

Lesson 6: Particle Filter

Going further than the SPKF, the particle filter models the whole probability distribution as a set of particles, which are passed through the transition function and the measurement model function. Importance resampling at every iteration of the prediction and correction steps ensures that the particle distribution reflects the underlying probability distribution. By choosing enough particles, this type of filter can be made essentially arbitrarily accurate at the price of higher computational cost.

Lesson 7: Complementary Filter

A complementary filter uses two types of measurements, a primary one which is very accurate short term but subject to drift longterm, and a noisy one, which is only useful if averaged over longer time periods, but is not subject to drift. We will use a complementary filter for attitude estimation from gyroscope and translational accelerometer data as a pedagogical illustration of the interplay of these two measurements. The gyroscope can measure changes in attitude accurately, but is subject to drift, because it measures angular rates, which need to be integrated to obtain attitude from a starting position. The accelerometer measures the direction of the gravitational force vector directly, but this measurement is very noisy, because it is contaminated by user and environmental accelerations, which cannot be disentangled from a single accelerometer measurement. We will supplement the complementary filter with an EKF for position and velocity (a much simplified version of what we have coded up in Lesson 3).

Lesson 8: Capstone Project using Smartphone Data

You will test your codes on motion data recorded with your smartphone (or on data we can provide), and compare it to the attitude information which the smartphone computes with its own built-in attitude estimation software. You will learn to use the typesetting language LaTeX (if you do not know it yet) to write up your results and a review of your work in a report (LaTeX is the standard way of the scientific community to write up any mathematical paper or document containing lots of equations).