GibsonEnv: integrating Gibson with ROS

my computer environment:

ubuntu 16.04
GeForce GTX 1080 TI
ROS Kinetic

1. install nvidia drivers and cuda9.0:

sudo apt install nvidia-384
sudo sh cuda_9.0.176_384.81_linux.run
sudo dpkg -i libcudnn7_7.1.3.16-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.1.3.16-1+cuda9.0_amd64.deb  (This step is not neccessary for gibson)

add to ~/.bashrc with the following

export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

if you don’t add the library path properly, there will be errors when gibson loading shaders.

2. Building from source (GibsonEnv)

please refer to https://github.com/StanfordVL/GibsonEnv#ros-configuration

(1) install some dependencies:
apt-get install libglew-dev libglm-dev libassimp-dev xorg-dev libglu1-mesa-dev libboost-dev mesa-common-dev freeglut3-dev libopenmpi-dev cmake golang libjpeg-turbo8-dev wmctrl xdotool libzmq3-dev zlib1g-dev

(2) create a python2.7 environment

conda create -n py27-gibson python=2.7 anaconda
source activate py27-gibson
conda install -c conda-forge opencv

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
pip install tensorflow==1.3 (is this nesscessary?)

3. Clone the repository, download data and build

git clone https://github.com/StanfordVL/GibsonEnv.git
cd GibsonEnv
./download.sh (I download the dataset manually)
./build.sh build_local ### build C++ and CUDA files
pip install -e . ### Install python libraries

#before execute “pip install -e .”,  modify the setup.py as follows

setup(name=’gibson’,
version=’0.3.1′,
description=’Real Environment Developed by Stanford University’,
url=’https://github.com/fxia22/realenv’,
author=’Stanford University’,
zip_safe=False,
install_requires=[
‘numpy>=1.10.4’,
‘pyglet>=1.2.0’,
‘gym==0.9.4’,
‘Pillow>=3.3.0’,
‘PyYAML>=3.12’,
‘numpy>=1.13’,
‘pybullet==1.9.4’,
‘transforms3d>=0.3.1’,
‘tqdm >= 4’,
‘pyzmq>=16.0.2’,
‘Pillow>=4.2.1’,
‘matplotlib>=2.1.0’,
‘mpi4py>=2.0.0’,
‘cloudpickle>=0.4.1’,
‘pygame>=1.9.3’,
‘opencv-python==4.0.1.23’,
‘torchvision==0.2.0’,
‘aenum’
],
tests_require=[],
# cmdclass={
# ‘install’: PostInstallCommand
#}
)

4. Install OpenAI baselines if you need to run the training demo.

git clone https://github.com/fxia22/baselines.git
pip install -e baselines

5. ROS integration (here assuming you have installed ROS)

(1) copy gibson-ros folder to your catkin_ws/src and run catkin_make

cd ~/catkin_ws && catkin_make

(2) install gibson-ros dependencies

rosdep install gibson-ros

(3) modify ~/.bashrc as follows:
#———————————————————————————————
# >>> conda initialize >>>
# !! Contents within this block are managed by ‘conda init’ !!
#__conda_setup=”$(‘/home/ralab/anaconda3/bin/conda’ ‘shell.bash’ ‘hook’ 2> /dev/null)”
#if [ $? -eq 0 ]; then
# eval “$__conda_setup”
#else
# if [ -f “/home/ralab/anaconda3/etc/profile.d/conda.sh” ]; then
# . “/home/ralab/anaconda3/etc/profile.d/conda.sh”
# else
# export PATH=”/home/ralab/anaconda3/bin:$PATH”
# fi
#fi
#unset __conda_setup
# <<< conda initialize <<<

export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

export PYTHONPATH=$PYTHONPATH:/home/ralab/anaconda3/envs/py2-gibson/lib/python2.7/site-packages
export PYTHONPATH=$PYTHONPATH:/opt/ros/kinetic/lib/python2.7/dist-packages
export PYTHONPATH=$PYTHONPATH:/media/ralab/Data1/Research/GibsonEnv (this is where GibsonEvn is)

source /opt/ros/kinetic/setup.bash
source /media/ralab/Data1/Research/irl_navigation/devel/setup.bash (is my case “catkin_ws” is ” /media/ralab/Data1/Research/irl_navigation” )
#———————————————————————————————

(4) sanity check:
which python #should give /usr/bin/python
python -c ‘import gibson, rospy, rospkg’ #you should be able to do those without errors.

(5) running the gmapping example

roslaunch gibson-ros turtlebot_gmapping.launch