A guide for setting up ArduPilot, Gazebo and ROS.
An example project: https://github.com/yanhwee/helium
- ArduPilot
- ArduPilot Gazebo Plugin (khancyr)
- Gazebo 9
- ROS Melodic
- MAVROS (ROS package)
Tested on Native Ubuntu 18.04.4.
Script defaults to the home directory as the initial working directory, modifiable in the script. Script will use this working directory to git clone ArduPilot & ArduPilot Gazebo Plugin repositories.
wget -O - https://raw.githubusercontent.com/yanhwee/ardupilot-gazebo-ros-guide/master/install.bash | bash
Script will refresh the sudo timeout every 10 mins so intallation will not be interrupted. Please do not sudo bash
. This will run as root and script will not work.
Please restart after the installation is done.
The guide below walks through the steps found in the script.
-
ROS Melodic Ubuntu Installation
http://wiki.ros.org/melodic/Installation/Ubuntu -
ArduPilot
https://ardupilot.org/dev/docs/building-setup-linux.html -
khancyr ArduPilot Gazebo Plugin
https://github.com/khancyr/ardupilot_gazebo -
ROS package: MAVROS
https://github.com/mavlink/mavros/tree/master/mavros
- Git
sudo apt install git
- Follow all steps:
http://wiki.ros.org/melodic/Installation/Ubuntu- Install:
ros-<distro>-desktop-full
- For our case:
ros-melodic-desktop-full
- Gazebo will be installed alongside ROS
- Install:
-
Git clone:
https://ardupilot.org/dev/docs/building-setup-linux.html#cloning-with-the-command-line -
Install required packages:
https://ardupilot.org/dev/docs/building-setup-linux.html#install-some-required-packages
-
Git clone:
https://github.com/khancyr/ardupilot_gazebo#usage-- Skip directly to
git clone https://github.com/khancyr/ardupilot_gazebo
- Skip directly to
-
Build:
https://github.com/khancyr/ardupilot_gazebo#usage-- Continue after the git clone
- Set the paths as well
-
Binary Installation
https://github.com/mavlink/mavros/tree/master/mavros#binary-installation-deb- Replace 'kinetic' with 'melodic'
sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras
-
Install GeographicLib
https://github.com/mavlink/mavros/tree/master/mavros#binary-installation-deb
- catkin_tools
https://ardupilot.org/dev/docs/ros-install.html#installing-mavrossudo apt-get install python-catkin-tools
- RQT (ROS package)
https://ardupilot.org/dev/docs/ros-install.html#installing-mavros- Replace 'kinetic' with 'melodic'
sudo apt-get install ros-melodic-rqt ros-melodic-rqt-common-plugins ros-melodic-rqt-robot-plugins
-
Without ROS
-
With ROS
- Check out Intelligent Quad Videos
- Or look at Learning Resources (Connecting to ROS) & continue with Quick Test (Without ROS step 2)
These psuedo-diagrams are for you to get an idea of how the whole thing works.
-
Intelligent Quad
-
ROS
- Tutorials
http://wiki.ros.org/ROS/Tutorials - Understanding package.xml
http://wiki.ros.org/roslaunch/XML - IDEs
http://wiki.ros.org/IDEs
- Tutorials
-
Catkin
- Workspaces
http://wiki.ros.org/catkin/workspaces - catkin_tools
https://catkin-tools.readthedocs.io/en/latest/quick_start.html
- Workspaces
-
CMake
- Understanding CMakeLists.txt
https://www.youtube.com/playlist?list=PLK6MXr8gasrGmIiSuVQXpfFuE1uPT615s - Documentation
https://cmake.org/cmake/help/v3.17/manual/cmake.1.html
- Understanding CMakeLists.txt
-
ArduPilot
- Connecting to ROS
https://ardupilot.org/dev/docs/ros-sitl.html - SITL Architecture
https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html#sitl-architecture - Using SITL (sim_vehicle.py & MAVProxy)
https://ardupilot.org/dev/docs/using-sitl-for-ardupilot-testing.html - SITL Examples
https://ardupilot.org/dev/docs/sitl-examples.html
- Connecting to ROS
-
ArduCopter
- Paramters List
https://ardupilot.org/copter/docs/parameters.html - Flight Modes
https://ardupilot.org/copter/docs/flight-modes.html
- Paramters List
-
MAVLink
- MAVLink Messages
https://mavlink.io/en/messages/common.html - Copter Commands (Guided)
https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html#copter-commands-in-guided-mode - Copter Commands (Auto / Mission)
https://ardupilot.org/copter/docs/common-mavlink-mission-command-messages-mav_cmd.html - Pymavlink (Also applicable to ArduCopter)
https://www.ardusub.com/developers/pymavlink.html
- MAVLink Messages
-
Gazebo
- Tutorials
http://gazebosim.org/tutorials - Digitial Elevation Map (DEM)
- Tool for getting real-life DEM
https://terrain.party/ - Heightmap Tutorial
https://vimeo.com/58409707
- Tool for getting real-life DEM
- SDFormat Specification
http://sdformat.org/spec
- Tutorials
- sim_vehicle.py not found
- Restart Ubuntu
-
Slow Gazebo startup or
libcurl: (6) Could not resolve host: api.ignitionfuel.org- https://bitbucket.org/osrf/gazebo/issues/2607/error-restcc-205-during-startup-gazebo
- In ~/.ignition/fuel/config.yaml, change to:
-
Bad lighting
- https://answers.gazebosim.org//question/848/lighting-and-shadow-effect-problems/
- In world file, set shadow to 0
- Or in Gazebo >> World >> Scene >> Disable Shadow
- Linting for cpp files
- Find ROS cpp path
- Can be found by
cd / && sudo find -name 'ros.h'
- Can be found by
- Add path to "c_cpp_properties.json' include path
- Find ROS cpp path
-
Any Problems
- Try
pip install -U mavproxy
- Try
-
Re-requesting WPs
- ArduPilot/MAVProxy#402
- In the MAVProxy Terminal
- Type:
wp list
- Type:
- Rebooting ArduPilot
- Click on the Gear Icon (Vehicle Setup), top-left of the screen.
- Click on the Parameter Tab, bottom left of the Vehicle Setup screen.
- Click Tools, top-right of the screen.
- If not found, click on the Clear Button beside the Search Bar first.
- Click "Reboot Vehicle"