guided policy search代碼環境安裝成功流程

A successful installation of gps code dependencies

This installation process is based on ubuntu 18.04.
I also use ‘virtualenvwrapper’ to create a virtaul python2 env

step 1

mkvirtualenv gps, based on python 2.7.15. Note that we make the virtual env without --no-site-packages.

step 2

we then activate the virtual env.
now, we pip install numpy==1.11 matplotlib==1.5 scipy==0.11, maybe other versions all works, but i do not test.

step 3

3.1

sudo apt-get install libprotobuf-dev protobuf-compiler libboost-all-dev
pip install protobuf # no sudo, because we install it in virtual env

3.2

Clone the repo:

git clone https://github.com/cbfinn/gps.git

Compile protobuffer:

cd gps
./compile_proto.sh

step 4

Install box2d

4.1

sudo apt-get install build-essential python-dev swig

we install pygame in virtual env

pip install pygame

4.2

Check out the Pybox2d code via GitHub

git clone https://github.com/pybox2d/pybox2d

4.3

Build and install the library:

python setup.py build
python setup.py install 
# without sudo, because we want to use it in virtual env, 
# and you also can use 'pip install .' to isntall the Box2D package 

step 5

mujoco setup.

5.1

download mjpro131_linux.zip, extract it and mv mjpro131_linux path-to-gps/src/3rdparty/

5.2

add mjkey.txt to mjpro/bin/, this is the tutorial in the email. But according to the mjcpy2/mjcyp2.cpp line 89, so we add mjkey.txt to mjpro/

5.3

compile the 3rdparty project.

cd 3rdparty/
mkdir build
cd build
cmake ../  # maybe errors occur, osg* not found. 
make -j8

5.4

if step 5.3 has errors, we install osg.
I download osg 3.6.5, gcc-7 meets the requirement.

5.5

add the following into ~/.bashrc, and then source ~/.bashrc.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gps/src/3rdparty/build/lib
export PYTHONPATH=$PYTHONPATH:/path/to/gps/src/3rdparty/build/lib

step 6

6.1

install ros, the version of ros is ros-melodic-desktop-full
the installation is omitted.

6.2

Set up paths by adding the following to your ~/.bashrc file:

export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/path/to/gps:/path/to/gps/src/gps_agent_pkg 
# maybe it is useless

6.3

Compilation:
Note: don’t forget to compile the gps_agent_pkg package, I guess that this package is created by roscreate-pkg, because the file system is different from the package created by catkin_create_pkg。so,

  1. compile the package:
    cd path_to_gps/gps/src/gps_agent_pkg
    cmake .
    make -j
    

Note: please note the version of gcc, otherwise causing quantities of warning and err. Maybe gcc v5.x is ok.
2. problems:
+ ResourceError: ConvexDecomposition
bash sudo apt-get install convex-decomposition sudo apt-get install iv***
+ error: expected constructor, destructor, or type conversion before “(” token PLUGINLIB_DECLARE_CLASS(gps_agent_pkg, GPSPR2Plugin,
This problem confused me for several days, because i find the same syntax in ros official doc. After several days’ struggle, I find the solution in a blog, it says that PLUGIN_DECLARE_CLASS API was deprecated in the newest version of ros. Oh, god.
the right syntax is:
cpp // Register controller to pluginlib // PLUGINLIB_DECLARE_CLASS(gps_agent_pkg, GPSPR2Plugin, // gps_control::GPSPR2Plugin, // pr2_controller_interface::Controller) PLUGINLIB_EXPORT_CLASS(gps_control::GPSPR2Plugin, pr2_controller_interface::Controller)
3. finally compile the package, we cd path_to_gps/gps, and then catkin_make. source devel/setup.bash

6.4

install pr2 package.
sudo apt-get install pr2-melodic-*

step 7

7.1 install caffe

http://caffe.berkeleyvision.org/installation.html#compilation.
Note: sudo apt install caffe/caffe-cuda supports python3. so we install caffe through source code.

7.2 install cuda+cudnn

Note: cuda version < 10.0. caffe doesn’t support cuda 10.0. I choose cuda 9.1. At the same time, the gcc compiler must be version 5.x, because cuda requires that version.
Tips: If you have installed several versions of cuda, and you cannot change version after you add the set into .bashrc, maybe you can add some setups into /etc/profile and reboot you computer.

7.3 ImportError: No module named skimage.io

This is also a desperate problem. The bash reminds xxx required python >= 3.5. This maybe caused by the dependencies’ version. such as PyWavelets, dask[array]. so I install the scikit-image==0.12.3, at the same limiting the dependencies’ version.

pip install scikit-image==0.12.3 numpy==1.11 PyWavelets==1.0.3 networkx==1.8 scipy==0.11

maybe you can do some research about the source code

7.4 caffe ImportError: numpy.core.multiarray failed to import

when i import caffe, err still comes out, we upgrade numpy==1.13.

Written at the end

I am very happy if it helps you. If there is a problem, please point out. Thank you!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章