当前位置: 首页 > 工具软件 > TORCS > 使用案例 >

开源项目 TORCS经验

凌俊材
2023-12-01

安装部分

sudo apt-get install xautomation报错

The following packages have unmet dependencies:
 electron-ssr : Depends: libappindicator1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

按照提示执行 sudo apt-get -f install 报错can’t fetch 清华源
开始换源:
1、备份原始文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

2、打开文件

vim /etc/apt/sources.list

3、阿里源也不行,换成东北大学源

deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse

全覆盖就行
4、重新执行apt-get -f install

ubuntu E: Package ‘libpng12-dev’ has no installation candidate

18.04后’libpng12-dev’被废弃,改成libpng-dev。

运行torcs

1. 出现报错
Compatibility mode, properties unknown.
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 151 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 31
Current serial number in output stream: 32

google一下发现似乎是显卡驱动有问题,在尝试更新驱动无效后,发现是服务器的VNC的bug,在MobaXterm上直接运行torcs即可。(Gobigger也有同样的显示bug。)
2. 帧数一直是个位数,在查看源代码良久无效,遂换到20.04上重新安装,正常了。百思不得其解,望如有解决方法请告知,不胜感激。

开始训练

1. 在成功运行torcs后开始ddpg的训练,运行ddpg报错Shapes (3, 2, 1) and () are incompatible,原因是安装的TensorFlow版本较高,把虚拟环境中keras/backend/tensorflow_backend.py文件修改第716行,改成tf.concat的两个参数换一下顺序即可。

2. 报错:ImportError: cannot import name collect_trainable_weights
原因:keras版本过高,重新pip install keras==1.1.0
或者

  • 注释掉ddpg.py中的from keras.engine.training import collect_trainable_weights
    修改ActorNetwork.py,将from keras.initializations import normal, identity中的initializtion改为initializers,注释掉from keras.engine.training import collect_trainable_weights
    修改CriticNetworks.py,keras.initializtion改为keras.initializers, 注释掉from keras.engine.training

3. 1)跑起来总有一种歪歪扭扭的感觉;改进构想:调整参数或调整奖励值。
2)车子经常撞到赛道边缘然后就卡住不动了;改进构想:新增倒车动作或当当前状态与前一状态的位移差小于阈值,运行reset。

参考:“Simulated Car Racing Championship Competition Software Manual”

 类似资料: