使用kitti2bag转换KITTI数据集(一些问题)

主要过程参考如下
kitti2bag

几个自己遇到的问题

tf使用报错

Traceback (most recent call last):
  File "/home/qzy/.local/bin/kitti2bag", line 12, in <module>
    import tf
  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)

这应该是因为tf不适用于Python3,只适用于Python2。.
修改安装后的kitti2bag脚本文件
第一行修改为 #!/usr/bin/python2.7即可

转换时找不到文件

例如

IOError: [Errno 2] No such file or directory: '/home/xxx/Data/kitti_bag/2011_09_26_drive_0046_sync/2011_09_26/2011_09_26/calib_imu_to_velo.txt'

或者

IOError: [Errno 2] No such file or directory: '/home/xxx/Data/kitti_bag/2011_09_26_drive_0046_sync/2011_09_26/2011_09_26/2011_09_26_drive_0046_sync/oxts/timestamps.txt'

这里需要注意执行kitti2bag命令时的目录位置

例如kitti数据目录为

2011_09_26_drive_0046/
├── 2011_09_26
│   ├── 2011_09_26_drive_0046_sync
│   ├── calib_cam_to_cam.txt
│   ├── calib_imu_to_velo.txt
│   └── calib_velo_to_cam.txt
└── kitti_2011_09_26_drive_0046_synced.bag

则需要在最外层的2011_09_26_drive_0046目录下使用命令进行转换
( kitti_2011_09_26_drive_0046_synced.bag文件是转换后在此目录下生成的,转换之前是没有的)

kitti2bag -t 2011_09_26 -r 0046 raw_synced .

都是新手问题,给自己记录一下。

你可能感兴趣的:(SLAM学习)