Gazebo is a real time physics simulator with many promising features for the simulation of the next generation of UAVs, self-aware of their environment.

As presented on previous posts, especially from the ASL team from ETH Zurich who interfaced PX4 with Gazebo, from Alexandr Buyval who posted the first interface for ArduCopter, or from Patrick Nolan, Gazebo offers the simulation of a variety of sensors. It includes models of ultrasound range finders, cameras, lidars, stereo cameras, etc. These combinations make Gazebo well suited to simulate indoor flights or close to obstacles.

Gazebo runs along ROS (Robot Operating System) which is a software framework containing libraries for message-passing, package management, visualizers, device drivers, etc.

This update fully restructures in "C++ the Ardupilot – ROS/Gazebo” plugin interface in order to bring out:

  • an improved simulation stability and deterministic UAV response (step lock mechanism) ;
  • a simplified ROS/Gazebo simulation launch, fully configurable through arguments to the well-used SITL launch script, ;
  • integration of the GPS sensor provided by Hector's plugin ;
  • the simulation of ArduPlane, with a Cessna model provided as an example for custom fixed-wing designs ;
  • a georeferenced overlay map image on MavProxy, to better assess the UAV position relative to its simulated environment ;
  • a new custom mode, Wall Follow, for precise distance control to vertical surfaces, as an example of new sensor use on Gazebo ;
  • a safeguard parachute, releasable by the autopilot

With this update we hope the Ardupilot ROS/Gazebo SITL will have achieved a high enough stability and ease-of-use to become a common simulator for all phases of the engineering V-model:

  • prototype new designs for specific applications, and virtually test various combinations of sensor payloads and flight modes before moving to real hardware ;
  • debug in real-time Ardupilot, and even the communication between Ground Stations and the autopilot ;
  • ultimately validate functions are well-behaved.

Besides conception usefulness, the ROS/Gazebo SITL simulator is also very helpful for new pilots to train on RC piloting, or for veterans to hone their skills in parameter tuning.

Next step would be to interface DroneAPI's code with ROS/Gazebo topic messages, as well as the simulation launch mechanism, to be able to run custom DroneAPI image processing codes over Gazebo camera frames. By achieving this, the SITL would close the loop of UAV system simulation.

In conclusion it is a great test bench for all the cool new functions and flight modes of the community!


All source codes are available on our Github: branch wall_follow branch wall_follow branch map_overlay


Aurélien ROY


from InventUAV


Additional details:

The step lock mechanism enforces a pause of the Gazebo simulation until it receives the next motor command from Ardupilot. It then steps forward the simulation by 2.5 ms (for the 400 Hz update rate on Pixhawk hardware) and sends back new sensor measurements to Ardupilot. Unlike many controller simulations on Gazebo, Ardupilot is the master of the simulation clock.

This solution prevents Ardupilot from missing time steps when running on slow computers, thus improving the overall stability. Among other benefits, the debugging of Ardupilot is much easier: when its execution stops at a breakpoint, the simulation automatically stays on a standstill.

Among discomforts, in simulations with ground stations maps, you cannot properly assess the UAV position relative to its surroundings. This issue is now solved, at least for MavProxy, with the possibility to overlay a georeferenced map image. The image file path is specified as argument to MavProxy, by the SITL launch script, with the simulation start location defining the image's center geolocation.


Unfortunately the Gazebo orthographic projection camera, which would be much useful to create maps from screenshots, only arrives in Gazebo 6.0, with the Kinetic Kane ROS version (may 2016).

Parachute release :

In order to stress test safety mechanisms of Ardupilot, a parachute has been modeled and appears when the autopilot activates the release servo. This development leads the way for dynamic model insertion, which can be useful for special actions like saving a lost hiker with an accurate water bottle drop (UAV Outback Challenge 2014).

Wall-Follow Mode :

It is a new mode we conceived for our project's special needs. 

It is an aiding system for pilots making close shots along a structure's surface. All commands are relative to a virtual wall plane, which is similar to the Simple mode. It combines a Loiter controller for the lateral axis (= parallel to the wall), and a distance controller on the forward axis (= toward the wall).

The pilot can freely control lateral movement (roll command), and height (throttle). The wall plane orientation is fixed as perpendicular to the UAV's yaw angle upon entering the mode, and the target distance is a parameter.

To maintain a good behavior even when facing surfaces with holes, or high granularity, the controller includes with a special filtering of frontal range measures, fully configurable through parameters. This way the UAV maintains a straight trajectory, despite gaps.

