Skip to content

Commit

Permalink
shorten function name
Browse files Browse the repository at this point in the history
  • Loading branch information
Samahu committed Oct 12, 2023
1 parent e33552f commit 2f2c3c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 2 additions & 6 deletions ouster-ros/src/point_cloud_compose.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,15 @@ template <class T>
using Cloud = pcl::PointCloud<T>;

template <std::size_t N, const ChanFieldTable<N>& PROFILE, typename PointT, typename PointS>
void scan_to_cloud_f_destaggered_tuple(
void scan_to_cloud_f_destaggered(
ouster_ros::Cloud<PointT>& cloud,
PointS& staging_point,
const ouster::PointsF& points,
uint64_t scan_ts, const ouster::LidarScan& ls,
const std::vector<int>& pixel_shift_by_row) {

auto profile_tuple = compose_tuple_table<0, N, PROFILE>();

map_scan_fields_to_tuple<0, N, PROFILE>(profile_tuple, ls);

auto timestamp = ls.timestamp();

for (auto u = 0; u < ls.h; u++) {
Expand All @@ -84,19 +82,17 @@ void scan_to_cloud_f_destaggered_tuple(
const auto src_idx = u * ls.w + v_shift;
const auto tgt_idx = u * ls.w + v;
const auto xyz = points.row(src_idx);

// if target point and staging point has matching type bind the target directly
// and avoid performing transform_point at the end
auto& pt = CondBinaryBind<std::is_same_v<PointT, PointS>>::run(
cloud.points[tgt_idx], staging_point);

// all native point types have x, y, z, t and ring values
pt.x = static_cast<float>(xyz(0));
pt.y = static_cast<float>(xyz(1));
pt.z = static_cast<float>(xyz(2));
pt.t = static_cast<uint32_t>(ts);
pt.ring = static_cast<uint16_t>(u);
tuple_copy_values<0, N, PROFILE>(pt, profile_tuple, src_idx);

// only perform point transform operation when PointT, and PointS don't match
CondBinaryOp<!std::is_same_v<PointT, PointS>>::run(cloud.points[tgt_idx], staging_point,
[](auto& tgt_pt, const auto& src_pt) {
Expand Down
13 changes: 7 additions & 6 deletions ouster-ros/src/point_cloud_processor_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PointCloudProcessorFactory {
int return_index) {
unused_variable(return_index);
static Point_LEGACY staging_pt; // TODO: temporary, will remove
scan_to_cloud_f_destaggered_tuple<Profile_LEGACY.size(), Profile_LEGACY>(
scan_to_cloud_f_destaggered<Profile_LEGACY.size(), Profile_LEGACY>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
};

Expand All @@ -33,12 +33,12 @@ class PointCloudProcessorFactory {
int return_index) {
static Point_RNG19_RFL8_SIG16_NIR16_DUAL staging_pt; // TODO: temporary, will remove
if (return_index == 0) {
scan_to_cloud_f_destaggered_tuple<
scan_to_cloud_f_destaggered<
Profile_RNG19_RFL8_SIG16_NIR16_DUAL.size(), Profile_RNG19_RFL8_SIG16_NIR16_DUAL>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
}
else {
scan_to_cloud_f_destaggered_tuple<
scan_to_cloud_f_destaggered<
Profile_RNG19_RFL8_SIG16_NIR16_DUAL_2ND_RETURN.size(), Profile_RNG19_RFL8_SIG16_NIR16_DUAL_2ND_RETURN>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
}
Expand All @@ -52,7 +52,7 @@ class PointCloudProcessorFactory {
int return_index) {
unused_variable(return_index);
static Point_RNG19_RFL8_SIG16_NIR16 staging_pt; // TODO: temporary, will remove
scan_to_cloud_f_destaggered_tuple<
scan_to_cloud_f_destaggered<
Profile_RNG19_RFL8_SIG16_NIR16.size(), Profile_RNG19_RFL8_SIG16_NIR16>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
};
Expand All @@ -65,12 +65,13 @@ class PointCloudProcessorFactory {
int return_index) {
unused_variable(return_index);
static Point_RNG15_RFL8_NIR8 staging_pt; // TODO: temporary, will remove
scan_to_cloud_f_destaggered_tuple<
scan_to_cloud_f_destaggered<
Profile_RNG15_RFL8_NIR8.size(), Profile_RNG15_RFL8_NIR8>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
};

default:
// TODO: propagate error message
// RCLCPP_WARN_STREAM(get_logger(),
// "point_type is set to auto but current udp_profile_lidar is unsupported "
// "! falling back to the driver default/legacy pcl point format");
Expand All @@ -81,7 +82,7 @@ class PointCloudProcessorFactory {
int return_index) {
unused_variable(return_index);
static Point_LEGACY staging_pt; // TODO: temporary, will remove
scan_to_cloud_f_destaggered_tuple<Profile_LEGACY.size(), Profile_LEGACY>(
scan_to_cloud_f_destaggered<Profile_LEGACY.size(), Profile_LEGACY>(
cloud, staging_pt, points, scan_ts, ls, pixel_shift_by_row);
};
}
Expand Down

0 comments on commit 2f2c3c4

Please sign in to comment.