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, sim_vehicle.sh ;
- 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:
https://github.com/AurelienRoy/ardupilot/tree/wall_follow branch wall_follow
https://github.com/AurelienRoy/mavlink-gbp-release/tree/wall_follow branch wall_follow
https://github.com/AurelienRoy/MAVProxy/tree/map_overlay branch map_overlay
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.
Fantastic work,is there helicopter model?
Please pardon the language due to unbridled enthusiasm ...
This is so badass it's not even funny ...
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 (dev.ardupilot.com). Would you have time to work with Hamish to get it into our wiki?
Thanks so much for your work on this! Very exciting!