collision_manager.py
Go to the documentation of this file.
1 import hppfcl as fcl
2 import numpy as np
3 
4 sphere = fcl.Sphere(0.5)
5 sphere_obj = fcl.CollisionObject(sphere)
6 
7 M_sphere = fcl.Transform3f.Identity()
8 M_sphere.setTranslation(np.array([-0.6, 0.0, 0.0]))
9 sphere_obj.setTransform(M_sphere)
10 
11 box = fcl.Box(np.array([0.5, 0.5, 0.5]))
12 box_obj = fcl.CollisionObject(box)
13 
14 M_box = fcl.Transform3f.Identity()
15 M_box.setTranslation(np.array([-0.6, 0.0, 0.0]))
16 box_obj.setTransform(M_box)
17 
18 collision_manager = fcl.DynamicAABBTreeCollisionManager()
19 collision_manager.registerObject(sphere_obj)
20 collision_manager.registerObject(box_obj)
21 
22 assert collision_manager.size() == 2
23 
24 collision_manager.setup()
25 
26 # Perform collision detection
27 callback = fcl.CollisionCallBackDefault()
28 collision_manager.collide(sphere_obj, callback)
29 
30 assert callback.data.result.numContacts() == 1


hpp-fcl
Author(s):
autogenerated on Fri Jun 2 2023 02:39:00