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 generate rosbag from the KITTI odometry Velodyne dataset #10

Open
vkee opened this issue Jul 12, 2017 · 19 comments
Open

Unable to generate rosbag from the KITTI odometry Velodyne dataset #10

vkee opened this issue Jul 12, 2017 · 19 comments

Comments

@vkee
Copy link

vkee commented Jul 12, 2017

Hi,

I'm unable to generate a rosbag from the KITTI odometry Velodyne dataset (http://www.cvlibs.net/download.php?file=data_odometry_velodyne.zip).

I get a AttributeError: odometry instance has no attribute 'load_calib' when I try to run kitti2bag odom_color -s 01.

Has anyone been able to do this successfully?

Thanks!

@tomas789
Copy link
Owner

I'm currently downloading the dataset to try it but it will take a while since it is very large. This is probably caused by pykitti since they changed API. It should be already fixed. Can you try it with current version please? Try the version from Github although newest version from pip should work too.

@vkee
Copy link
Author

vkee commented Jul 12, 2017

I installed everything today and had this issue. Please let me know if you are able to get it to work.

Thanks!

@vkee
Copy link
Author

vkee commented Jul 24, 2017

Any updates on this? I tried both the latest version from Github along with the latest from pip.

Thanks!

@bartville
Copy link

bartville commented Sep 6, 2017

Hi guys, I've got the same exactly issue while converting a sequence of kitti velodyne datasets

AttributeError: odometry instance has no attribute 'load_calib'

Any updates?

Update
I had a look at https://github.com/utiasSTARS/pykitti/tree/master/pykitti, and modified the content of the /usr/local/bin/kitti2bag script.
load_calib becomes _load_calib
same for load_timestamps to _load_timestamps

a problem still remains with load_poses() that seems not be used anymore in pyKitti

Update 2.0
I checkout pyKitti to an old commit (before june 2017) and start again. Still problems with a wrong call to load_rgb instad of load_velo
I give up for the moment.

@CtfChan
Copy link

CtfChan commented Sep 7, 2017

Hey bartville I am having the exact same issue as you with the stereo dataset. kitti2bag calls on nonexistent functions from pykitti and the script just crashes.

@AbnerCSZ
Copy link

I have encountered the same problem as yours.#16 And I solved it. The odometry datasets are just subsets of the raw data. We can't use kitti2bag to directly convert odometry data to rosbag. But we can find the mapping from odometry sequences to raw sequences in the readme.txt file included with the odometry development kit, and then use kitti2bag.

In order to allow the usage of the laser point clouds, gps data, the right
camera image and the grayscale images for the TRAINING data as well, we
provide the mapping of the training set to the raw data of the KITTI dataset.
The following table lists the name, start and end frame of each sequence that
has been used to extract the visual odometry / SLAM training set:

Nr. Sequence name Start End

00: 2011_10_03_drive_0027 000000 004540
01: 2011_10_03_drive_0042 000000 001100
02: 2011_10_03_drive_0034 000000 004660
03: 2011_09_26_drive_0067 000000 000800
04: 2011_09_30_drive_0016 000000 000270
05: 2011_09_30_drive_0018 000000 002760
06: 2011_09_30_drive_0020 000000 001100
07: 2011_09_30_drive_0027 000000 001100
08: 2011_09_30_drive_0028 001100 005170
09: 2011_09_30_drive_0033 000000 001590
10: 2011_09_30_drive_0034 000000 001200

@wutongyu98
Copy link

wutongyu98 commented Oct 31, 2018

modified version of https://github.com/tomas789/kitti2bag

  1. Install pykitti pip install pykitti

  2. Modify pykitti/odometry.py file located in /usr/local/lib/python2.7/dist-packages/pykitti. At the end of the odometry.py, add:

    def load_poses(self):
    "Load ground truth poses from file."
    print('Loading poses for sequence ' + self.sequence + '...')
    pose_file = os.path.join(self.pose_path, self.sequence + '.txt')
    # Read and parse the poses
    self.T_w_cam0 = []
    with open(pose_file, 'r') as f:
    for line in f.readlines():
    T = np.fromstring(line, dtype=float, sep=' ')
    T = T.reshape(3, 4)
    T = np.vstack((T, [0, 0, 0, 1]))
    self.T_w_cam0.append(T)
    print('done.')

  3. Install kitti2bag: pip install kitti2bag

  4. Modify kitti2bag located in /usr/local/bin/. Change from:

    kitti.load_calib()
    kitti.load_timestamps()
    To:

     kitti._load_calib()
     kitti._load_timestamps()
    
  5. Enter the dataset folder with image sequence and pose gt. e.g.: enter dataset/, create poses (00.txt, 01.txt, ...), and /sequences (00/image_0, 00/image_1, 00/calib.txt, 00/times.txt).

  6. Enter kitti2bag -s 00 odom_gray . to convert 00 bag to rosbag

@getupgetup
Copy link

I have encountered the same problem as yours.#16 And I solved it. The odometry datasets are just subsets of the raw data. We can't use kitti2bag to directly convert odometry data to rosbag. But we can find the mapping from odometry sequences to raw sequences in the readme.txt file included with the odometry development kit, and then use kitti2bag.

In order to allow the usage of the laser point clouds, gps data, the right
camera image and the grayscale images for the TRAINING data as well, we
provide the mapping of the training set to the raw data of the KITTI dataset.
The following table lists the name, start and end frame of each sequence that
has been used to extract the visual odometry / SLAM training set:

Nr. Sequence name Start End

00: 2011_10_03_drive_0027 000000 004540
01: 2011_10_03_drive_0042 000000 001100
02: 2011_10_03_drive_0034 000000 004660
03: 2011_09_26_drive_0067 000000 000800
04: 2011_09_30_drive_0016 000000 000270
05: 2011_09_30_drive_0018 000000 002760
06: 2011_09_30_drive_0020 000000 001100
07: 2011_09_30_drive_0027 000000 001100
08: 2011_09_30_drive_0028 001100 005170
09: 2011_09_30_drive_0033 000000 001590
10: 2011_09_30_drive_0034 000000 001200

But this means I need to download raw data again which contains large amount of images that I don't need.Is there anyway to get rosbag from the pure velodyne data sequence?

@HongweiSunny
Copy link

I have encountered the same problem as yours.#16 And I solved it. The odometry datasets are just subsets of the raw data. We can't use kitti2bag to directly convert odometry data to rosbag. But we can find the mapping from odometry sequences to raw sequences in the readme.txt file included with the odometry development kit, and then use kitti2bag.

In order to allow the usage of the laser point clouds, gps data, the right
camera image and the grayscale images for the TRAINING data as well, we
provide the mapping of the training set to the raw data of the KITTI dataset.
The following table lists the name, start and end frame of each sequence that
has been used to extract the visual odometry / SLAM training set:

Nr. Sequence name Start End

00: 2011_10_03_drive_0027 000000 004540
01: 2011_10_03_drive_0042 000000 001100
02: 2011_10_03_drive_0034 000000 004660
03: 2011_09_26_drive_0067 000000 000800
04: 2011_09_30_drive_0016 000000 000270
05: 2011_09_30_drive_0018 000000 002760
06: 2011_09_30_drive_0020 000000 001100
07: 2011_09_30_drive_0027 000000 001100
08: 2011_09_30_drive_0028 001100 005170
09: 2011_09_30_drive_0033 000000 001590
10: 2011_09_30_drive_0034 000000 001200

But this means I need to download raw data again which contains large amount of images that I don't need.Is there anyway to get rosbag from the pure velodyne data sequence?

@getupgetup Hi, is this probelm solved?

@getupgetup
Copy link

