Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read octree from .bt file #10

Open
Abhishek-EE opened this issue Feb 23, 2022 · 4 comments
Open

Unable to read octree from .bt file #10

Abhishek-EE opened this issue Feb 23, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Abhishek-EE
Copy link

Abhishek-EE commented Feb 23, 2022

Hello, I was trying to use octomap-python to read the binary tree stored in .bt file but it throws this error, the error logs are as follows,

File "/Users/abhishekranjansingh/opt/anaconda3/envs/path-generator/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/abhishekranjansingh/opt/anaconda3/envs/path-generator/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/abhishekranjansingh/.vscode/extensions/ms-python.python-2022.0.1814523869/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/Users/abhishekranjansingh/.vscode/extensions/ms-python.python-2022.0.1814523869/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main run() File "/Users/abhishekranjansingh/.vscode/extensions/ms-python.python-2022.0.1814523869/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file runpy.run_path(target_as_str, run_name=compat.force_str("__main__")) File "/Users/abhishekranjansingh/opt/anaconda3/envs/path-generator/lib/python3.9/runpy.py", line 268, in run_path return _run_module_code(code, init_globals, run_name, File "/Users/abhishekranjansingh/opt/anaconda3/envs/path-generator/lib/python3.9/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/Users/abhishekranjansingh/opt/anaconda3/envs/path-generator/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/abhishekranjansingh/dev/cptsp-solver/cptsp_solver/main.py", line 41, in <module> octree = octomap.OcTree("AIR_A320_200.bt") File "octomap/octomap.pyx", line 322, in octomap.OcTree.__cinit__ TypeError: expected bytes, str found

When i try using readBinary(string) function it says:
Traceback (most recent call last): File "<string>", line 1, in <module> File "octomap[/octomap.pyx]()", line 439, in octomap.OcTree.readBinary TypeError: startswith first arg must be str or a tuple of str, not bytes

If anyone has any alternative to my current approach the help would be highly appreciated.

@wkentaro
Copy link
Owner

Can you give a sample .bt file to debug?

@Abhishek-EE
Copy link
Author

Hi @wkentaro,
Thanks for such quick response. Sure, here is the link for the file https://drive.google.com/file/d/1pWoAS4JcN3GUg5wmmkHvUXw-kzPGDHhy/view?usp=sharing

@wkentaro
Copy link
Owner

Not ideal, but you can use .encode() as a workaround.

octree = octomap.OcTree("./AIR_A320_200.bt".encode())

@wkentaro wkentaro added the bug Something isn't working label Feb 23, 2022
@Abhishek-EE
Copy link
Author

Thanks for the being so apt, this works. I think the readBinary function would also work if I encode the input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants