UMich-BipedLab / extrinsic_lidar_camera_calibration

This is a package for extrinsic calibration between a 3D LiDAR and a camera, described in paper: Improvements to Target-Based 3D LiDAR to Camera Calibration. This package is used for Cassie Blue's 3D LiDAR semantic mapping and automation.

Home Page:https://ieeexplore.ieee.org/document/9145571

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pc_file data structure

hcyoo93 opened this issue · comments

Hello,
Firstly I appreciate your great work!

I wonder how to prepare pc_files for lidar tag.

As I understand, before calibrating, I need to segment square target from lidar pointcloud
so I did it with matlab pointcloud library and save it as "mat file".

The pc_file I made with matlab has only X,Y,Z, Intesity values shaped as 1x1 pointcloud struct.

But this code needs point cloud data shaped as "[scan, point, [X, Y, Z, I, R]]".

How did you make Lidar tag pc_file.mat from raw point cloud of velodyne?

Thank you in advance

Hi,

Thanks for you interests! I will try my best to help you.

  1. [LiDAR Targets]: we use fiducial tags that can be detected both from LiDARs and cameras. Physically, they are the same tags. However, if the tag is detected from LiDARs, we call it LiDARTag and on the other hand, if is is detected from cameras, it is called AprilTag. Please check out this link to download the LiDAR target images. I will update the README file too. Thank for bring it up! If you use LiDARTag as you LiDAR targets, please cite
@article{huang2019lidartag,
  title={LiDARTag: A Real-Time Fiducial Tag using Point Clouds},
  author={Huang, Jiunn-Kai and Ghaffari, Maani and Hartley, Ross and Gan, Lu and Eustice, Ryan M and Grizzle, Jessy W},
  journal={arXiv preprint arXiv:1908.10349},
  year={2019}
}
  1. [pc_file Format] For the format of input point clouds, you will not only have a scan of point clouds. Let's say your LiDAR runs at 10 Hz. For 1 second of data collecting, you would have 10 scans of point clouds. That's what the 'scan' means. In each scan, each point will have [X, Y, Z, I, R], where they stand for X, Y, Z axis, Intensity, Ring number, respectively.

  2. [Data Collection] I recorded bagfiles of point cloud data of Velodyne using the Robot Operating System (ROS). I then use Python to convert the bagfiles into MAT-files. Please let me know if you need any help on getting point clouds data. I would be happy to help!

  3. [Data Storing] Please put all information inside the "getBagData.m" file. Please make sure lidar_target(i) matches up camera_target(i). Take 3Tags-OldLiDAR.bag dataset for an example,

- _name of the bagfile_
    BagData(1).bagfile = "3Tags-OldLiDAR.bag";
- _number of targets in the scene_
    BagData(1).num_tag = 3;
- _point cloud data for target #1_
    BagData(1).lidar_target(1).pc_file = 'velodyne_points-3Tags-OldLiDAR-largest--2019-09-03-08-26.mat'; 
- _target size for target #1_
    BagData(1).lidar_target(1).tag_size = 0.8051;
- _point cloud data for target #2_
    BagData(1).lidar_target(2).pc_file = 'velodyne_points-3Tags-OldLiDAR-medium--2019-09-02-20-53.mat'; 
- _target size for target #2_
    BagData(1).lidar_target(2).tag_size = 0.225;
- _point cloud data for target #3_
    BagData(1).lidar_target(3).pc_file = 'velodyne_points-3Tags-OldLiDAR-small--2019-09-02-20-47.mat';
- _target size for target #3_
    BagData(1).lidar_target(3).tag_size = 0.158;
- _full scan of point cloud_
    BagData(1).lidar_full_scan = "velodyne_points-3Tags-full-pc--2019-09-01-02-25.mat";
- _camera target corner for target #1_
    BagData(1).camera_target(1).corners = [526, 447, 569, 490;
                                           261, 297, 341, 379;
                                           1, 1, 1, 1]; 
- _camera target corner for target #2_                        
    BagData(1).camera_target(2).corners = [269, 237, 284, 251;
                                           296, 313, 326, 343;
                                           1, 1, 1, 1];
- _camera target corner for target #2_
    BagData(1).camera_target(3).corners = [394, 349, 413, 367;
                                           249, 267, 294, 312;
                                           1, 1, 1, 1];

Please check this again to see if you understand [calibrator] section.
Please also let me know if you any other questions! I would be happy to help you.

Big thanks to your kind answer!!

Actually I didn't know that ros-velodyne_pointcloud-driver publishes "XYZIR" data.

Your answer above is very straight forward and easy to understand. THX!

However, Regarding 3.[Data Collection] , if you share the python code, it would be super helpful for everyone to calibrate more easily.

Sure. I will add up more comments to the codes and the push again. Please look forward to it! Please let me know when you need it. Is it urgent? If not, I will upload it next Monday (Dec 9th, 2019). However, if it is kind of urgent, I will upload it on Dec 7th, 2019.

Thank you for sharing! and yes, it would be better if you upload it on 7th
I look forward to it !

Sure. I will upload it in the next 10 hours. I will close this issue on the next Monday. You can always re-open it if you encounter related problems. Please open other issues if you have any other questions. I would be happy to help you!

I have uploaded bag2mat.py. Please let me know if you have other questions.

It worked! Thank you for helping me out!

P.S. I have a couple of comments

  1. In LeftRightEdges_v02.m
[n1,~,~]=size(pnts);
PayLoad=[];
n1 = IndScans(end);
for i1=1:n1
    points = pnts(i1,:,:);
    payload = (reshape(points, size(points, 2),[]))';
    RingNotZero=find(payload(5,:)>0);
    payload=payload(:,RingNotZero);
    [~,n3]=size(payload);
    payload=[payload;i1*ones(1,n3);ExpNmbr*ones(1,n3)];
    %if min(payload(1,:)) > 0
    if min(abs(payload(1,:))) > 0
        PayLoad=[PayLoad,payload];
    end
   
    % payload(1,:) : x
    % payload(2,:) : y
    % payload(3,:) : z
    % payload(4,:) : I
    % payload(5,:) : R
    % payload(6,:) : scan
    % payload(7,:) : ExpNmbr
end

Line " if min(payload(1,:)) > 0 " makes error when
x coordinate of target on point cloud has negative value.

  1. Also, I found that this code can be run on windows environment with minor modification on datetime expression in"justCalibrate.m"
c = datestr(datetime); 
--->
c = datestr(datetime,'dd-mm-yyyy-SS-MM-HH'); 

Hi,
Sorry for the late reply. I was too busy these two days.
1 and 2. I will modify to you line "min(abs(payload(1,:))) > 0" and c = datestr(datetime,'dd-mm-yyyy-SS-MM-HH'); Thanks for reminding me!

Do you use this package under Windows?

Thank you!

Yes, I do. I tried under windows environment matlab.

Have a good one

I am going to close this issue. You can always re-open it if you encounter related problems. Please open other issues if you have any other questions. I would be happy to help you!

I have uploaded bag2mat.py. Please let me know if you have other questions.

Hi,
where is the file bag2mat.py located?

Hi,
It is on the older branch.

I will push it to this branch in a bit. Please let me know if you have other questions!