An equivalent wall-follow waypoint control is underway, for wall planes parallel to waypoint legs.

The development of this feature had to be rushed for the needs of the video. It has not yet been thoroughly tested, and any test on a real UAV should be performed with caution. 

Views: 18270

Comment by Andrew Tridgell on December 17, 2015 at 2:00pm

Fantastic work! I especially love the parachute integration - that is something we haven't managed to do with any of the other SITL backends. The terrain and object integration also looks to be much better than our other current simulation systems.

I haven't been through the tutorial yet. I'll have a go and then will probably have some questions. I would love to get instructions on how to use this into the ArduPilot dev wiki ( Would you have time to work with Hamish to get it into our wiki?

Thanks so much for your work on this! Very exciting!

Comment by Olivier on December 17, 2015 at 2:07pm


Comment by John Dennings on December 17, 2015 at 2:33pm

This is so badass it's not even funny ...

Comment by John Dennings on December 17, 2015 at 7:31pm

Please pardon the language due to unbridled enthusiasm ...

Comment by uavfans on December 17, 2015 at 10:03pm

Fantastic work,is there helicopter model?

Comment by Georacer on December 18, 2015 at 1:12am

This is great! I was looking at Gazebo the last few weeks to make the next step of last_letter (my simulator) but it looks you beat me to it.

I hope it will be possible to merge some work here. Cheers!

Comment by Víctor Mayoral on December 18, 2015 at 1:18am

This is great. Well done!

A huge milestone for APM I'd say. Many roboticists will now get attracted by this.

Comment by Georacer on December 18, 2015 at 1:34am


You mentioned a tutorial. I took a quick glance at the github repo but didn't find anything relevant.


Are there launching instructions or a gitter channel?

Comment by Maxx_UAV on December 18, 2015 at 4:22am

@Tridge, Georacer:

We are working on documentation with some schematics (sim_vehicle, folders architecture, etc). We will push it to the wiki around Christmas.

The whole setup process is described in "Tutorial to setup SITL Gazebo on Windows - v0.8.pdf" (September 9...).

On our "" you will see all steps to install ROS, Gazebo and ArduPilot. This version is outdated but contain all the basics to install Linux and a first working model with Gazebo. We agree we did not yet update the scripts (referring our git instead of first contributors). Soon. But you can install it right now and switch the folders. If you have issues do not hesitate to mail me.


Heli could be possible yes, as we worked with plugins like liftDrag (Airplane, propeller) or rotors_sim (multirotor). You will not have to code the dynamics. Instead, you need to create a new Gazebo model (joint, links, .dae) and most of the work will be on the Heli plugin in ROS/Gazebo (not implemented yet).

@Oliver, John Dennings and Victor Mayoral :

Thanks for your enthusiasm ! We did not count hours and sleepless nights, hopefully this will help devs and owners to mastery Ardu UAVs.

Comment by Aurelien ROY on December 19, 2015 at 11:17am

I have heard of last_letter but have not tried it yet. Yesterday I looked a bit at your code, and it is impressive! You did an enormous work! I really liked your detailed equations for electric motor propulsion, your implementation of a wind turbulence model, and your lift/drag shape curves. It seems to be even more accurate than JSBSim!
Have you been able to compare your flight results with a test flight of a real HCUAV ?

In our case the aerodynamic code used is a fork from the Lift/Drag plugin implemented in Gazebo, with a few modifications. Coefficients of lift, drag, moment, are evaluated from simple bi-segments linear approximations: 1 segment for small angles of attack, and 2nd with a different slope for the stall part. Maxime modified/tuned them with the parameters from a real Cessna. The propeller of the plane also makes use of the lift/drag plugin on each blade, while quadcopter rotors rely on the rotor_simulators plugin from PX4 team (they use the model rotor_thrust = kt*omega^2).

Surely dynamics are not as accurate as last_letter, however our choice with Gazebo was for a simulation more oriented toward functional tests, especially for proximity sensors, like range finders for obstacle avoidance, and such.

I think your equations, and wind model, could greatly benefit this simulator. Indeed there is currently no wind at all.
rotor_simulators has an implementation of wind system, but it is a bit too simplist to really challenge the autopilot: a mere constant force applied on the UAV.
(Ultimately it would also be nice to have a small GUI to modify wind/simulation parameters in real time.)


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service