Installing_Gazebo7 - m-shimizu/p3at_for_ros_with_modelsdf GitHub Wiki
Building Gazebo from source to use a sound function in it.
This document is a memo for installing Gazebo7 from source to use sound in the virtual environment.
Followings were checked with a clean installed Ubuntu 16.04LTS.
Building Gazebo to use sound in it!
SEE ALSO: the page for installing Gazebo from source
If you want to use this compiled gazebo7 with ROS, you should set the target directory for installing the compiled gazebo7 as "${HOME)/local" instead of "/usr". Because a binary gazebo7 will be installed at installing ros-kinetic-gazebo-ros-pkgs, the binary gazebo7 must conflict with the compiled gazebo7.
To build gazebo, a terminal WITHOUT "source /opt/local/ros/kinetic/setup.sh" should be prepared.
And run following commands:
sudo apt-get remove '.*gazebo.*' '.*sdformat.*' '.*ignition-math.*'
And build and Install ignition math and SDFormat.
Now you have to go below "Installing Required packages", install them and other required packages and return here.
And keep running following commands:
hg clone https://bitbucket.org/osrf/gazebo /tmp/gazebo
cd /tmp/gazebo
hg up gazebo7_7.7.0
mkdir build
cd build
If you need install simbody and bullet, do the following line:
sudo apt-get install libsimbody-dev libbullet2.82-dev
And continue building gazebo:
cmake ../ -DCMAKE_INSTALL_PREFIX=${HOME}/local
make -j4
make install
echo 'export LD_LIBRARY_PATH=${HOME}/local/lib:${LD_LIBRARY_PATH}' >> ~/.bashrc
echo 'export PATH=${HOME}/local/bin:${PATH}' >> ~/.bashrc
echo 'export PKG_CONFIG_PATH=${HOME}/local/lib/pkgconfig:${PKG_CONFIG_PATH}' >> ~/.bashrc
echo 'export CPATH=~/local/include/gazebo-7/:/usr/include/sdformat-4.1:/usr/include:/usr/include/ignition/math2:/usr/loccal/include' >> ~/.bashrc
echo 'source ~/local/share/gazebo/setup.sh' >> ~/.bashrc
Then test just builded gazebo7 in sound.
!! WARNING : TURN SPEAKER VOLUME DOWN (at least lower than middle) !!
source ~/.bashrc
sed -i "s/mp3/wav/" ~/local/share/gazebo-7/worlds/openal.world
gazebo ~/local/share/gazebo-7/worlds/openal.world
Could you hear "wow~"? :-) Now you got a sound environment, good job!
!!IMPORTANT!!
AT LAST, YOU HAVE TO INSTALL AGAIN REQUIRED ROS PACKAGES FOR THIS REPOSITORY AFTER INSTALLING GAZEBO FROM SOURCE.
PLEASE RETURN TO THE TOP OF THE README.MD OF THIS REPOSITORY, AND DO INSTALLATION FOR ROS PACKAGES AGAIN.
Installing Required packages (YOU MUST INSTALL ALL OF FOLLOWING PACKAGES)
Let's install fundamental required packages with apt-get. The reason of using Ogre version 1.9 is ROS kinetic using it. If you will use ROS, you should install ROS first without ROS embeded gazebo.
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.9-dev libgts-dev libltdl3-dev libxml2-dev libfreeimage-dev freeglut3-dev g++ graphviz-dev qt4-qmake qt4-dev-tools qt4-default libtinyxml2-dev ruby1.9.1 libbullet-dev libusb-1.0-0-dev
Please check version number of the package name of libsimbody-dev and libbullet2.82-dev, if you got errors about dependence of libraries.
Installing IGNITION-TRANSPORT-DEV
SEE ALSO: Install libignition-transport-dev
A summary to do.
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install libignition-transport0-dev libignition-transport-dev
Build and Install FFMPEG
SEE ALSO: Download FFmpeg
SEE ALSO: Compiling ffmpeg
SEE ALSO: FFPLAY binary not getting generated on compilation
A summary to do.
cd /tmp
sudo apt-get -y install yasm libsdl1.2-dev libmp3lame-dev libx264-dev
Download ffmpeg-X.Y.Z.tar.bz2 from ffmpeg home page and unzip it on /tmp .
cd ffmpeg*
cat INSTALL.md
./configure --disable-static --enable-shared --enable-gpl
make
sudo make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}' >> ~/.bashrc
source ~/.bashrc
hash -r
Build and Install ignition math
SEE ALSO: Install Gazebo from source
A summary to do.
hg clone https://bitbucket.org/ignitionrobotics/ign-math /tmp/ign-math
cd /tmp/ign-math
hg up ign-math2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make -j4
sudo make install
Build and Install SDFormat
SEE ALSO: Install Gazebo from source
A summary to do.
hg clone https://bitbucket.org/osrf/sdformat /tmp/sdformat
cd /tmp/sdformat
hg up sdformat4_4.2.0
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make -j4
sudo make install