Ubuntu16.04安装gym

tech2022-07-04  167

安装过程

参考资源gym_gazebo安装过程Ubuntu 16.04Basic requirements:ROS Kinetic dependenciesGazebo gymDependencies and librariesinstall Theano gym_gazebo 安装 agent dependencies报错调试 Run the environment with a sample agent报错调试 Run the environment with a sample agent

参考资源

论文 basic_reinforcement_learning/tutorial7/ 教程Reinforcement Learning with ROS and Gazebo

erlerobot/gym-gazebo/INSTALL.md ubuntu16 安装gym-gazebo

gym_gazebo安装过程

主要参考erlerobot/gym-gazebo/INSTALL.md安装。 通过Anaconda构建python==3.5环境,在此虚拟环境中构建gym_gazebo。

Ubuntu 16.04

Basic requirements:

ROS Kinetic (/rosversion: 1.12.7)Gazebo 8.1.1Python 3.5.2OpenCV3OpenAI gym

参考特定版本 ROS + Gazebo 安装安装ROS kinetic与gazebo8。 Python3.5:通过Anaconda处理。 OpenCV3: conda install -c https://conda.anaconda.org/menpo opencv3 OpenAI gym: pip install gym

ROS Kinetic dependencies

sudo pip3 install rospkg catkin_pkg sudo apt-get install python3-pyqt4 sudo apt-get install \ cmake gcc g++ qt4-qmake libqt4-dev \ libusb-dev libftdi-dev \ python3-defusedxml python3-vcstool \ libbluetooth-dev libspnav-dev \ pyqt4-dev-tools libcwiid-dev \ ros-kinetic-octomap-msgs \ ros-kinetic-joy \ ros-kinetic-geodesy \ ros-kinetic-octomap-ros \ ros-kinetic-control-toolbox \ ros-kinetic-pluginlib \ ros-kinetic-trajectory-msgs \ ros-kinetic-control-msgs \ ros-kinetic-std-srvs \ ros-kinetic-nodelet \ ros-kinetic-urdf \ ros-kinetic-rviz \ ros-kinetic-kdl-conversions \ ros-kinetic-eigen-conversions \ ros-kinetic-tf2-sensor-msgs \ ros-kinetic-pcl-ros \ ros-kinetic-navigation \ ros-kinetic-ar-track-alvar-msgs #Install Sophus cd git clone https://github.com/stonier/sophus -b release/0.9.1-kinetic cd sophus mkdir build cd build cmake .. make sudo make install echo "## Sophus installed ##\n"

Gazebo gym

参考 ubuntu16 安装gym-gazebo Fork porterpan/gym-gazebo 的代码。

git clone -b master https://github.com/porterpan/gym-gazebo cd gym-gazebo pip3 install -e .

Dependencies and libraries

pip3 install h5py sudo apt-get install python3-skimage

install Theano

cd ~/ git clone git://github.com/Theano/Theano.git cd Theano/ sudo python3 setup.py develop #install Keras sudo pip3 install keras

gym_gazebo 安装 agent dependencies

gym_gazabe安装配置

cd gym_gazebo/envs/installation bash setup_kinetic.bash bash turtlebot_setup.bash

报错调试

1、修改:setup_kinetic.bash 中

#catkin_make --pkg mav_msgs #source devel/setup.bash #catkin_make -j 1 catkin_make_isolated bash -c 'echo source `pwd`/devel_isolated/setup.bash >> ~/.bashrc' echo "## ROS workspace compiled ##"

注意:修改了catkin_make_isolated & devel_isolated。 catkin_make, cmake, catkin build区别 catkin_make vs catkin_make_isolated, which is preferred? 2、在编译包时,会出现缺少包的情况。依次解决就行,很多坑。而且会爆内存,16G才够用。

Run the environment with a sample agent

ubuntu16 安装gym-gazebo

cd gym_gazebo/examples/scripts_turtlebot python circuit2_turtlebot_lidar_qlearn.py

报错调试

1、cv2.so

cd /opt/ros/kinetic/lib/python2.7/dist-packages sudo rm cv2.so # 老是忘了怎么重命名,再次在这里重新记下笔记 mv oldname newname # 要是重定义路径 mv oldname /*/*/newname

2、import tf

mkdir -p ~/catkin_ws/src; cd ~/catkin_ws catkin_make source devel/setup.bash wstool init wstool set -y src/geometry2 --git https://github.com/ros/geometry2 -v 0.6.5 wstool set -y src/geometry --git https://github.com/ros/geometry -v 1.12.0 wstool up rosdep install --from-paths src --ignore-src -y -r wstool init . wstool merge ~/catkin_ws/.rosinstall wstool update catkin_make --cmake-args \ -DCMAKE_BUILD_TYPE=Release \ -DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m \ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so

3、MoveIt

sudo apt install ros-kinetic-moveit

4、skimage库安装

conda install scikit-image

5、ImportError: No module named 'netifaces'

pip install netifaces

Run the environment with a sample agent

参考:gym-gazebo安装后的测试

cd gym_gazebo/examples/scripts_turtlebot python circuit2_turtlebot_lidar_qlearn.py

以下是我的运行命令:

conda activate py3.5 cd rl-ws/gym-gazebo/examples/turtlebot/ python circuit2_turtlebot_lidar_qlearn.py conda activate py3.5 cd rl-ws/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/devel_isolated/ source setup.bash export ROS_MASTER_URI=http://localhost:12795 export GAZEBO_MASTER_URI=http://localhost:12796 gzclient
最新回复(0)