3

I have a hinge joint between two objects, a sphere and a box. I wonder how I can avoid the sphere going inside the box when it's rotating around the box with a rotational motor. enter image description here

Here is a snapshot of the sphere getting inside the box when rotating along x-axis: enter image description here

Both objects have physics, and are under a robot. I'm happy to share more code, but I believe it's simplistic webots world - please let me know. Thanks!

Sanjay Verma
  • 980
  • 14
  • 33

1 Answers1

1

You are probably looking for the 'selfCollision' field of the Robot device (which is False by default) if you set this field to True the robot will be able to self-collide.

But be careful as stated in the doc this has an impact on the simulation speed:

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

And will not handle collision between directly consecutive solids:

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

More information available in the documentation: https://cyberbotics.com/doc/reference/robot#field-summary

David Mansolino
  • 1,673
  • 4
  • 12
  • Thanks David, I think the part which mentions "two solids attached to each other with a joint, no collision detection is performed, even if the self collision is enabled." answers my question. I'll stick with the minStop and maxStop attributes! Thank you! – Sanjay Verma Dec 21 '19 at 05:35