【问题标题】:How to prevent an object from rotating about or moving relative to particular axis on pybullet?如何防止对象在 pybullet 上绕特定轴旋转或相对于特定轴移动?
【发布时间】:2017-10-25 13:34:34
【问题描述】:

有几种模糊的描述可以做到这一点,比如“使用createMultiBody方法”或“使用最大坐标”,但没有其他信息。

更具体地说,我正在加载使用 loadURDF 方法使用 SolidWorks 创建的对象,但我希望它们仅围绕其 z 轴旋转,并且仅围绕其 x 和 y 轴移动。我怎样才能做到这一点?有没有办法为整个环境启用此功能?

编辑:这是我基本上想做的:

import pybullet as p

p.connect(p.DIRECT)

OBJECT_1 = p.loadURDF("/location/of/object1.urdf")
OBJECT_2 = p.loadURDF("/location/of/object2.urdf")
OBJECT_3 = p.loadURDF("/location/of/object3.urdf")
OBJECT_4 = p.loadURDF("/location/of/object4.urdf")

# code to prevent the motion of OBJECT_1, OBJECT_2, OBJECT_3, and OBJECT_4
# (or the entire simulation) along the z axis.

# code to prevent the rotation of OBJECT_1, OBJECT_2, OBJECT_3, and OBJECT_4
# (or the entire simulation) along the x and y axes.

while True:
    p.stepSimulation()

p.disconnect()

【问题讨论】:

  • 您应该为您的问题提供一个最小的工作版本,例如您的代码中包含在所有轴上旋转的对象。这样你得到你想要的东西的机会很低。

标签: python physics-engine bulletphysics bullet


【解决方案1】:

我不久前找到了一个半满意的解决方案;如果有更好的,请分享。

虽然您不能从 Bullet 的 python 绑定中做到这一点,但可以通过引入没有碰撞形状的“世界”链接从 URDF(或 SDF)文件中引入这些约束,然后定义世界和目的。例如,请参阅此example of a biped multibody constrained to moving in the y and z axes

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-15
    • 2017-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多