安装gym-gazebo
-
第一步:安装python3.5.2
参考这个网页的链接安装
https://tecadmin.net/install-python-3-5-on-ubuntu/# -
第二步:安装opencv3.0
使用python3安装, 参考这个网页的链接安装
http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/ -
第三步:安装openai gym;
参考这个网页安装
https://github.com/openai/gym
注意:将pip全部替换成pip3
需要安装全部版本的。 -
第四步:安装ros kinetic
http://wiki.ros.org/kinetic/Installation/Ubuntu
问题
安装完之后,ros自带的opencv时基于python2.7的,与python3.5.2不兼容,解决方案: 删除cv2.so
cd /opt/ros/kinetic/lib/python2.7/dist-packages
sudo rm cv2.so`
- 1
- 2
-
第五步: 安装gym-gazebo
按照教程安装
https://github.com/erlerobot/gym-gazebo/blob/master/INSTALL.md#ubuntu-1604 -
最后的时候的指令
cd /home/zhw/gym-gazebo/gym_gazebo/envs/installation
bash setup_kinetic.bash
bash turtlebot_setup.bash
bash turtlebot_nn_setup.bash
- 1
- 2
- 3
- 4
安装的时候可能出现的问题
- 问题1 先出现的是msg的问题
解决方法:
cd /home/zhw/gym-gazebo/gym_gazebo/envs/installation
- 1
然后open gazebo.repos文件
在其中加入:
ar_track_alvar:
type: git
url: https://github.com/ros-perception/ar_track_alvar.git
version: kinetic-devel
mav_comm:
type: git
url: https://github.com/ethz-asl/mav_comm.git
version: master
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 问题2:
在使用bash setup_kinetic.bash进行安装的过程中,会出现make j-1等错误,找到问题点之后,一对一解决:
1)spacenav_node not compiling. CATKIN_IGNOREd.
touch /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/joystick_drivers/spacenav_node/CATKIN_IGNORE
- 1
2) wiimote not compiling. CATKIN_IGNOREd.
touch /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/joystick_drivers/wiimote/CATKIN_IGNORE
- 1
3)kobuki_qtestsuite not compiling. CATKIN_IGNOREd.
touch /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/kobuki_desktop/kobuki_qtestsuite/CATKIN_IGNORE
- 1
当测试安装是否完成时,使用
cd /home/zhw/gym-gazebo/examples/turtlebot
export ROS_PORT_SIM=11311
python3 circuit2_turtlebot_lidar_qlearn.py
- 1
- 2
- 3
- 4
这是因为没有把 ROS_PORT_SIM设置成为环境变量,导致了在gazebo_env.py文件中的
port = os.environ["ROS_PORT_SIM"]
- 1
不能正确识别ROS_PORT_SIM这个变量
- 问题3:
在运行 ‘python circuit2_turtlebot_lidar_qlearn.py ’ 报错
while processing /home/harish/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot_simulator/turtlebot_gazebo/launch/includes/kobuki.launch.xml:
Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/lib/xacro/xacro --inorder '/home/harish/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro'] returned with code [2].
Param xml is
The traceback for the exception was written to the log file
- 1
- 2
- 3
- 4
解决方法
使用gedit打开kobuki.launch.xml文件
gedit /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot_simulator/turtlebot_gazebo/launch/includes/kobuki.launch.xml
- 1
然后,将第六行替换成:
<arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'"/>
- 1
2018年1月6日补充:
看到github有人给了安装教程,解决python2和python3不兼容的问题, 有如下解决方案:
2to3 -w /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/control_toolbox/cfg/Parameters.cfg
2to3 -w /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/spawn_model
2to3 -w /home/zhw/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/src/gazebo_ros/gazebo_interface.py