Webots - 避免 "joint" 个物体进入彼此内部(即如何为铰链关节中的物体启用碰撞?)

Webots - Avoid "joint" objects getting inside one another (i.e. how to enable collision for objects in hinge joint?)

我在两个物体(一个球体和一个盒子)之间有一个铰链关节。我想知道当球体用旋转电机围绕盒子旋转时如何避免球体进入盒子内部。

这是沿 x 轴旋转时球体进入盒子内部的快照:

两个对象都有物理特性,并且都在机器人下面。我很高兴分享更多代码,但我相信这是简单的网络世界 - 请让我知道。谢谢!

您可能正在寻找 Robot 设备的 'selfCollision' 字段(默认情况下为 False),如果您将此字段设置为 True,机器人将能够自碰撞。

但要小心,如文档中所述,这会影响模拟速度:

Enabling self collision is, however, likely to decrease the simulation speed, as more collisions will be generated during the simulation

并且不会处理直接连续实体之间的碰撞:

Note that only collisions between non-consecutive solids will be detected. For consecutive solids, e.g., two solids attached to each other with a joint, no collision detection is performed, even if the self collision is enabled. The reason is that this type of collision detection is usually not wanted by the user, because a very accurate design of the bounding objects of the solids would be required. To prevent two consecutive solid nodes from penetrating each other, the minStop and maxStop fields of the corresponding joint node should be adjusted accordingly

文档中提供了更多信息: https://cyberbotics.com/doc/reference/robot#field-summary