win10安装pybullet并测试

编程知识 更新时间:2023-05-02 20:16:46

安装

pip install pybullet

可能出现的问题:
1、microsoft visual c++ 14.0 or greater is required.
解决:访问 http://go.microsoft/fwlink/?LinkId=691126,安装下载的文件。

测试

import pybullet as p
from time import sleep

physicsClient = p.connect(p.GUI)

p.setGravity(0, 0, -10)
# planeId = p.loadURDF("plane.urdf")
cubeStartPos = [0, 0, 1]
cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0])
boxId = p.loadURDF("path_to_urdf", cubeStartPos, cubeStartOrientation)
cubePos, cubeOrn = p.getBasePositionAndOrientation(boxId)

useRealTimeSimulation = 0

if (useRealTimeSimulation):
  p.setRealTimeSimulation(1)

while 1:
  if (useRealTimeSimulation):
    p.setGravity(0, 0, -10)
    sleep(0.01)  # Time in seconds.
  else:
    p.stepSimulation()

可能出现的问题:
1、pybullet.error: cannot load urdf file.
解决:path_to_urdf 要写绝对路径。
2、b3Printf: path_to_urdf.urdf:15: cannot find ‘path_to_urdf.obj’ in any directory in urdf path
解决:urdf所在的文件夹内需要包含模型文件,将path_to_urdf.obj放到path_to_urdf.urdf的同目录下即可。

最终的结果:

参考:https://blog.csdn/weixin_41045354/article/details/104534581

更多推荐

win10安装pybullet并测试

本文发布于:2023-04-28 12:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/9436bff30424440ae904225bd9e1ac2f.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   pybullet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 108643文章数
  • 27461阅读数
  • 0评论数