文章目錄
Guided Policy Search算法代碼環境安裝的坑
官方安裝教程:http://rll.berkeley.edu/gps/
遇到的坑
1. 第一個坑,安裝box2d
如果是在虛擬環境中,就算在gps_main.py文件中使用sys.path.append(“path/to/box2d”)也可能存在import Box2d時報錯,那就裝在全局環境吧。
2. 第二個坑,提示QT相關的錯誤
在import matplotlib as mpl的時候,會提示no module,或者qt相關錯誤,在gps_main.py文件中
import matplotlib as mpl
# mpl.use('Qt4Agg')
mpl.use('Qt5Agg')
將原來的QT4註銷掉。使用QT5,這裏的QT可能是安裝ros-melodic-desktop-full中帶出來的。
虛擬環境使用:https://www.ctolib.com/topics-86651.html
3. 第三個坑,ROS setup時,編譯gps_agent_pkg出錯
提示ResourceError: ConvexDecomposition
那就安裝相關的東西
sudo apt-get install convex-decomposition
sudo apt-get install iv*** # 記不清叫什麼了,看錯誤安裝即可
4. 第四個坑,提示error: expected constructor, destructor, or type conversion before “(” token PLUGINLIB_DECLARE_CLASS(gps_agent_pkg, GPSPR2Plugin,
錯誤如下圖:
這個最坑爹,ROS官網上就是這樣寫的,沒毛病。
那你告訴我怎麼會出錯,百度來百度去,發現這個寫法,在melodic中被棄用了。
正確寫法爲:
// 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)
參考:https://www.ncnynl.com/archives/201702/1322.html
這樣子就千難萬險,編譯gps_agent_pkg成功。
5. 第五個坑,no module named gps_agent_pkg,
在python/gps/agent/ros/ros_utils.py
文件中,有from gps_agent_pkg.msg import ControllerParams, LinGaussParams, TfParams, CaffeParams, TfActionCommand
,怎麼都找不到路徑,sys.path.append()也不行。
目前尚未解決
6. 第六個坑,安裝cuda
這裏選擇安裝cuda10.1。教程網上很多,百度。
注意事項:
- 選擇runfile的版本,可以手動選擇不安裝安裝包中的驅動,使用本機自帶的驅動,不然會出錯。
- nvcc -V查看版本,和自己安裝的版本不一致,配置~/.bashrc無效,則配置/etc/profile,重啓電腦,因爲profile文件是在啓動時生效,source只能暫時又用,切換終端就會失敗。
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda
- 切換cuda版本,重新創建
/usr/local/cuda
的軟鏈接
7. 第七個坑 ,編譯caffe
./include/caffe/util/cudnn.hpp:8:34: fatal error: caffe/proto/caffe.pb.h
參考鏈接:https://blog.csdn.net/u012759006/article/details/82496237
反正一堆毛病
8. 鼓起勇氣,推翻上面的安裝,安裝cuda9.1
原因:別人用cuda9成功了
https://blog.csdn.net/hitlizhaoting/article/details/86562747