pybullet.error: GetBasePositionAndOrientation failed.报错

pybullet.error: GetBasePositionAndOrientation failed.报错

  • 问题描述
  • 解决方案

问题描述

使用Pybullet时,发现这个问题:

pybullet.error: GetBasePositionAndOrientation failed.

定位到报错的位置:

pos, _ = p.getBasePositionAndOrientation(index, physicsClientId=self.PYB_CLIENT)

# 其中
self.PYB_CLIENT = p.connect(p.DIRECT)

解决方案

在代码运行过程中 self.PYB_CLIENT 发生了改变,导致 connect 不上客户端
self.PYB_CLIENT的变化
删除 self.PYB_CLIENT 即可

pos, _ = p.getBasePositionAndOrientation(index)

(P.S.:虽然并没有相关代码使 self.PYB_CLIENT 发生改变,但它确实是变了,比较离谱,也求大佬能够解答)

你可能感兴趣的:(python,学习)