Simulated Inertial Measurement Unit (IMU)
[mathjax]The topic of my “Diplomarbeit” (comparable to a master thesis) was the design and implementation of a simulation environment that would allow to simulate multiple quadrotors.
It was important to get the behavior of the quadrotors as realistic as possible, since the decision to conduct experiments on real hardware was based on successful simulation results. It was therefore important for the user to be able to rely on the results. Furthermore, the simulation would be used in hardwareintheloop scenarios, e.g., real quadrotors avoiding collisions with simulated obstacles. Therefore, realism was a crucial aspect of the simulation environment.
Quadrotors were controlled by defining desired roll and pitch angles, a desired yaw speed, and a desired thrust of the propellers. The thrust vector stayed constant and perpendicular with respect to the quadrotor frame. Tilting the quadrotor frame would result in an acceleration in the direction of tilt. A PID controller actuated the motors in order to move the body frame accordingly. Feedback was provided by an Inertial Measurement Unit (IMU) that measured angular rates and accelerations. From these sensor readings, the orientation can be calculated and used as feedback to the PID controller. Therefore, a correct simulation of the IMU was key to a correct simulation of the flight behavior.
The requirements for a realistic simulation of the IMU were:

Realistic IMU acceleration and angular velocity data that includes noise, biases, scaling, and quantization effects.

Since the IMU is not always in the center of gravity, translations and rotations defined with respect to the quadrotor frame have to be taken into account.
The calculation of the simulated IMU was performed in four steps.

Obtain quadrotor state information from simulation

Calculate IMU acceleration and angular velocity measurements

Perform scaling, add noise and biases

Perform quantization and limit output
For the first step we obtained the acceleration of the quadrotor, ([latex]a_{local}[/latex]), gravity ([latex]a_{G,local}[/latex]), angular velocity ([latex]\omega_{local}[/latex]), and the derivative of the angular velocity ([latex]\dot{\omega}_{local}[/latex]) from the simulation environment.
In a second step the acceleration [latex]a_{1}[/latex] and angular velocity [latex]\omega_{1}[/latex] was calculated, with [latex]T^V_I[/latex] being the translation and [latex]R^V_I[/latex] the rotation from vehicle reference frame [latex]V[/latex] to inertial reference frame of the IMU [latex]I[/latex].
[latex]a_{1}=R^V_I (a_{local} + \omega_{local}\times (\omega_{local}\times T^V_I) + \dot{\omega}{local} \times T^V_I a{G,local})[/latex]
The angular velocity [latex]\omega_{1}[/latex] was calculated by adjusting the frame of reference of the measurements obtained from simulation.
[latex]\omega_{1} =R^V_I (\omega_{local})[/latex]
For the third step the measurements were scaled, biases introduced, and additive noise applied. Noise was defined using a gaussian distribution [latex]\mathcal{N}{a}(0, \sigma{a}), \mathcal{N}{\omega}(0,\sigma{\omega})[/latex] for the acceleration and angular velocity. The scaling [latex]s_{a}, s_{\omega}[/latex], biases [latex]b_{a}, b_{\omega}[/latex], and deviations [latex]\sigma_{a},\sigma_{\omega}[/latex] were defined by the user. [latex]\circ[/latex] denotes pointwise multiplication.
[latex]a_{2} = ((a_{1}\circ s_{a}) + b_{a}) +\mathcal{N}_{a}[/latex]
[latex]\omega_{2} = ((\omega_{1}\circ s_{\omega}) + b_{\omega}) +\mathcal{N}_{\omega}[/latex]
The fourth and final step in the calculations was optional and allowed the user to simulate quantization and limit the output values of the sensor. Quantization was implemented by rounding the values to the nearest integer value. Real IMUs have an operating range and exceeding this will result in the sensor providing a maximum (or minimum) value. By defining limits this behavior can be reproduced.
[latex]a_{IMU}=limit^{a_{max}}{a{min}}(round(a_{2}))[/latex]
[latex]\omega_{IMU}=limit^{\omega_{max}}{\omega{min}}(round(\omega_{2}))[/latex]
A video that compares the virtual and real quadrotor flight and an analysis of the simulation environment including an indepth comparison between simulated and real quadrotor flight can be found below.
Johannes Lächele, Antonio Franchi, Heinrich H. Bülthoff, and Paolo Robuffo Giordano (November2012) SwarmSimX: Realtime Simulation Environment for Multirobot Systems In: Simulation, Modeling, and Programming for Autonomous Robots, 3rd International Conference on Simulation, Modeling, and Programming for Autonomous Robots (SIMPAR 2012), Springer, Berlin, Germany, 375387, Series: Lecture Notes in Computer Science ; 7628. Download