Move stamping closer to data reading. #104
Merged
+8
−7
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.
At the moment the timestamp is added just before the data is published ( https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/104/files#diff-db3fd72df08186f3c4adfeb4c26aa1eb5526a4781c16d0603ff879d0fd2f2b86L81 ).
Synchronisation of the ROS system with the scanner, as requested in #23, is beyond the scope of this PR.
But the attempt here is to reduce the number of approximations by stamping the data when it is parsed. This time is closer to the ideal time at which the last scan point was sampled than the publication time. Also, since the stamp of the LaserScan message (http://docs.ros.org/en/api/sensor_msgs/html/msg/LaserScan.html) is the time of the first beam captured, it makes sense to remove the scan_time from the timestamp. If we do not do this, we will have more and more delays the longer the scan time is.