Meyer 2012
Meyer 2012
1 Introduction
Quadrotor UAVs have successfully been used both in research and for commercial
applications in recent years. Impressive results have been shown using quadrotor
aircraft of various sizes and in different scenarios. The inherently instable nature
of quadrotor flight can lead to loss or damage of UAVs easily, especially when
evaluating prototype soft- or hardware. The lack of a simulation environment for
quadrotor UAVs that covers realistic flight dynamics, camera and range sensors
and an easy integration with existing robotic middleware solutions motivated
this work. We present a comprehensive framework to simulate our quadrotor,
that has been developed during the last few years. It is based on the Gazebo open
source simulator and the Robot Operating System (ROS), that has become a de
facto standard in robotics research and facilitates integration of contributions by
other researchers. Common sensors for autonomous robots like LIDAR devices,
RGB-D and stereo cameras are already available for Gazebo and can be attached
to the robot, while plugins for other, more UAV-specific sensors like barometers,
GPS receivers and sonar rangers have been added as part of this work.
The remainder of this paper is organized as follows: After the discussion of
related work in section 2, section 3 presents the simulation model considering
I. Noda et al. (Eds.): SIMPAR 2012, LNAI 7628, pp. 400–411, 2012.
c Springer-Verlag Berlin Heidelberg 2012
Comprehensive Quadrotor Simulation 401
geometry, flight dynamics and control and how the model is implemented in
Gazebo. Comparative results from flight tests and simulation runs as well as a
demonstration of applicability for evaluating high-level algorithms are presented
in section 4.
2 Related Work
(a) (b)
Fig. 1. Mesh-based quadrotor model: (a): Model shown rendered in Blender. (b) Model
used in Gazebo. A Hokuyo UTM-30LX laser scanner is mounted below the main body.
402 J. Meyer et al.
3.1 Geometry
The robot geometry has been modeled using the open source software Blender.
To be able to provide different colors (both texture or material based) for the
model, the visual geometry is provided using the COLLADA format, while the
collision geometry is modeled as a .stl mesh. The model is designed to have a
low polygon count and still retain the relevant aspects of quadrotor geometry.
As a trade-off between visual fidelity, collision detection and dynamics modeling
needs, the propellers are modeled as discs.
Flight Dynamics. The movement of a rigid body can be described by the sum
of all forces F and torques M acting on the vehicle:
p˙n = v n (1a)
v˙n = m−1 Cnb F (1b)
ω˙b = J −1 M (1c)
Here, p and v are the position and velocity of the body’s center of gravity in
n n
the (inertial) navigation coordinate system, ω b is its angular rate given in body
coordinates and Cnb is the rotation matrix that transforms a vector from body
(index b) to navigation coordinates (index n).
The mass m and inertia J of the quadrotor need to be known and have
been estimated by weighing the individual components and using the geometric
model. The force vector F comprises motor thrust F M , drag forces F d and the
gravity vector F g . The torque vector M is divided into propulsion torque M M
and drag moments M d . Drag forces and moments are given by:
Comprehensive Quadrotor Simulation 403
With these forces and torques resulting from self motion of any system in space
and the propulsion forces and torques described in the following section, the
vehicle movement can be obtained by solving equations (1).
UA = RA IA + Ψ ωM (4)
Me = Ψ IA (5)
With the mechanical torque Mm and the motor inertia JM the change in rotation
speed can be calculated through:
1 1 Ψ
ω̇M = · (Me − Mm ) = · · (UA − Ψ ω M ) − Mm (6)
JM JM RA
The nonlinear term Mm describes the torque resulting from bearing friction as
well as load friction (i.e. drag) of the airscrew. It can be written as Mm = kT · T
where T is the thrust of a single airscrew [15] which is a a broad simplification
of a former approach [21] without loss of accuracy.
·10−5 F1
4
M1
F4
M4
3
xb
thrust coefficient CT
2 yb F2
F3 mg
M2
1 zb
M3
xn
0 yn
−1
−0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8
performance factor J zn
(a) (b)
Dividing the above equation by ω 2M and using the performance factor J = v1 /ωM
the thrust coefficient CT (J) is given by:
where the parameters CT,i have been identified in wind tunnel test. A negative
v1 (meaning a falling quadrotor) results in a positive prefix of CT,2 . In Fig. 2(a)
the polynomial approximation of CT (J) is shown. For a quadrotor helicopter the
free stream velocity v1 in general is different for each of the rotors. It can be
calculated through geometric inspection of the vehicle shown in Fig. 2(b):
(v1 )i = − [0 0 1] · v b + ω b × ei · lM (9)
for the four different motors. lM is the distance between the geometric centers
of motors and quadrotor. With the coordinate system conventions shown in
Fig. 2(b) the following expression for the overall wrench of the quadrotor can be
determined:
⎡ ⎤ ⎡ ⎤
0 (F4 − F2 ) · lM
FM = ⎣
b
0 ⎦ MM = ⎣
b
(F1 − F3 ) · lM ⎦ (10)
−Σi=1
4
Fi −M1 + M2 − M3 + M4
The four single forces Fi are calculated by solving equation (7) while the moments
Mi are obtained through combining equation (4) and (5). The incorporation of
Comprehensive Quadrotor Simulation 405
blade flapping effects which can be used to aid state estimation [4] is subject of
future work.
We implemented two plugins that calculate propulsion and drag forces acting
on the aircraft given the internal state of the vehicle, the four motor voltages
and the wind vector. The current wind can be specified as constant vector or
provided by an external model or from real log data. Gazebo then applies the
calculated forces and torques to the quadrotor body for each simulation step.
Error Model. All sensors share a common first order Gauss Markov error
model [5], permitting simulation of sensors with different error characteristics.
Each simulated measurement y(t) at time t is given by
y = ŷ + b + wy (11a)
1
ḃ = − b + wb (11b)
τ
where ŷ is the true value or vector, b is the current bias and wy and wb are
independent, zero-mean white Gaussian noise variables. wy is additive noise
acting directly on the measurement and wb describes the characteristics of the
random drift with time constant τ .
Barometric Sensor. For simulating the static pressure at the present altitude,
we use the International Standard Atmosphere (ISA) model as defined by the
International Civil Aviation Organization (ICAO), which describes the pressure,
temperature and density of the earth’s atmosphere under average conditions at
mid latitudes. The elevation of the simulation reference frame above mean sea
level and the simulated pressure (only required for the output of pressure values
in hPa) at sea level can be specified as parameters.
406 J. Meyer et al.
Ultrasonic Sensor. For controlling the height during the takeoff and landing
phases and for switching on and off the motors, the range estimate from an down-
ward pointing ultrasonic sensor is used. This device transmits short ultrasound
impulses and returns the distance corresponding to the first echo returned from
the ground or an object within it’s field of view. Available ultrasound sensors
have a maximum range of about 3 to 6 meters. The simulated ultrasonic sensor
uses the Gazebo ray sensor interface to determine ray-casting based distances to
world geometry. The distance value returned is the minimum of all rays (9 by
default).
Magnetic Field Sensor. The earth magnetic field serves as a reference for the
heading or yaw angle of the quadrotor. As using a single axis compass would lead
to significant errors with increasing roll and pitch angles, three-axis magnetome-
ters are commonly used for UAVs. With the assumption that the earth-fixed
magnetic field vector is constant within the area of operation, it is straightfor-
ward to calculate the body-fixed vector given the declination, inclination and
field magnitude. Deviation errors through interference from parts of the robot
itself are covered by the generic error model.
GPS Receiver. Pseudo range measurements and the resulting position and
velocity solution are influenced by different factors like the satellite ephemeris
errors, atmospheric errors or receiver errors [19]. These error sources are approx-
imated using the Gauss-Markov error model, with the parameters of our uBlox
receiver module having been determined experimentally. To reproduce the in-
terdependency of position and velocity errors we use the noise-affected velocity
measurement error (v GPS − v̂ GPS ) instead of wb in Eq. (11b) for the integration
of the position error. A more detailed consideration of GPS errors and especially
multipath effects in the vicinity of buildings is left for future work. To calculate
WGS84 coordinates from the simulated position and velocity in Cartesian coor-
dinates we use a simple equirectangular projection that is based on a flat world
assumption. This projection is accurate enough in the vicinity of the chosen
reference point and outside the polar regions.
Although state estimation and control are not specific to simulation, both com-
ponents are required to close the loop between simulated sensor signals and the
resulting motor voltages required to stabilize and control the quadrotor.
For estimating the state of the system we use an Extended Kalman Filter
(EKF) to fuse all available measurements to a single navigation solution con-
taining the orientation, position and velocity of the vehicle as well as observable
error states like the IMU bias errors. This approach is usually referred to as
integrated navigation.
Our controller is implemented as a set of cascaded PID controllers, with the
inner loop controlling the attitude, yaw rate and vertical velocity and an outer
loop controlling the horizontal velocity, heading and altitude (Fig. 3). This
Comprehensive Quadrotor Simulation 407
vx,d
b
PI ax,d PID
- θd -
v̂xn vx Mψ θ̂
MTψ g
pitch
ay,d φd
PI PID My
vy,d
b - - U1
v̂yn Mx
vy φ̂ roll U2
vz,d Fz Mixer
U3
vz,d Mz
pz,d PI PD U4
- -
p̂z height v̂z vz
ωz,d
ωz,d
ψd PI PD
- -
ψ̂ yaw ω̂z yaw rate
Fig. 3. The controller is realized through separate cascaded PID controllers controlling
roll and pitch movement, yaw rate and vertical velocity
approach assumes that each axis and the altitude can be controlled indepen-
dently, which is valid for moderate deviations from the hovering state. The out-
put of the inner loop are commanded torques and vertical thrust, which are
translated to motor voltages either by using a static mixture matrix or by feed-
ing them into an inverted model of the propulsion system presented in section
subsection 3.2.
For simulation we use exactly the same implementation as on the real quadro-
tor. It is based on the Open Robot Control Software (Orocos) toolchain [6],
which provides interfaces to ROS and executes tasks satisfying hard realtime
constraints on the onboard PC system. This software-in-the-loop approach offers
great flexibility for testing advanced control algorithms before the deployment on
the real vehicle and therefore minimizes the risk of damage or loss dramatically.
Implementation details can be found in previous publications [16].
4 Experiments
To validate the dynamics model, we let both the real and simulated UAV per-
form a test trajectory consisting of transitions between different velocities. All
measurable variables of the real quadrotor show the same characteristics as the
corresponding simulated counterparts. The power spectrum densities (PSD) of
408 J. Meyer et al.
2
100
|P (f )| in rad/s
vx in m/s
0
10−1
−2
ωx
10−2
100 101 0 5 10 15 20 25 30 35
2
100
|P (f )| in rad/s
vy in m/s
0
10−1
−2
ωy
10−2
100 101 0 5 10 15 20 25 30 35
2
100
|P (f )| in rad/s
vz in m/s
0
10−1
−2
ωz
10−2
100 101 0 5 10 15 20 25 30 35
f in Hz time in s
Fig. 4. Diagrams of simulated and measured angular and translational velocity. Dotted
lines represent measurements while solid lines are simulated data. The left side shows
the PSD of the angular rates. On the right side the estimated velocity both in simulation
and reality with the commanded speeds (dashed line) is shown.
(a) (b)
Fig. 5. Indoor SLAM simulation: (a): Screenshot of the GUI. On the left the Gazebo
simulation environment is visible. On the top right the view of the forward facing
camera is shown, with LIDAR point cloud and map data projected into the image.
A top down ortho view is visible on the bottom right (b) Final map generated after
teleoperation of the UAV through the scenario.
Comprehensive Quadrotor Simulation 409
(a) (b)
Fig. 6. Visual SLAM simulation: (a): Calibration of camera system in simulation. (b)
Screenshot of PTAM being used for visual SLAM on a quadrotor hovering above a
simulated NIST standard arena for response robots.
the angular rates and and the velocities are shown in Fig. 4. The controller
and a dead time of about 15 ms cause the quadrotor to oscillate slightly with a
frequency of about 3 Hz which is easily visible in the frequency domain. Differ-
ences in velocity between simulation and reality are mainly due to a gusty wind
of about 5 m/s which was apparent during the outdoor tests. In simulation, we
therefore defined a constant wind of 5 m/s.
In- and Outdoor Flight Scenarios. We flew the simulated quadrotor through
two example indoor and outdoor worlds to evaluate the quality of high-level
sensor data. Using the estimated state or ground truth data, the quadrotor pose
can be visualized along with sensor data.
To demonstrate the applicability for indoor SLAM simulation, we deploy a
previously developed SLAM approach [14] on the quadrotor UAV. The Willow
Garage office environment is part of the Gazebo ROS package, demonstrating
the applicability and interoperability of the quadrotor simulation with existing
Gazebo environments. The quadrotor UAV is teleoperated using a gamepad for
this demonstration. As shown in Fig. 5(a), sophisticated visualization including
projection of visualization data into camera images is possible by leveraging
available ROS tools like rviz. The final map learned is shown in Fig. 5(b) and of
comparable quality to those learned in real world scenarios.
A video of outdoor flying is available online2 .
1
http://www.ros.org/wiki/hector_quadrotor
2
http://www.youtube.com/watch?v=9CGIcc0jeuI
410 J. Meyer et al.
5 Conclusion
References
1. Achtelik, M., Bachrach, A., He, R., Prentice, S., Roy, N.: Autonomous navigation
and exploration of a quadrotor helicopter in GPS-denied indoor environments. In:
Robotics: Science and Systems Conference (2008)
2. Balakirsky, S.B., Kootbally, Z.: USARSim/ROS: A Combined Framework for
Robotic Control and Simulation. In: ASME 2012 International Symposium on
Flexible Automation (ISFA 2012). ASME (2012)
3. Bouabdallah, S., Siegwart, R.: Full control of a quadrotor. In: IEEE/RSJ Interna-
tional Conference on Intelligent Robots and Systems (IROS), pp. 153–158 (Novem-
ber 2007)
4. Bristeau, P., Callou, F., Vissière, D., Petit, N., et al.: The navigation and con-
trol technology inside the AR Drone micro UAV. In: 18th IFAC World Congress,
Milano, Italy, pp. 1477–1484 (2011)
5. Brown, R., Hwang, P., et al.: Introduction to random signals and applied Kalman
filtering. Wiley, New York (1992)
6. Bruyninckx, H.: Open robot control software: the OROCOS project. In: IEEE
International Conference on Robotics and Automation (ICRA), vol. 3, pp. 2523–
2528. IEEE (2001)
7. Carpin, S., Lewis, M., Wang, J., Balakirsky, S., Scrapper, C.: USARSim: a
robot simulator for research and education. In: IEEE International Conference
on Robotics and Automation (ICRA), pp. 1400–1405 (2007)
Comprehensive Quadrotor Simulation 411
8. Ducard, G., D’Andrea, R.: Autonomous quadrotor flight using a vision system
and accommodating frames misalignment. In: IEEE International Symposium on
Industrial Embedded Systems (SIES), pp. 261–264. IEEE (2009)
9. Goel, R., Shah, S., Gupta, N., Ananthkrishnan, N.: Modeling, Simulation and
Flight Testing of an Autonomous Quadrotor. In: IISc Centenary International Con-
ference and Exhibition on Aerospace Engineering, ICEAE, Bangalore, India, pp.
18–22 (2009)
10. Hoffmann, G.M., Huang, H., Wasl, S.L., Tomlin, E.C.J.: Quadrotor helicopter flight
dynamics and control: Theory and experiment. In: AIAA Guidance, Navigation,
and Control Conference (2007)
11. Huang, H., Hoffmann, G., Waslander, S., Tomlin, C.: Aerodynamics and control
of autonomous quadrotor helicopters in aggressive maneuvering. In: IEEE Inter-
national Conference on Robotics and Automation (ICRA), pp. 3277–3282 (May
2009)
12. Isermann, R.: Mechatronische Systeme: Grundlagen (German Edition). 1. Auflage
1999, 1. korrigierter Nachdruck - Studienausgabe edn. Springer (December 1999)
13. Klein, G., Murray, D.: Parallel tracking and mapping for small AR workspaces. In:
6th IEEE and ACM International Symposium on Mixed and Augmented Reality
(ISMAR), pp. 225–234. IEEE (2007)
14. Kohlbrecher, S., Meyer, J., von Stryk, O., Klingauf, U.: A Flexible and Scalable
SLAM System with Full 3D Motion Estimation. In: IEEE International Symposium
on Safety, Security and Rescue Robotics (SSRR). IEEE, Kyoto (2011)
15. Leishman, G.: Principles of Helicopter Aerodynamics, 2nd edn. Cambridge
Aerospace Series. Cambridge University Press (April 2006)
16. Meyer, J., Strobel, A.: A flexible real-time control system for autonomous vehicles.
In: 41st International Symposium on Robotics (ISR) and 6th German Conference
on Robotics (ROBOTIK). VDE (2010)
17. Michael, N., Mellinger, D., Lindsey, Q., Kumar, V.: The GRASP Multiple Micro-
UAV Testbed. IEEE Robotics Automation Magazine 17(3), 56–65 (2010)
18. Qiang, Y., Bin, X., Yao, Z., Yanping, Y., Haotao, L., Wei, Z.: Visual simulation sys-
tem for quadrotor unmanned aerial vehicles. In: 30th Chinese Control Conference,
pp. 454–459 (July 2011)
19. Rankin, J.: An error model for sensor simulation GPS and differential GPS. In:
Position Location and Navigation Symposium, pp. 260–266. IEEE (1994)
20. Rodić, A., Mester, G.: The Modeling and Simulation of an Autonomous Quad-
Rotor Microcopter in a Virtual Outdoor Scenario. Acta Polytechnica Hungar-
ica 8(4) (2011)
21. Sendobry, A.: A Model Based Navigation Architecture for Small Unmanned Aerial
Vehicles. In: European Navigation Conference. Royal Institute of Navigation (RIN)
(November 2011)
22. Weiss, S., Scaramuzza, D., Siegwart, R.: Monocular-SLAM–based navigation for
autonomous micro helicopters in GPS-denied environments. Journal of Field
Robotics 28(6), 854–874 (2011)