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

How to convert odometry_sequences to bag #18

Closed
lynubot opened this issue Mar 17, 2018 · 13 comments
Closed

How to convert odometry_sequences to bag #18

lynubot opened this issue Mar 17, 2018 · 13 comments

Comments

@lynubot
Copy link

lynubot commented Mar 17, 2018

I'm running this package on Ubuntu 16.04 with python aliased to python2.7, I ran into this exception message:
Traceback (most recent call last): File "/usr/local/bin/kitti2bag", line 394, in <module> main() File "/usr/local/bin/kitti2bag", line 359, in main kitti = pykitti.odometry(args.dir, args.sequence) File "/usr/local/lib/python2.7/dist-packages/pykitti/odometry.py", line 34, in __init__ self._load_calib() File "/usr/local/lib/python2.7/dist-packages/pykitti/odometry.py", line 172, in _load_calib data['T_cam0_velo'] = np.reshape(filedata['Tr'], (3, 4)) KeyError: 'Tr'
How to resolve this question

@lynubot lynubot closed this as completed Mar 21, 2018
@sunzwdd
Copy link

sunzwdd commented Aug 8, 2019

I meet the same question. Is there some solutions?

@MrMinemeet
Copy link

More or less having the same problem at the moment.

~/src$ kitti2bag -s 00 odom_gray
Traceback (most recent call last):
  File "/home/alex/.local/bin/kitti2bag", line 394, in <module>
    main()
  File "/home/alex/.local/bin/kitti2bag", line 359, in main
    kitti = pykitti.odometry(args.dir, args.sequence)
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 33, in __init__
    self._load_calib()
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 169, in _load_calib
    data['T_cam0_velo'] = np.reshape(filedata['Tr'], (3, 4))
KeyError: 'Tr'

@valgur
Copy link
Collaborator

valgur commented Nov 12, 2019

You can try my personal kitti2bag fork/pull request, which fixes the breaking changes from newer pykitti versions you encountered. The CLI command is slightly different as well: kitti2bag odom -c gray -s 00.

@MrMinemeet
Copy link

@valgur I tried your fork you linked to.
Sadly it still gives me the KeyError: 'Tr'

kitti2bag odom -c gray -s 00
Traceback (most recent call last):
  File "/usr/local/bin/kitti2bag", line 11, in <module>
    load_entry_point('kitti2bag==1.5', 'console_scripts', 'kitti2bag')()
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "build/bdist.linux-x86_64/egg/kitti2bag/__init__.py", line 317, in convert_odom
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 33, in __init__
    self._load_calib()
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 169, in _load_calib
    data['T_cam0_velo'] = np.reshape(filedata['Tr'], (3, 4))
KeyError: 'Tr'

@valgur
Copy link
Collaborator

valgur commented Nov 13, 2019

It seems like the odom calibration files you have might simply be broken/empty for some reason? Try extracting and overwriting the calibration files again.

@MrMinemeet
Copy link

ok. So I redownloaded the 21GB kitti dataset tried running kitti2bag which gave me the same error as above . So I replaced the calibration files with the ones that you linked to. When running it with the replaced calibration files it throws me a new error.

alex@W550s:~/Desktop/dataset$ kitti2bag odom -c gray -s 00
Traceback (most recent call last):
  File "/usr/local/bin/kitti2bag", line 11, in <module>
    load_entry_point('kitti2bag==1.5', 'console_scripts', 'kitti2bag')()
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/alex/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "build/bdist.linux-x86_64/egg/kitti2bag/__init__.py", line 317, in convert_odom
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 35, in __init__
    self._load_poses()
  File "/home/alex/.local/lib/python2.7/site-packages/pykitti/odometry.py", line 228, in _load_poses
    except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined

@valgur
Copy link
Collaborator

valgur commented Nov 14, 2019

Looks like pykitti only supports Python 3. Try using it instead.

@MrMinemeet
Copy link

ok I installed your kitti2bag using pip3 now. had to install a few extra things that where missing.
Now I'm stuck with this one:

alex@W550s:~$ kitti2bag 
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
Traceback (most recent call last):
  File "/home/alex/.local/bin/kitti2bag", line 11, in <module>
    load_entry_point('kitti2bag==1.5', 'console_scripts', 'kitti2bag')()
  File "/home/alex/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/alex/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/home/alex/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/home/alex/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/alex/.local/lib/python3.6/site-packages/kitti2bag/__init__.py", line 21, in <module>
    from tf.transformations import quaternion_from_euler, quaternion_from_matrix
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/__init__.py", line 30, in <module>
    from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 38, in <module>
    from tf2_py import *
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>
    from ._tf2 import *
ImportError: dynamic module does not define module export function (PyInit__tf2)

@ulterzlw
Copy link
Collaborator

ulterzlw commented Nov 16, 2019

I have to say the kitti2bag installed from pip is out of date.
I think you can amend the source code on your own with just a little effort to make it compatible with latest pykitti.
I tried valgur's fork before and it worked well.
Also, you can try my fork. Please follow the How to install it? & How to run it? instruction to make it work.

@MrMinemeet
Copy link

MrMinemeet commented Nov 16, 2019

Nice got it working now. I'm not sure if it's because of the other way to install pykitti which is mentioned in @ulterzlw 's fork or it didn't work as I tried to install kitti2bag using pip3 install git+https://github.com/valgur/kitti2bag.git.
Either way both forks work now. 👍
Thank you so much

@heethesh
Copy link

heethesh commented Dec 8, 2019

@ulterzlw 's I had issues with transforms in /tf_static not being published. @valgur how can I publish point clouds as well for odometry sequences using your version?

@valgur
Copy link
Collaborator

valgur commented Dec 10, 2019

@heethesh Point cloud conversion for odometry bags is not yet implemented, unfortunately. You can try adapting the relevant part from the raw bag conversion code for odometry bags, if you have a need for this right now. I'll probably add this at some later point.

@ulterzlw
Copy link
Collaborator

@heethesh Hi, does the generated odometry bag contain /tf_static. If it does, the static transformation utilizes ros_tf2, which just needs to be pulished once.
You can also load rviz/kitti.rviz from my fork to rviz, and play bag to visualize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants