我想复制以下教程,但当我尝试获取机器人参考时,总是出现以下错误:
"AttributeError: 'CartpoleRobot' object has no attribute 'getSelf'"
我重新构建本教程:https://github.com/aidudezzz/deepbots-tutorials/blob/master/robotSupervisorSchemeTutorial/README.md
在其他控制器中,当我尝试获取机器人引用时,会收到类似的错误消息。我认为错误在于机器人仿真和控制器之间的通信。
我已尝试导入supervisor并通过supervisor.get获取函数。但另一个错误来了:"Only one instance of the Robot class should be created"
然而,我对webots和机器人学/信息学一般来说是新手。任何帮助都将不胜感激
回溯的整个错误:
INFO: robotSupervisorController: Starting controller: python.exe -u robotSupervisorController.py
Traceback (most recent call last):
File "D:\Webots Projekte\controllers\robotSupervisorController\robotSupervisorController.py", line 88, in <module>
env = CartpoleRobot()
File "D:\Webots Projekte\controllers\robotSupervisorController\robotSupervisorController.py", line 16, 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: 'robotSupervisorController' Controller beendet mit Status: 1
代码与教程中显示的代码相同。 生成错误的短部分:
self.robot = self.getSelf() # Grab the robot reference from the supervisor to access various robot methods
self.positionSensor = self.getDevice("polePosSensor")
self.positionSensor.enable(self.timestep)
如果我注释掉第一行,下一行将返回类似的错误
非常感谢您的每一个回答!谢谢
我也有同样的问题。我使用deepbots-0.1.2和webotsR2021a
尝试卸载deepbots,然后使用以下命令安装它们:
pip install -i https://test.pypi.org/simple/ deepbots
相关问题 更多 >
编程相关推荐