python-fcl
python-fcl copied to clipboard
How to use fcl.OcTree in python-fcl.
Hey everyone!
I am wondering is it possible to create an octree from point cloud using fcl.OcTree, then do the collision detection using fcl.OcTree. Issue #7 mentioned the similar question, but I can't find answers there. Could you guys offer some examples on how to use this.
Thanks a lot!
I've made a quick change to python-fcl so I can use the insertPointCloud method of octomap.OcTree. See my fork (on a branch currently) + the source change: https://github.com/cedriclmenard/python-fcl-octomap/blob/ef7553eedc71fcd3f13a6717b7681b03f61f4418/src/fcl/fcl.pyx#L460
Hi, Did you have problem with octomap configuration under windows? How I can access to the method octomap.OcTree? I've build everything but I don't understand how I can import it.
Sorry, I'm new with this stuff.
Thank you !
Once you create the fcl.OcTree object (without arguments), you can call insertPointCloud with a points list/array (n points x 3 dimension). The given OcTree will be compatible with all the python-fcl functions you call, just like a Box, BVH or any fcl geometry.
Hi Cedric, I made the changes in the python-fcl to use the insertPointCloud but I get an error while creating the fcl.OcTree object. I tried passing a single argument for r but it says 2 positional arguments required.
goem = fcl.OcTree()
File "src/fcl/fcl.pyx", line 467, in fcl.fcl.OcTree.__cinit__
TypeError: __cinit__() takes exactly 2 positional arguments (0 given)
Once you create the
fcl.OcTreeobject (without arguments), you can callinsertPointCloudwith a points list/array (n points x 3 dimension). The given OcTree will be compatible with all the python-fcl functions you call, just like a Box, BVH or any fcl geometry.
Hi! Can you give an example on how to use fcl.OcTree().insertPointCloud()?
With the following code snippet
x = np.random.random([100, 3])
object1 = fcl.OcTree(0.2).insertPointCloud(x)
object2 = fcl.Box(1, 2, 3)
o1 = fcl.CollisionObject(object1, fcl.Transform())
o2 = fcl.CollisionObject(object2, fcl.Transform())
request = fcl.CollisionRequest()
result = fcl.CollisionResult()
req = fcl.collide(o2, o2, request, result)
print(req)
, I will get the error like this
o1 = fcl.CollisionObject(object1, fcl.Transform())
File "src/fcl/fcl.pyx", line 140, in fcl.fcl.CollisionObject.__cinit__
ValueError
Help would be greatly appreciated!
Once you create the
fcl.OcTreeobject (without arguments), you can callinsertPointCloudwith a points list/array (n points x 3 dimension). The given OcTree will be compatible with all the python-fcl functions you call, just like a Box, BVH or any fcl geometry.Hi! Can you give an example on how to use
fcl.OcTree().insertPointCloud()?With the following code snippet
x = np.random.random([100, 3]) object1 = fcl.OcTree(0.2).insertPointCloud(x) object2 = fcl.Box(1, 2, 3) o1 = fcl.CollisionObject(object1, fcl.Transform()) o2 = fcl.CollisionObject(object2, fcl.Transform()) request = fcl.CollisionRequest() result = fcl.CollisionResult() req = fcl.collide(o2, o2, request, result) print(req), I will get the error like this
o1 = fcl.CollisionObject(object1, fcl.Transform()) File "src/fcl/fcl.pyx", line 140, in fcl.fcl.CollisionObject.__cinit__ ValueErrorHelp would be greatly appreciated!
You can simply use the following if you are using my branch.
o1 = fcl.CollisionObject(fcl.OcTree(resolution, points=points))
Once you create the
fcl.OcTreeobject (without arguments), you can callinsertPointCloudwith a points list/array (n points x 3 dimension). The given OcTree will be compatible with all the python-fcl functions you call, just like a Box, BVH or any fcl geometry.Hi! Can you give an example on how to use
fcl.OcTree().insertPointCloud()? With the following code snippetx = np.random.random([100, 3]) object1 = fcl.OcTree(0.2).insertPointCloud(x) object2 = fcl.Box(1, 2, 3) o1 = fcl.CollisionObject(object1, fcl.Transform()) o2 = fcl.CollisionObject(object2, fcl.Transform()) request = fcl.CollisionRequest() result = fcl.CollisionResult() req = fcl.collide(o2, o2, request, result) print(req), I will get the error like this
o1 = fcl.CollisionObject(object1, fcl.Transform()) File "src/fcl/fcl.pyx", line 140, in fcl.fcl.CollisionObject.__cinit__ ValueErrorHelp would be greatly appreciated!
You can simply use the following if you are using my branch.
o1 = fcl.CollisionObject(fcl.OcTree(resolution, points=points))
@STAY-Melody @geekyp99 @ryanreadbooks @giacko93 Hi,everyone. I have build the wheel for linux to use the branch and can success to use the script blew
o1 = fcl.CollisionObject(fcl.OcTree(resolution, points=points))
you can get the wheel from https://drive.google.com/drive/folders/1YrZe-YWKL5of6LwkpNIKGk2TXgA2AJ5B?usp=drive_link But I failed to build wheels on Windows。 If you also have any good solutions, please kindly share with me. Thanks!
Hi, I'm giacko93 with another account. Did you solve your problem?
@cedriclmenard @jacky-ch93 @ryanreadbooks @zichunxx I have this error File "src/fcl/fcl.pyx", line 467, in fcl.fcl.OcTree.cinit TypeError: cinit() takes exactly 2 positional arguments (1 given)
Could you help me?
@giacomogolluccio the python-fcl-octomap from @cedriclmenard is now 40 commits behind BerkeleyAutomation/python-fcl you can find an up to date forked version here (https://github.com/automatika-robotics/python-fcl) that includes the PointCloud support.