I have encountered the same problem as yours.#16 And I solved it. The odometry datasets are just subsets of the raw data. We can't use kitti2bag to directly convert odometry data to rosbag. But we can find the mapping from odometry sequences to raw sequences in the readme.txt file included with the odometry development kit, and then use kitti2bag.

In order to allow the usage of the laser point clouds, gps data, the right
camera image and the grayscale images for the TRAINING data as well, we
provide the mapping of the training set to the raw data of the KITTI dataset.
The following table lists the name, start and end frame of each sequence that
has been used to extract the visual odometry / SLAM training set:

Nr. Sequence name Start End

00: 2011_10_03_drive_0027 000000 004540
01: 2011_10_03_drive_0042 000000 001100
02: 2011_10_03_drive_0034 000000 004660
03: 2011_09_26_drive_0067 000000 000800
04: 2011_09_30_drive_0016 000000 000270
05: 2011_09_30_drive_0018 000000 002760
06: 2011_09_30_drive_0020 000000 001100
07: 2011_09_30_drive_0027 000000 001100
08: 2011_09_30_drive_0028 001100 005170
09: 2011_09_30_drive_0033 000000 001590
10: 2011_09_30_drive_0034 000000 001200

But this means I need to download raw data again which contains large amount of images that I don't need.Is there anyway to get rosbag from the pure velodyne data sequence?

@getupgetup Hi, is this probelm solved?

没有,不过一个可行的方案:参考楼上的方法修改kitti2bag代码,然后把raw data下载后转换为rosbag,如果不需要图像等其他数据,就在kitti2bag源码中注释掉不需要的部分.

@AbnerCSZ
Copy link

AbnerCSZ commented Dec 21, 2018

@getupgetup @HongweiSunny
If you only want to get rosbag from velodyne, you can just download the velodyne .bin data and use my tool: lidar2rosbag_KITTI .

@getupgetup
Copy link

@getupgetup @HongweiSunny
If you only want to get rosbag from velodyne, you can just download the velodyne .bin data and use my tool: lidar2rosbag_KITTI .

还没细看,谢谢~

@HongweiSunny
Copy link

@getupgetup @HongweiSunny
If you only want to get rosbag from velodyne, you can just download the velodyne .bin data and use my tool: lidar2rosbag_KITTI .

Thanks for your replying!
@getupgetup 可否加个微信之类的平时可以交流一下 wechatID:sunhongwei0930

@pangchenglin
Copy link

@getupgetup @HongweiSunny
If you only want to get rosbag from velodyne, you can just download the velodyne .bin data and use my tool: lidar2rosbag_KITTI .

Thanks for your replying!
@getupgetup 可否加个微信之类的平时可以交流一下 wechatID:sunhongwei0930

Are you fixed this problem? if you can fix it ,could you please tell me how to fix it???

This was referenced Mar 25, 2019
@nobinov
Copy link

nobinov commented Mar 27, 2019

modified version of https://github.com/tomas789/kitti2bag

1. Install pykitti pip install pykitti

2. Modify pykitti/odometry.py file located in /usr/local/lib/python2.7/dist-packages/pykitti. At the end of the odometry.py, add:
   **def load_poses(self):
   "Load ground truth poses from file."
   print('Loading poses for sequence ' + self.sequence + '...')
   pose_file = os.path.join(self.pose_path, self.sequence + '.txt')
   # Read and parse the poses
   self.T_w_cam0 = []
   with open(pose_file, 'r') as f:
   for line in f.readlines():
   T = np.fromstring(line, dtype=float, sep=' ')
   T = T.reshape(3, 4)
   T = np.vstack((T, [0, 0, 0, 1]))
   self.T_w_cam0.append(T)
   print('done.')**

3. Install kitti2bag: pip install kitti2bag

4. Modify kitti2bag located in /usr/local/bin/. Change from:
   kitti.load_calib()
   kitti.load_timestamps()
   To:
   ```
    kitti._load_calib()
    kitti._load_timestamps()
   ```

5. Enter the dataset folder with image sequence and pose gt. e.g.: enter dataset/, create poses (00.txt, 01.txt, ...), and /sequences (00/image_0, 00/image_1, 00/calib.txt, 00/times.txt).

6. Enter kitti2bag -s 00 odom_gray . to convert 00 bag to rosbag

I've tried this, and this error occured :

AttributeError: odometry instance has no attribute 'load_poses'

So, I changed kitti.load_poses() to kitti._load_poses() . After that, it give output like this :
AttributeError: odometry instance has no attribute 'T_w_cam0'

Anyone knows what 'T_w_cam0' is?

UPDATE:
From example of pykitti for odometry data in https://github.com/utiasSTARS/pykitti/blob/master/demos/demo_odometry.py , T_w_cam0is a list of ground truth poses. so kitti.T_w_cam0 can be replaced by kitti.poses . And now it's working.

n.b. : Apparently odom_color and odom_gray only didn't include velodyne data to the rosbag. Anyone knows how to include velodyne data to the bag?

@getupgetup
Copy link

modified version of https://github.com/tomas789/kitti2bag

1. Install pykitti pip install pykitti

2. Modify pykitti/odometry.py file located in /usr/local/lib/python2.7/dist-packages/pykitti. At the end of the odometry.py, add:
   **def load_poses(self):
   "Load ground truth poses from file."
   print('Loading poses for sequence ' + self.sequence + '...')
   pose_file = os.path.join(self.pose_path, self.sequence + '.txt')
   # Read and parse the poses
   self.T_w_cam0 = []
   with open(pose_file, 'r') as f:
   for line in f.readlines():
   T = np.fromstring(line, dtype=float, sep=' ')
   T = T.reshape(3, 4)
   T = np.vstack((T, [0, 0, 0, 1]))
   self.T_w_cam0.append(T)
   print('done.')**

3. Install kitti2bag: pip install kitti2bag

4. Modify kitti2bag located in /usr/local/bin/. Change from:
   kitti.load_calib()
   kitti.load_timestamps()
   To:
kitti._load_calib()
kitti._load_timestamps()

5. Enter the dataset folder with image sequence and pose gt. e.g.: enter dataset/, create poses (00.txt, 01.txt, ...), and /sequences (00/image_0, 00/image_1, 00/calib.txt, 00/times.txt).

6. Enter kitti2bag -s 00 odom_gray . to convert 00 bag to rosbag

I've tried this, and this error occured :

AttributeError: odometry instance has no attribute 'load_poses'

So, I changed kitti.load_poses() to kitti._load_poses() . After that, it give output like this :
AttributeError: odometry instance has no attribute 'T_w_cam0'

Anyone knows what 'T_w_cam0' is?

UPDATE:
From example of pykitti for odometry data in https://github.com/utiasSTARS/pykitti/blob/master/demos/demo_odometry.py , T_w_cam0is a list of ground truth poses. so kitti.T_w_cam0 can be replaced by kitti.poses . And now it's working.

n.b. : Apparently odom_color and odom_gray only didn't include velodyne data to the rosbag. Anyone knows how to include velodyne data to the bag?

I'm sorry that I've forgot how I solved the problem. I think the velodyne data with image/pose/etc data is included in the whole text file.Then different types of data are write to rosbag simultaneously by pykitti.
PS: Version incompatibility is really annoying. I think you can learn some basic python which is not hard. Then you can modify code in pykitti according to error messages. (That is the way I have done to solve it)

@chubukeji
Copy link

hello,the 03: 2011_09_26_drive_0067 can't be found in official website. Do you have this dataset? Or,do you know why it can't be found? my Email [email protected]

@chubukeji
Copy link

@AbnerCSZ hello,the 03: 2011_09_26_drive_0067 can't be found in official website. Do you have this dataset? Or,do you know why it can't be found? my Email [email protected]

@Petros626
Copy link

@chubukeji I can't find it, so I assume it wasn't published.

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