SUAS Code: Small Fixed-Wing UAS State Estimation Examples
SUAS Code is a set of heavily commented MATLAB® routines that provide example methods for performing state estimation (i.e. position and orientation) of a fixed-wing UAS (Unmanned Aircraft System) using GPS, gyros, accelerometers, and a magnetometer as sensors. The code is meant as a companion to the JHU/APL Technical Digest article "Fundamentals of Small Unmanned Aircraft Flight", by Jeff Barton. UASs are also referred to as Unmanned Aerial Vehicles (UAVs) or drones.
Five state estimation methods are provided, based on algorithms presented in the JHU/APL Technical Digest Article. The user can choose which method to use:
- EKF-based AHRS using Euler angles and a 2D magnetometer
- EKF-based AHRS using quaternions and a 3D magnetometer
- Feedback AHRS using Euler angles and a 2D magnetometer
- EKF-based INS using Euler angles and a 2D magnetometer
- EKF-based INS using quaternions and a 3D magnetometer
- EKF: Extended Kalman Filter
- AHRS: Attitude and Heading Reference System
- INS: Inertial Navigation System
Simply run the script uav_state_estimation.m from MATLAB®. The routine will query you for which method you wish to use. No additional toolboxes are required to run the routines, although the code shows how the Symbolic Toolbox can be used to derive necessary EKF matrices.
Running the script contents.m will display and describe all the files contained in SUAS Code.
The stand-alone MATLAB® script rotation_examples.m is also provided which describes the transformations between the various rotation methods used within SUAS Code: Euler angles, Direction Cosine Matrices (DCMs), and quaternions.
The Extended Kalman Filter methods in SUAS Code use the included function file perform_ekf.m, which is a generic discrete-time EKF implementation. However, because non-linear dynamic models are often more intuitively represented in continuous-time, perform_ekf.m makes use of a continuous-time state dynamics model. Thus, a user may find that perform_ekf.m is useful for other research and educational applications beyond SUAS Code.
The SUAS Code is available for download.
Upon clicking the download link and prior to being able to download the code, you will be asked to OK an End User License Agreement (EULA). It is intended that this code be freely available for academic, personal education, and research purposes. Any other uses, especially for commercial purposes, should be discussed with JHU/APL Office of Technology Transfer. We also ask that you download the code directly from this site (rather than sharing copies) so that we can keep track of usage.
The following link will provide a downloadable zip file of all the contents of the SUAS Code:
Please note that SUAS Code is provided as-is, with no warranty, and no guarantees of technical support or maintenance, etc. However, please feel free to contact the author via email (firstname.lastname@example.org) if you experience any problems using the code, find any bugs, or have suggestions for future improvement. SUAS Code usage has been verified in MATLAB® versions R2009b and R2011a on a Windows-based machine.
Please use the SUAS Code website on the MatLab Central Link Exchange to post any comments or ratings.
Example output of SUAS Code
Upon running uav_state_estimation.m from MATLAB®, you will be queried to select one of several provided simulation-generated UAV “truth” data files, as well as which state estimation method you wish to use:
As a result, the routine will provide MATLAB® structures containing the UAV truth data, the synthetically derived UAV sensor data, and the resulting state estimation data. In addition, the routine will generate a figure representing the state estimation output: