Self-collisions#

Configuring self-collision pairs#

By default, all collision pairs will be enabled when loading the robot.

Disabling all collisions#

By passing the placo.Flags.ignore_collisions flag when loading the robot (see Flags), you can disable all collisions.

Specifying collision pairs#

If you want to specify which collision pairs you want to be enabled, you can create a collisions.json file next to your .urdf file, with the following structure:

[
    ["body1", "body2"],
    ["body3", "body4"]
]

Where body1, body2, body3 and body4 are the names of the bodies you want to enable collisions for. Those bodies should be the name of the links in the URDF file.

Note

Instead of using link name (strings), you can also use integers representing geometry objects (as the ones returned in Collision objects). Thanks to this, it is possible to write a script that samples robot configuration and auto-generates the collisions.json file.

Note

It is also possible to load collision pairs explicitely by using placo.RobotWrapper.load_collision_pairs()

Using self-collisions#

Checking for self-collisions#

By calling self_collisions(), you can get the current self collisions as a list of Collision objects.

Checking for nearest distances#

By calling distances(), you can get all the current minimum distances between the collision pairs as a list of Distance objects.

See also#

When using the kinematics solver, KinematicsSolver.add_avoid_self_collisions_constraint can be called to add a constraint to the solver so that self collisions are prevented.