Install ArduCopter SITL and ROS
ROS and Gazebo can be set-up to interact with the ArduCopter code base. This allows users to develop and simulate control systems or navigation algorithms that integrate with the ArduCopter libraries. After validating these algorithms in simulation, they can then be easily implemented on the physical system for real world testing. Currently, the ArduCopter code base relies on ROS Indigo and Gazebo 2. This page on the ArduPilot Developer’s wiki details instillation and set-up instructions.
Additionally, this tutorial provides scripts (labeled steps 3-5) for installing ROS, Gazebo, ArduCopter, and other supporting software packages. The “Step 3” script installs the latest Github version of Ardupilot and JSBSim simulator. The “Step 4” script installs ROS Indigo (the full desktop version) and several dependencies including DRCsim and MAVROS required for the ArduPilot simulation. The “Step 5” script creates a ROS workspace and installs packages including a ROS package for SITL mode of ArduCopter and a MAV communications package. ROS Indigo hosts the 2.x version of Gazebo. For a fully-integrated ROS system, it is recommend to use the 2.x version of Gazebo. If Gazebo 4.x was installed, it can simply be removed with the following commands:
sudo apt-get remove gazebo4 sudo apt-get install libsdformat1 sudo apt-get install gazebo2
Lastly, additional Gazebo models can be downloaded from the OSRF repository and placed into the default Gazebo worlds folder for offline use.
Install Xbox 360 controller
An Xbox 360 controller can be used in place of the typical remote control. This allows users to manually input commands to the simulated system. This page provides instructions on setting up the Xbox controller on Ubuntu 14.04. The jstest-gtk package is a simple program to verify the Xbox controller is installed and functioning correctly. The ROS wiki also contains a tutorial for configuring a joystick on Linux. Note that it may be necessary to update the joy node package parameters in the launch file based on the joystick’s assigned input value.
<param name="dev" type="string" value="/dev/input/js0" />
The screenshot below shows a sample output of the jstest-gtk package depicting the measured controller values.
Installing the RotorS Package
RotorS is a UAV gazebo simulator developed by the Autonomous Systems Laboratory at ETH Zurich. It provides some multirotor models such as the AscTec Hummingbird, the AscTec Pelican, or the AscTec Firefly, but the simulator is not limited for the use with these multicopters. There are simulated sensors such as an IMU, a generic odometry sensor, and the VI-Sensor, which can be mounted on the multirotor. This packages also contains some example controllers, basic worlds, a joystick interface, and example launch files. This package will serve as the foundation for the rest of the software development as it is already set-up to interface with the Gazebo simulator.
The software developed for this project was based on the RotorS code-base described previously. The RotorS code provided the basic interface between the quadrotor model and Gazebo. Building on that foundation the software was extended to support different control systems, simulated environments, and sensor packages. This software is available here and will be referenced heavily. The software is divided into 5 primary folders. The quad_gazebo folder includes files necessary for Gazebo integration and simulation such as the world files and launch files. Next, the quad_description folder include the files related to the quadrotor model including the URDF files and meshes. The quad_joystick_interface is a modified RotorS package that is used to integrate the Xbox controller to send commands to the simulated quadrotor. The quad_control package includes the files related to the control systems implemented on the simulated quadrotor. The quad_2D package includes the files necessary for 2D mapping and autonomous navigation using the ROS Navigation Stack. Modifications to the RotorS software or the use of this extension software will be described in addition to any supplemental packages that need to be installed for more advanced applications.