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 hardware-in-the-loop 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, (\(a_{local}\)), gravity (\(a_{G,local}\)), angular velocity (\(\omega_{local}\)), and the derivative of the angular velocity (\(\dot{\omega}_{local}\)) from the simulation environment.

In a second step the acceleration \(a_{1}\) and angular velocity \(\omega_{1}\) was calculated, with \(T^V_I\) being the translation and \(R^V_I\) the rotation from vehicle reference frame \(V\) to inertial reference frame of the IMU \(I\).

\(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})\)The angular velocity \(\omega_{1}\) was calculated by adjusting the frame of reference of the measurements obtained from simulation.

\(\omega_{1} =R^V_I (\omega_{local})\)For the third step the measurements were scaled, biases introduced, and additive noise applied. Noise was defined using a gaussian distribution \(\mathcal{N}_{a}(0, \sigma_{a}), \mathcal{N}_{\omega}(0,\sigma_{\omega})\) for the acceleration and angular velocity. The scaling \(s_{a}, s_{\omega}\), biases \(b_{a}, b_{\omega}\), and deviations \(\sigma_{a},\sigma_{\omega}\) were defined by the user. \(\circ\) denotes point-wise multiplication.

\(a_{2} = ((a_{1}\circ s_{a}) + b_{a}) +\mathcal{N}_{a}\) \(\omega_{2} = ((\omega_{1}\circ s_{\omega}) + b_{\omega}) +\mathcal{N}_{\omega}\)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.

\(a_{IMU}=limit^{a_{max}}_{a_{min}}(round(a_{2}))\) \(\omega_{IMU}=limit^{\omega_{max}}_{\omega_{min}}(round(\omega_{2}))\)A video that compares the virtual and real quadrotor flight and an analysis of the simulation environment including an in-depth comparison between simulated and real quadrotor flight can be found below.

Johannes Lächele, Antonio Franchi, Heinrich H. Bülthoff, and Paolo Robuffo Giordano (November-2012) **SwarmSimX: Real-time Simulation Environment for Multi-robot 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, 375-387, Series: Lecture Notes in Computer Science ; 7628. Download