From f33c3c6eba5a9a4412a54708a658eebb23a77db3 Mon Sep 17 00:00:00 2001 From: Ussama Naal Date: Thu, 10 Oct 2024 14:13:26 -0700 Subject: [PATCH] formatting code --- src/point_cloud_compose.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/point_cloud_compose.h b/src/point_cloud_compose.h index 00e6b070..71bd6de2 100644 --- a/src/point_cloud_compose.h +++ b/src/point_cloud_compose.h @@ -3,10 +3,9 @@ #include #include +#include "ouster_ros/common_point_types.h" #include "ouster_ros/os_point.h" #include "ouster_ros/sensor_point_types.h" -#include "ouster_ros/common_point_types.h" - #include "point_meta_helpers.h" #include "point_transform.h" @@ -117,10 +116,9 @@ using Cloud = pcl::PointCloud; // TODO[UN]: make this a functor template & PROFILE, typename PointT, typename PointS> -void scan_to_cloud_f(ouster_ros::Cloud& cloud, - PointS& staging_point, - const ouster::PointsF& points, - uint64_t scan_ts, const ouster::LidarScan& ls, +void scan_to_cloud_f(ouster_ros::Cloud& cloud, PointS& staging_point, + const ouster::PointsF& points, uint64_t scan_ts, + const ouster::LidarScan& ls, const std::vector& pixel_shift_by_row, bool organized = false, bool destagger = true, int rows_step = 1) { @@ -132,11 +130,12 @@ void scan_to_cloud_f(ouster_ros::Cloud& cloud, for (auto u = 0; u < ls.h; u += rows_step) { for (auto v = 0; v < ls.w; ++v) { // TODO[UN]: consider cols_step in future - const auto v_shift = destagger ? - (v + ls.w - pixel_shift_by_row[u]) % ls.w : v; + const auto v_shift = + destagger ? (v + ls.w - pixel_shift_by_row[u]) % ls.w : v; const auto src_idx = u * ls.w + v_shift; const auto xyz = points.row(src_idx); - const auto tgt_idx = organized ? (u / rows_step) * ls.w + v : cloud.size(); + const auto tgt_idx = + organized ? (u / rows_step) * ls.w + v : cloud.size(); if (xyz.isNaN().any()) { if (organized) { @@ -148,15 +147,15 @@ void scan_to_cloud_f(ouster_ros::Cloud& cloud, } continue; } else { - if (!organized) - cloud.points.emplace_back(); + if (!organized) cloud.points.emplace_back(); } // as opposed to the point cloud destaggering if it is disabled // then timestamps needs to be staggered. - auto ts = destagger ? - timestamp[v] : timestamp[(v + ls.w + pixel_shift_by_row[u]) % ls.w]; - ts = ts > scan_ts ? ts - scan_ts : 0UL; + auto ts_idx = + destagger ? v : (v + ls.w + pixel_shift_by_row[u]) % ls.w; + auto ts = + timestamp[ts_idx] > scan_ts ? timestamp[ts_idx] - scan_ts : 0UL; // if target point and staging point has matching type bind the // target directly and avoid performing transform_point at the end