记录一次使用Deepbots的强化学习DEMO
Deepbots是一个使用Webots环境作为仿真环境的强化学习框架。
Deepbots项目:
https://github.com/aidudezzz/deepbots
Deepbots tutorials:
https://github.com/aidudezzz/deepbots-tutorials
1、安装Deepbots
pip install deepbots
2、运行DEMO
git clone https://github.com/aidudezzz/deepbots-tutorials.git
webots XXX/deepbots-tutorials/robotSupervisorSchemeTutorial/full_project/worlds/cartPoleWorld.wbt
选择controller为robotSupervisorController。
3、常见报错
(1)
AttributeError: 'CartpoleRobot' object has no attribute 'getSelf'
Traceback (most recent call last): \
File "supervisorController.py", line 84, in <module>
env = CartpoleRobot()
File "supervisorController.py", line 15, in __init__
self.robot = self.getSelf() # Grab the robot reference from the supervisor to access various robot methods
AttributeError: 'CartpoleRobot' object has no attribute 'getSelf'
WARNING: 'supervisorController' controller exited with status: 1.
解决方案
pip uninstall deepbots
pip install -i https://test.pypi.org/simple/ deepbots
(2)
Traceback (most recent call last):
File "robotSupervisorController.py", line 96, in <module>
env = CartpoleRobot() File "robotSupervisorController.py", line 23, in __init__ self.positionSensor.enable(self.timestep)
AttributeError: 'NoneType' object has no attribute 'enable'
解决方案
self.positionSensor = self.getDevice('polePosSensor') # old
self.positionSensor = self.getPositionSensor('polePosSensor') # Fix
wheel = self.getDevice(wheelName) # old
wheel = self.getMotor(wheelName) # Fix