3D Robotics

Using ROS Gazebo simulator with ArduCopter

The future of robotics development, including drones, is powerful simulation, which makes it possible to achieve faster development and better performance by reducing the "trial and error" process of testing everything with physical machines. The Dronecode projects have long used a number of powerful drone-specific simulators, including both "hardware-in-the-loop" (HITL) and "software-in-the-loop" (SITL) programs. 

But as drone simulation goes beyond simply simulating the drone itself and extends to simulating an entire robotic system, including swarming, pathfinding, environmental awareness and autonomous mapping and navigation without GPS, you need even more powerful tools. 

The gold standard for advanced robotics simulation is the ROS/Gazebo package, which is now supported by ArduPilot as part of the Dronecode project (ROS is the Robot Operating System, created by the Open Source Robotics Foundation, which is part of Dronecode).

The APM Dev wiki now has a great page on how to use it. Here's a sample, but click through for the whole thing.

ROS and Gazebo are a well-known and respected robotics framework and simulator:

  • The ROS framework contains many “packets” of software for performing robotics tasks. It allows you to model the environment (including indoor environments with walls, doors etc) and run your own control algorithms for autonomous flight.
  • Gazebo supports several different Copter models (at time of writing there are 6 URDF models in the rotors_simulator package). These can be extended to include support for additional sensors and other behaviours.
Tip:
The ROS/Gazebo is particularly useful for defining autonomous indoor flights.

This article shows how you can replace the default SITL Copter simulation with one supplied by Gazebo and control the autopilot using the ROS framework (instead of Mavproxy or some other Ground Control System).

An architectural overview of how ROS/Gazebo integrate with SITL is shown below:

Architecture Diagram: Using SITL with ROS and Gazebo

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I did fix missing planning_msgs removing both refrences from rotors_simulator/rotors_gazebo_plugins/CMakeLists.txt

    seems those reference were not needed.

    Now catkin_male runs up to 73% then compilation FAILS, error message:

    /home/viki/catkin_ws/src/rotors_simulator/rotors_gazebo/src/waypoint_publisher.cpp:24:40: fatal error: mav_msgs/CommandTrajectory.h: No such file or directory
    #include <mav_msgs/CommandTrajectory.h>

  • Great!  But...

    I went through the whole setup process and fail. I did a bunch of steps more than wiki has.  

    First, don't try to setup Gazebo in a VirtualBox, make your life easy and do it in a native Ubuntu 14.04 installation. VM adds a lot of GPU virtualization issues, Gazebo needs OpenGL instructions not supported in VirtualBox 5.0.2 with Guest Addition 5.0.2.
    The only way to run, pretty slow but it runs, Gazebo + Ubuntu 14.04 on VirtualBox is installing mesa utils and adding:

    apt-get install mesa-utils

    export LIBGL_ALWAYS_SOFTWARE=1

    And then OpenGL error are gone. Trade off is that Gazebo don't run with GPU acceleration. :(

    After that I follow the Wiki in order to setup catkin workspace for ArduCopter SITL. The issue here was a lot of missing dependencies. 

    Actually every time I did run catkin_make a new unresolved dependency shows up. At catkin_ws/src I did install bunch more packages and dependencies:

    git clone https://github.com/ethz-asl/mav_comm

    git clone https://github.com/ethz-asl/glog_catkin

    git clone https://github.com/catkin/catkin_simple

    git clone https://github.com/ros-controls/control_toolbox.git

    git clone https://github.com/ros-controls/realtime_tools.git

    And then others ROS packages:

    sudo apt-get install ros-indigo-octomap

    sudo apt-get install ros-indigo-octomap-msgs

    sudo apt-get install ros-indigo-octomap-ros

    After that If your are lucky catkin_make will work... or not

    Other Issue I did found was that alexbuyval/rotors_simulator repo fork adds missing planning_msgs at catkin_make compilation time. In the other hand PX4/rotors_simulator original repo compiles just fine. But there is no quadX450_empty_world.launch in PX4 fork. Well I did try PX4 repo just check out if it compiles. Of course it wont work at run time because of missing adX450_empty_world.

    Anyway before I could run simulator... There are a couple of missing steps:

    Install pip and then MAVProxy

    sudo apt-get install python-pip python-dev build-essential
    sudo pip install --upgrade pip
    sudo pip install --upgrade pymavlink MAVProxy

    Then the wiki says run:

    sim_vehicle.sh -f arducopter_sitl_ros --console

    But it wont work because on alexbuyval/ardupilot fork there is no auto vehicle detection based on directory in sim_vehicle.sh so you need to run instead:

    sim_vehicle.sh -v ArduCopter -f arducopter_sitl_ros --console

    So I'm still fighting to get this setup done.

    By the way there is a VM image Ubuntu 14.04+ROS Indigo/Gazebo on internet it would be a good starting point for many of you.
    http://nootrix.com/2014/09/ros-indigo-virtual-machine/

    ethz-asl/mav_comm
    This repository contains message and service definitions used for mavs. All future message definitions go in here, existing ones in other stacks shou…
  • Great!

  • Great stuff! Thanks for sharing Chris! 

This reply was deleted.