Fix Duration casting issue leading to no undistortion

Signed-off-by: Marco Lampacrescia <Marco.Lampacrescia@de.bosch.com>
This commit is contained in:
Marco Lampacrescia 2021-09-16 16:02:35 +02:00
parent bfe1c494fd
commit 784bcbcdc9

View File

@ -427,8 +427,8 @@ void LaserProjection::transformLaserScanToPointCloud_(
TIME end_time = scan_in.header.stamp; TIME end_time = scan_in.header.stamp;
// TODO(anonymous): reconcile all the different time constructs // TODO(anonymous): reconcile all the different time constructs
if (!scan_in.ranges.empty()) { if (!scan_in.ranges.empty()) {
end_time = end_time + rclcpp::Duration( end_time = start_time + rclcpp::Duration::from_seconds(
static_cast<int>((scan_in.ranges.size() - 1) * scan_in.time_increment), 0); (scan_in.ranges.size() - 1) * scan_in.time_increment);
} }
std::chrono::nanoseconds start(start_time.nanoseconds()); std::chrono::nanoseconds start(start_time.nanoseconds());