We recommended to install Ubuntu 14.04.
First at all, install the base packages
sudo apt-get install gawk make git curl -y
Then install the dependencies for MAVProxy
sudo apt-get install g++ python-pip python-matplotlib python-serial python-wxgtk2.8 python-scipy python-opencv python-numpy python-pyparsing ccache realpath -y
Now, install MAVProxy
sudo pip2 install pymavlink MAVProxy catkin_pkg --upgrade
ArduPilotThe ArduPilot project is an open source autopilot for drones. We'll be using its code to simulate the UAVs:
Compile a Specific Branch of ArduPilotmkdir -p ~/simulation; cd ~/simulationgit clone https://github.com/erlerobot/ardupilotcd ardupilotgit checkout gazebo
Getting Latest Version of JSBSimcd ~/simulation
git clone git://github.com/tridge/jsbsim.git
# Additional dependencies required
sudo apt-get install libtool automake autoconf libexpat1-dev -y
cd jsbsim
./autogen.sh --enable-librariesmake -j2
sudo make install
sudo pip2 install pymavlink MAVProxy catkin_pkg --upgrade
Install ROS IndigoSetup your computer to accept software from packages.ros.org, setup your keys and install (make sure your Debian package index is up-to-date):
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116sudo apt-get update
Install, ROS package, build, and communication libraries. No GUI tools.:
sudo apt-get install ros-indigo-ros-base
Initialize rosdep, before you can use ROS, you will need to initialize rosdep. Rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
sudo rosdep initrosdep update
It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrcsource ~/.bashrc
Get rosinstall and some additional dependencies
sudo apt-get -y install python-rosinstall \ ros-indigo-octomap-msgs \ ros-indigo-joy \ ros-indigo-geodesy \ ros-indigo-octomap-ros \ ros-indigo-hector-gazebo \ unzip
Add OSRF repository and install drcsim
sudo sh -c 'echo "deb http://packages.osrfoundation.org/drc/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/drc-latest.list'wget http://packages.osrfoundation.org/drc.key -O - | sudo apt-key add -sudo apt-get updatesudo apt-get -y install drcsim
Install mavros but from shadow repo to get latest version earlier
sudo sh -c 'echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-shadow.list'sudo apt-get updatesudo apt-get -y install ros-indigo-mavros \ ros-indigo-mavros-extras \ ros-indigo-mav-msgs
Create ROS workspacemkdir -p ~/simulation/ros_catkin_ws/src
Initialize the workspace
cd ~/simulation/ros_catkin_ws/srccatkin_init_workspacecd ~/simulation/ros_catkin_wscatkin_makesource devel/setup.bash
Download these repositories in src
:
cd src/
git clone https://github.com/erlerobot/ardupilot_sitl_gazebo_plugin# Rotors simulation git clone https://github.com/erlerobot/rotors_simulator -b sonar_plugin## mav commgit clone https://github.com/PX4/mav_comm.git## glog catkingit clone https://github.com/ethz-asl/glog_catkin.git## catkin simplegit clone https://github.com/catkin/catkin_simple.git# Installation of `mavros` from its source code:cd ~/simulation/ros_catkin_wswstool init src # (if not already initialized)wstool set -t src mavros --git https://github.com/erlerobot/mavros.gitwstool update -t src
Then compile everything together:
cd ~/simulation/ros_catkin_ws catkin_make
Install Gazebo models
git clone https://github.com/erlerobot/erle_gazebo_modelsmv erle_gazebo_models ~/.gazebo/modelsrm erle_gazebo_models
Launching the simulation
Executing ArduCopter
cd ardupilot/ArduCopter../Tools/autotest/sim_vehicle.sh -j 4 -f Gazebo --map --console# once MAVProxy has launched completely, load the parametersparam load ~/simulation/ardupilot/Tools/Frame_params/Erle-Copter.param
In another terminal
source ~/simulation/ros_catkin_ws/devel/setup.bashroslaunch ardupilot_sitl_gazebo_plugin erlecopter_spawn.launch
Controlling Erle-Copter using MAVProxy
Make the copter take off. In the first terminal execute:
# in the MAVProxy prompt:mode GUIDEDarm throttletakeoff 2
or overriding the RC:
# in the MAVProxy prompt:mode LOITERarm throttlerc 3 1600
Comments