ROS is a popular and useful software framework in robotics area. Gazebo is a powerful robotic simulator. Ardupilot provide a tutorial for sitl simulation in ROS/Gazebo environment. I tried to setup this environment in my mac. Here I share the record of my steps.
Set up ROS Gazebo APM SITL environment on Ubuntu
Install Ubuntu 14.04.3
- Download Ubuntu 14.04.3 64bit desktop edition image from ubuntu.com
- Install the system in virtual machine or as second operating system
- Set the username as developer and password as 12345678
Clone ardupilot source
- open terminal in ubuntu
- run
sudo apt-get install git - make a directory:
mkdir workspace - enter the workspace:
cd workspace - clone the source from github:
git clone https://github.com/alexbuyval/ardupilot - cd ardupilot directory and check out RangeFinderSITL2:
cd ardupilot -
git checkout RangeFinderSITL2
Install ROS
-
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 0xB01FA116 -
sudo apt-get update -
sudo apt-get install ros-indigo-desktop-full -
sudo rosdep init -
rosdep update -
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc -
source ~/.bashrc -
sudo apt-get install python-rosinstall
Create ROS Workspace
-
mkdir -p ~/catkin_ws/src -
cd ~/catkin_ws/src -
catkin_init_workspace -
cd ~/catkin_ws/ -
catkin_make -
echo "source $HOME/catkin_ws/devel/setup.bash" >> ~/.bashrc -
source ~/.bashrc -
echo $ROS_PACKAGE_PATH - if you can see the following message, it’s successful:
/home/developer/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
Clone/Install ROS package
sudo apt-get install ros-indigo-octomap-msgs
2.roscd cd ../src #Navigate in your ROS user source files directory git clone https://[email protected]/alexbuyval/arducopter_sitl_ros.git git clone https://github.com/PX4/mav_comm.git git clone https://github.com/alexbuyval/rotors_simulator.git git clone https://github.com/ros-drivers/joystick_drivers.git git clone https://github.com/ethz-asl/glog_catkin.git git clone https://github.com/catkin/catkin_simple.git git clone https://github.com/ethz-asl/gflags_catkin.git cd rotors_simulator git checkout sonar_plugin cd ../.. wstool init src wstool set -t src mavros --git https://github.com/alexbuyval/mavros.git wstool update -t src rosdep install --from-paths src --ignore-src --rosdistro indigo -y- compile the packages:
roscd -
cd .. -
catkin_make - if the catkin-make failed bacause the lack of gawk, run
sudo apt-get install gawk - setup PATH:
echo 'PATH="$PATH:/home/developer/workspace/ardupilot/Tools/autotest"' >> ~/.profile
Install necessary python package
-
sudo apt-get install python-pip -
sudo pip install pymavlink
Run the simulation
-
cd ~/workspace/ardupilot/ArduCopter -
sim_vehicle.sh -f arducopter_sitl_ros --console
The simulation view
