Skip to content

Instantly share code, notes, and snippets.

@harmishhk
Last active January 18, 2016 20:54
Show Gist options
  • Save harmishhk/febc03b276c9af50eacf to your computer and use it in GitHub Desktop.
Save harmishhk/febc03b276c9af50eacf to your computer and use it in GitHub Desktop.
install gazebo 6 from source on ubuntu 14.04
#!/bin/bash
CURRENT_DIR=$(pwd)
# add gazebo repo
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-latest.list' || { exit 1; }
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - || { exit 1; }
sudo apt-get update || { exit 1; }
# install dependencies
sudo apt-get -y install \
build-essential libtinyxml-dev libboost-all-dev \
cmake mercurial pkg-config \
libprotoc-dev libprotobuf-dev protobuf-compiler \
libqt4-dev libtar-dev libcurl4-openssl-dev libcegui-mk2-dev libopenal-dev \
libtbb-dev libswscale-dev libavformat-dev libavcodec-dev \
libogre-1.8-dev libgts-dev libltdl-dev libplayerc++3.0-dev libxml2-dev \
libfreeimage-dev freeglut3-dev libbullet2.82-dev libignition-math2-dev libgraphviz-dev || { exit 1; }
# setup gazebo directory
GAZEBO_DIR=$HOME/ros/gazebo
mkdir -p $GAZEBO_DIR || { exit 1; }
# install sdformat from source
if [ ! -d "$GAZEBO_DIR/sdformat" ]; then
hg clone https://bitbucket.org/osrf/sdformat $GAZEBO_DIR/sdformat || { exit 1; }
cd $GAZEBO_DIR/sdformat || { exit 1; }
hg checkout sdformat3_3.0.0 || { exit 1; }
mkdir build || { exit 1; }
cd build || { exit 1; }
cmake .. -DCMAKE_INSTALL_PREFIX=/usr || { exit 1; }
make -j4 || { exit 1; }
sudo make install || { exit 1; }
fi
# install gazebo from source
if [ ! -d "$GAZEBO_DIR/gazebo" ]; then
hg clone https://bitbucket.org/osrf/gazebo $GAZEBO_DIR/gazebo || { exit 1; }
cd $GAZEBO_DIR/gazebo || { exit 1; }
hg checkout gazebo6_6.0.0 || { exit 1; }
mkdir build || { exit 1; }
cd build || { exit 1; }
cmake -D ENABLE_SSE4:bool=1 .. || { exit 1; }
make -j4 || { exit 1; }
sudo make install || { exit 1; }
echo '/usr/local/lib/x86_64-linux-gnu/' | sudo tee /etc/ld.so.conf.d/gazebo.conf || { exit 1; }
sudo ldconfig || { exit 1; }
fi
# install ros dependencies
sudo apt-get -y install \
ros-indigo-controller-manager ros-indigo-control-toolbox \
ros-indigo-transmission-interface ros-indigo-joint-limits-interface || { exit 1; }
# install ros-gazebo package
mkdir -p $GAZEBO_DIR/gazebo_ws/src || { exit 1; }
if [ ! -d "$GAZEBO_DIR/gazebo_ws/src/gazebo_ros_pkgs" ]; then
git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git $GAZEBO_DIR/gazebo_ws/src/gazebo_ros_pkgs || { exit 1; }
cd $GAZEBO_DIR/gazebo_ws/src/gazebo_ros_pkgs || { exit 1; }
git checkout -b indigo-devel origin/indigo-devel || { exit 1; }
cd $GAZEBO_DIR/gazebo_ws || { exit 1; }
source /opt/ros/indigo/setup.bash
catkin build gazebo_ros_pkgs || { exit 1; }
fi
cd $CURRENT_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment