Add timestamps to save ply#607
Open
TomMontagnon wants to merge 2 commits intonorlab-ulaval:developfrom
Open
Conversation
added 2 commits
July 25, 2025 16:14
|
Collaborator
|
Hey @TomMontagnon! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Problem
When I run:
ros2 service call /save_trajectory norlab_icp_mapper_ros/srv/SaveTrajectory "{trajectory_file_name: {data: '$PWD/my_traj.ply'}}"It saves a trajectory, but without timestamps for each point.
Timestamps are passed to libpointmatcher, but the lib doesn't save them in case of
.ply.However, I need the timestamps, and I believe this is necessary in many cases.
(I was told lately that exporting to
.vtkmay save the timestamps, but I find working with.plyfiles to be more convenient anyway.)Short summary of the solution
Timestamps are passed as int64 to libpointmatcher, but the PLY standard does not support int64.
I therefore had to add two properties int32 to the PLY format: one for seconds and the other for nanoseconds (following the ROS2 convention).
Main changes
savePLY, if the data contains times :loadPLY:// 3- RESERVE DATAPOINTS MEMORY: If "timestamp_sec" (int32) and "timestamp_nsec" (int32) are present, only allocate one int64 field initialized to 0// 4- PARSE PLY DATA (vertex): If I detect "timestamp_sec" (int32) and "timestamp_nsec" (int32), combine them with the appropriate coefficients into the previously-initialized int64 field.IO.hChecklist
Other info
int64_t.cloudMsgIn.header.stamp, which based on the ROS documentation is: