ArduCopter + ROS + Gazebo

Hi, I’m trying to get Ardupilot to work in SITL with ROS and Gazebo, but none of the tutoriall/wikis seems to work out of the box. It seems that px4 have better support for ROS and Gazebo.

1 Like

It is true since PX4 is designed and aimed to fully integrated back into ROS.
For the ArduPilot, it does have plenty other option for what ROS can do
such as APSync, Dronekit, Maverick, and more…
refer the link if you are interested
and Erle Robotics has one that ROS integrated with ArduPilot

You can try ArduPilot Gazebo if you want
Its working repo that enables ArduPilot SITL with Gazebo models.
It doesn’t support ROS yet, Interface or integration with ROS job is required for your applications.

and I think @khancyr would know much more about ROS integration.

Thank for the links. I already saw them.
We have a framework to make “clusters” of UAVs in ROS. We tested it, running PX4 SITL firmware, using ROS and Gazebo for simulation.
I’m working on clusters of UAV and ASV. As PX4 don’t have a good boat firmware, in my real vehicles I’m running APM firmware. Differential boats are working quite good!
Now I need to integrate our ROS cluster package, with APM SITL and gazebo.
So, it seems that I can’t make it…


Can you explain what doesn’t work between ROS and SITL ? it works out of the box ! I will make a blog post about it tomorrow demonstration a swarm of copter and rover on SITL : pretty much what you want to demonstrate.

The gazebo part is more tricky, especially if you want to simulate everything inside gazebo. If you just want to plot SITL inside gazebo it is more simplier .

In that case, I think you can make it work with simulating ROS part with PX4.
Communication between clusters, vehicles sort of.
Then interface actual hardware with ArduPilot + MAVROS on RPI3/Odroid or else.
This might be helpful 50 plane fleet with ArduPilot with ROS on Odroid.
from Naval Postgradue School ARSENAL team

The problem is not with SITL + ROS. The problem is with SITL + ROS + Gazebo. I can’t find a guide to make that work.
I need a quad and a boat (or a rober, but with differential drive) in gazebo.

We have UAVs simulation with ROS, SITL, Gazebo and PX4.
I need to add a differential drive boat and it seems that PX4 don’t have a good firmware for that. So I thought to try with APM. But it seems that APM does not have a good integration with gazebo.
Can I take a little for both world?


I don’t know what you meant by gazebo integration.
Its very easy to add model in gazebo, differential drive rover is up in my repo,
Clearpath Robotics Husky model interfaced with ArduPilot.
But I don’t know about boat so you should build model if you want.
you can simply convert PX4 model to ArduPilot model if there is one, just interface it with ArduPilot Plugin.
ROS side is up to you, but wouldn’t be that different from PX4.

I’m trying to get your repor working in my PC. But I there is something that does not run properly, take a look at attached picture.

Sorry there was mistake in my manual.
It is to be launched with following, gazebo expects little bit different port for Rover now. -v APMrover2 -f gazebo-rover  -I1

but it seem that I need to run apm SITL in another terminal
take a look at console screen… there is no APM firmware working

EDIT: I get it working now. could I add mavros to de simulation?

You can just think of gazebo sim as a virtual physical world without any of software included unless configured.
Adding any of ROS packages is possible.

yes, I was interpreting the ros part in the wrong way.
ROS integration of APM is through Mavlink/Mavros. So, once APM SITL is working I just need to launch Mavros to take control of vehicles through ROS, using GUIDED flight mode.

I’m trying to get your Rover simulation working right now. I get this error:

lgarbe@notebook:~/ardupilot_gazebo$ source /usr/share/gazebo/
elgarbe@notebook:~/ardupilot_gazebo$ export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models:${GAZEBO_MODEL_PATH}
elgarbe@notebook:~/ardupilot_gazebo$ export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models_gazebo:${GAZEBO_MODEL_PATH}
elgarbe@notebook:~/ardupilot_gazebo$ export GAZEBO_RESOURCE_PATH=~/ardupilot_gazebo/worlds:${GAZEBO_RESOURCE_PATH}
elgarbe@notebook:~/ardupilot_gazebo$ gazebo --verbose
Gazebo multi-robot simulator, version 8.6.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 8.6.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.

[Msg] Waiting for master.
[Msg] Connected to gazebo master @
[Msg] Publicized address:
[Err] [Plugin.hh:180] Failed to load plugin cannot open shared object file: No such file or directory
[Err] [Plugin.hh:180] Failed to load plugin cannot open shared object file: No such file or directory
[Msg] Connected to gazebo master @
[Msg] Publicized address:
[Wrn] [] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once.
[Err] [] Missing model.config for model "/home/elgarbe/ardupilot_gazebo/models/.hg"

Jonathan (from this video: provide instruction to me and I could make one iris to work, modifying some gazebo models… But I can’t make your simulation to work.



What this error is telling you is that gazebo couldn’t find (Thus, couldn’t load) the plugins and

Gazebo should be able to locate these libraries in your path. These libraries should have been installed (Maybe even compiled) in your machine, so we can assume there was some error during that procedure.

For what I know, can be built and installed from this repository. I’m not sure about what Husky is, but it seems like this could help you testing it with Gazebo.

Best regards.

1 Like

Have you installed ArduPilot-Gazebo repository correctly without any error message up?
Common error is that ROS Kinetic does not correctly give gazebo plugin install path,
plugins should be installed in /usr/lib/x86_64-linux-gnu/gazebo-7/ not 7.0
which is described at the end of manual
and some of errors are ignorable when you launch gazebo after the install.

@drodriguez Its fine about Husky plugin, Husky model itself is included in gazebo.
In my repo, rover example takes nested model of original Husky rover interfaced to ArduPilot without touching original model itself, but model itself requires husky plugin for control through ROS, not ArduPilot.
So it is okay to ignore it when it comes to using ArduPilot.

1 Like

yes, I’m install ardupilot-gazebo, (compiling and installing according to the readme) without errors. I’m using gazebo 8.
Gazebo and husky shows up and the communication with APM is established, but I don’t know what to expect with that error…

I set up this fork of ardupilot-gazebo to compile as a ros package instead of a gazebo plugin. Right now it only works with the Iris quadrotor model, but it supports multiple SITL models and interfaces with ROS via mavros.

@khancyr @SwiftGust can y’all make like a comprehensive list of things needed to do in order to successfully integrate Ardupilot with ROS and Gazebo for Arduplane?
Lots of people seem to be having the same issue, and the documentation on the ardupilot website is very confusing.

1 Like