python-fcl
python-fcl copied to clipboard
Example usages for fcl.OcTree
Would it be possible to add tests and examples using fcl.OcTree. Could you give an instantiation example? I assume it should be read from bytes representing an octree. If I give:
fcl_tree =fcl.OcTree(0.1, data)
It gives the following error:
Traceback (most recent call last): File "example1.py", line 20, in <module> fcl_tree =fcl.OcTree(0.1, data) File "fcl/fcl.pyx", line 403, in fcl.fcl.OcTree.__cinit__ File "stringsource", line 48, in vector.from_py.__pyx_convert_vector_from_py_char TypeError: an integer is required
I'm also having trouble reading an octree .bt file. I initially saw the same error as @eaa3, (integer required). Then I tried passing the binary data as an int array as follows:
fcl_tree = fcl.OcTree(0.1, [ord(c) for c in open(btFile, 'r').read()])
With this I get the error:
OverflowError Traceback (most recent call last)
<ipython-input-47-293f93fa0a25> in <module>()
----> 1 fcl_tree = fcl.OcTree(0.1, [ord(c) for c in open(btFile, 'r').read()])
fcl/fcl.pyx in fcl.fcl.OcTree.__cinit__()
~/.local/lib/python2.7/site-packages/fcl/fcl.so in vector.from_py.__pyx_convert_vector_from_py_char()
OverflowError: value too large to convert to char
A way around this could be to convert the octree into boxes and perform collision-detection on the boxes. Check out this link for an example implementation: https://github.com/kucars/laser_collision_detection/blob/1b78fe5a95584d135809b1448d33675bb8fee250/src/laser_obstacle_detect.cpp#L252
I don't have a solution, but I dug this up for other people looking into this: http://library.isr.ist.utl.pt/docs/roswiki/octomap(2f)Tutorials(2f)Creating(20)an(20)OctoMap(20)from(20)existing(20)3D(2028)mesh(2920)data.html
This lib doesn't seem to be maintained anymore, has anyone already done collision detection using octree?