Skip to content

Commit

Permalink
fix: timestamps in PCL conversion
Browse files Browse the repository at this point in the history
Signed-off-by: David Wong <[email protected]>
  • Loading branch information
drwnz committed Dec 22, 2023
1 parent 0220a23 commit 9348ff4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ drivers::NebulaPointCloudPtr InnovizScanDecoder::getPointcloud()
nebula_scan_pc_->points.clear();
nebula_scan_pc_->points.reserve(innoviz_scan_pc_.detections.size());
//Take UTC timestamp from synced LiDAR and convert to micros
nebula_scan_pc_->header.stamp = (innoviz_scan_pc_.lidar_sensor_detections_header.timestamp.seconds * 1e6 +
innoviz_scan_pc_.lidar_sensor_detections_header.timestamp.nano_seconds) * 0.001;
nebula_scan_pc_->header.stamp = innoviz_scan_pc_.lidar_sensor_detections_header.timestamp.seconds * 1e6 +
innoviz_scan_pc_.lidar_sensor_detections_header.timestamp.nano_seconds * 1e-3;

for(uint32_t pixelID = 0; pixelID < innoviz_scan_pc_.detections.size(); pixelID++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ drivers::NebulaPointCloudPtr InnovizDriver::ConvertScanToPointcloud(const std::s
//Check valid timestamp. If the LiDAR is not synced this will be 0 and need to take host timestamp from innoviz_scan
if(nebulaPCL->header.stamp == 0)
{
nebulaPCL->header.stamp = (innoviz_scan->header.stamp.sec * 1e6 +
innoviz_scan->header.stamp.nanosec) * 0.001;
nebulaPCL->header.stamp = innoviz_scan->header.stamp.sec * 1e6 + innoviz_scan->header.stamp.nanosec * 1e-3;
}
}
else
Expand Down

0 comments on commit 9348ff4

Please sign in to comment.