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

Running ct_icp using another dataset #21

Closed
bigbigpark opened this issue Apr 20, 2022 · 8 comments
Closed

Running ct_icp using another dataset #21

bigbigpark opened this issue Apr 20, 2022 · 8 comments

Comments

@bigbigpark
Copy link

bigbigpark commented Apr 20, 2022

Hi, I have recenlty built and run ct_icp successfully!

But I have difficulty running another dataset.

I wonder how ct_icp exactly knows about timestamp between frames.

While studying your paper and code, I found something new.

Like this default_config.yaml (permalink highlighted), I found that ct_icp code uses KITTI dataset in the form of frame_####.ply format.

But It cannot work on my own data(*.ply)


When I visualize it on CloudCompare,
here the **red** one is **frame_0001.ply**, the **black** one is **frame_0005.ply**.
We can think the ego vehicle moves forward.

Selection_012


Here, I found something new.

In CloudCompare I got to know the ply file of KITTI has x, y, z and timestamp fields.

Selection_014

On the other hand, I have my own data like

Selection_013

I think the difference is whether it has a field of timestamp(PLY_FLOAT32)


Here is my real question!

Could you explain the ply format and how ct_icp uses that format briefly if you can.

Plus, I want to convert my .bag/.pcd file to .ply which has only x, y, z and timestamp file format.

I couldn't find any solution about that.

Best regards.

@pdell-kitware
Copy link
Collaborator

Hi,

Thanks for your question !
Can you please specify what branch of CT-ICP do you use ? (branch master or dev ?)

So to answer your first question,
I think the difference between PLY_FLOAT (=64 bit floats / double in c++) and PLY_FLOAT32 (32bit floats / float in c++) are two different floating types.

In master branch, we made a custom PLYFile parser / reader
(which you can find at https://github.com/jedeschaud/ct_icp/blob/master/src/ct_icp/Utilities/PlyFile.cpp)

While in dev branch we depend on SlamCore which is shipped with tinyply

If you are on master, I will not make any change (because most of the code will soon be deprecated), so you should aim to convert to the same PLY file format (with only PLY_FLOAT32), you can use tinyply in c++ to do so or https://github.com/dranjan/python-plyfile in python (for e.g.).

By convention the timestamps for each frame are in seconds (Be careful during downcasting to float from double not to loose precision if the timestamps are in nanoseconds for e.g.)

If you are on dev normally SlamCore Should provide the necessary utilities to do what you want.
In which case I could make some effort to make the library more user-friendly,

Best regards

@bigbigpark
Copy link
Author

Thanks for replying

I use the branch of master so I found PlyFile.cpp


Could you tell me how I use your PLYFile parser / reader and convert them to the right format(*.ply: x, y, z and timestamp) for running ct_icp like KITTI ?
I have a `bag` file including `sensor_msgs/PointCloud2`

@pdell-kitware
Copy link
Collaborator

You can find an example for the code to parse the PLY file in the
dataset.cpp source file
(See function read_ply_pointcloud)

@bigbigpark
Copy link
Author

Thanks you so much!
I could apply my dataset to ct_icp!

Interestingly, I have 300 data (frame_0000.ply to frame_0300.ply) from Ouster LiDAR.
All data have x, y, z and timestamp properties. However the timestamp in the all data is set to 0.0.

I thought ct_icp cannot work but it worked well! How do...? I think ct_icp use the begin and end timestamp of the data.

@pdell-kitware
Copy link
Collaborator

That's great !

If you can don't hesitate to share screenshots to show us the results !

So if all frames are equal to zero, essentially the interpolated frame during optimization is always the same,
so that is probably why it still works, note however that the frames are probably not corrected

@bigbigpark
Copy link
Author

bigbigpark commented Apr 26, 2022

Now it's not clear on me but I'll try to understand the structure.

I know CT_ICP estimates the beginning and end pose at one lidar scan.

Each pose has Rotation and Translation, but in the code below it writes a number of R and T.

Could you explain why the R is 3x3 matrix and T is 3x1 vector?

I want to plot the trajectory using the translation.

io.cpp

@pdell-kitware
Copy link
Collaborator

pdell-kitware commented Apr 27, 2022

The code below extracts the rotation / translation from One Transformation Matrix (a 4x4 matrix with rotation and translation in the first 3 lines).

To save the trajectory in CT-ICP (in the Kitti format) we take the middle pose of the scan (by interpolating at 0.5 between begin and end pose) and computing its transformation matrix

Eigen::Matrix4d pose = Eigen::Matrix4d::Identity();
Eigen::Matrix3d R = pose.block<3, 3>(0, 0);
Eigen::Vector3d t = pose.block<3, 1>(0, 3);

@bigbigpark
Copy link
Author

Oh! I get it !

Thank you so much :)

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

2 participants