Repository navigation
refactor(autoware_pointcloud_preprocessor): make the concatenation core ROS-runtime-free - #12873
Conversation
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
953a3ed to
4e65b3e
Compare
35736d8 to
3821246
Compare
… of passing strings Introduce MatchingStrategyType, an enum whose enumerator values are pinned to the ConcatenatedPointCloudInfo STRATEGY_* constants (the wire format is the source of truth), and parse the strategy name exactly once per string boundary -- for the node, its "matching_strategy.type" parameter. - ConcatenationInfoManager takes MatchingStrategyType, so recording the strategy into the info message becomes a static_cast: the string-to-constant lookup table (matching_strategy_name_map) is gone. - The unknown-strategy error now comes from parse_matching_strategy(), the only place that knows the names. No behavioral change. Signed-off-by: vividf <yihsiang.fang@tier4.jp>
914dda8 to
b9ca7d0
Compare
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
sasakisasaki
left a comment
There was a problem hiding this comment.
Quick Comment
I agree with merging this PR as the reasons below 👍
Reasons for Approval
- Characterization test passed: this indicates no regression for both core logic and ROS node logic
- I could tested ROS node free concatenation by using this example
I believe this PR certainly separates core logic from ROS node 🎉
drwnz
left a comment
There was a problem hiding this comment.
Nice work. Some changes suggested. I did not test CUDA or Agnocast as both aren't working in my environment right now.
|
@drwnz Thank you for your review! That are make sense. Let me apply the fix based on your comments, respectively 👍 |
Commit:
- autowarefoundation@95162b3
PR Review comment:
- autowarefoundation#12873 (comment)
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
- Apply the following review comment:
- autowarefoundation#12873 (comment)
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
- Apply the following review comment:
- autowarefoundation#12873 (comment)
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
- Apply the following review comment:
- autowarefoundation#12873 (comment)
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
Signed-off-by: Junya Sasaki <junya.sasaki@tier4.jp>
|
Now let me do double check if all the review comment is discussed tomorrow again. |
…t the cloud stamp The sensor-to-output transform was looked up at this->now() rather than at the time the point cloud was captured. On main the CPU combine handler used the cloud stamp, while the CUDA handler used node_.now(); unifying both paths in the node callback carried over the latter. With static extrinsics ManagedTransformBuffer ignores the time, so nothing changes there. With a dynamic link in the chain, now() asks for a transform in the future and blocks the callback until one arrives or the 1 s timeout expires. Both the CPU and the CUDA paths now use the cloud stamp. Signed-off-by: vividf <yihsiang.fang@tier4.jp>
…ged when transforming transform_pointcloud() replaced pcl_ros::transformPointCloud() to keep the concatenation core free of the ROS runtime. Unlike pcl_ros it multiplied every point by the matrix, so a point with a single non-finite coordinate, e.g. (NaN, 1, 2), came out as (NaN, NaN, NaN), even under an identity transform. Skip such points so they are copied through unchanged, as pcl_ros does, and document the FLOAT32 x/y/z precondition. Finite points are unaffected. The CUDA kernel, which already transformed every point on main, is unchanged. Add a unit test that sends NaN and Inf points through the sensor-to-output transform, motion compensation and the transform back to the sensor frame. Signed-off-by: vividf <yihsiang.fang@tier4.jp>
|
@drwnz @mojomex @sasakisasaki |
drwnz
left a comment
There was a problem hiding this comment.
Thanks for the changes, LGTM!
Description
Make the point cloud concatenation core (
CombineCloudHandler,CombineCloudHandlerBase,the concatenation diagnostics) independent of the ROS runtime, so it can be driven from a
non-node context (the offline/Python pipeline in #13113 / #12874) and unit-tested without
spinning a node. The node keeps exactly the same topics, parameters and outputs.
This PR is the merged result of a 4-part stack that was reviewed step by step on the fork
(links under Related links); each step is still a separate commit here.
MatchingStrategyTypeenum pinned to theConcatenatedPointCloudInfoSTRATEGY_*constants; the string is parsed once, at theparameter boundary (
parse_matching_strategy());matching_strategy_name_mapis gone.CombineCloudHandler<sensor_msgs::msg::PointCloud2>/
CombineCloudHandler<cuda_blackboard::CudaPointCloud2>instead of the*Traitstag types.builtin_interfaces::msg::Timewith a small
time_utils.hpp(is_earlier,add,subtract,to_seconds);pcl_ros::transformPointCloud/pcl::concatenatePointCloudare replaced by an Eigentransform loop and a byte append on the shared XYZIRC layout.
ManagedTransformBuffer; the node looks up sensor→output extrinsics and callsset_transform(). A source whose frame has no transform is dropped and reported(
dropped_sources_missing_transform,STATUS_INVALID) instead of being placed with anidentity transform. Motion-compensation warnings became a
MotionCompensationStatusthenode logs.
build_diagnostic_status()inconcatenation_diagnostics.{hpp,cpp}produces theDiagnosticStatusfrom a plain summarystruct; the node only feeds it and publishes. A source without a transform now counts as
not concatenated in the diagnostics, consistent with
ConcatenatedPointCloudInfo.A new
concatenate_corelibrary target contains only the ROS-runtime-free sources and linksmessage targets only, to keep it that way.
Related links
refactor(autoware_pointcloud_preprocessor): key the combine handler on the point cloud message type vividf/autoware.universe#4, feat: add simple planning simulator package #5, feat:add common math pkg #6, feat: add autoware_utils package #7
feat/concat_core), feat(autoware_pointcloud_preprocessor): add Python bindings for the concatenation core #12874 (Python bindings)How was this PR tested?
colcon build/test --packages-select autoware_pointcloud_preprocessor autoware_cuda_pointcloud_preprocessor— 519 tests, 0 failures (incl. lint).
test_concatenation_info: typed strategy.test_concatenation_diagnostics(new, 11 cases): key order, level/message rules, missingtopic, missing transform, late drop, advanced window.
test_cuda_combine_cloud_handler(new, 2 cases, runs on the GPU and self-skips without one):concatenation on device, drop of a source without an extrinsic.
test_concatenate_node_unit: transforms injected viaset_transform()instead of a TF broadcaster.main(same base commit, x86 + RTX, 3 lidars, motion compensation on,~120 frames): output clouds equivalent (max |Δxyz| 23 µm, float32 rounding; identity-rotation
sensor byte-identical);
ConcatenatedPointCloudInfoidentical;/diagnosticslevel identical onevery frame; processing time −8 % median.
Notes for reviewers
matching_strategy.typenow throwsstd::invalid_argumentfromparse_matching_strategy()instead of the node's
std::runtime_error. Both abort startup.transform_pointcloud()appliesMatrix4f * Vector4fwhere pcl usedlinear()*v + translation();results differ only by float32 rounding (≤ 1–8 ULP, zero-mean).
Interface changes
None. No topic, parameter or message changes. Internal C++ API of the handler changed
(constructor no longer takes a
rclcpp::Node;set_transform()added).Effects on system behavior
and
source_info.statusstayedOK. Now its points are dropped,source_info.status = INVALID,concatenation_success = false, and/diagnosticsreportsERRORwithConcatenated: <topic> = Falseplus a new keyFrames without a transform to the output frame.earlier" → "... and because its timestamp is earlier". Exact-match monitoring rules need
updating.
sec + nanosec*1e-9(single rounding) instead ofrclcpp::Time::seconds(); values may differ in the last digits.matching_strategy.type: different exception type/message, still aborts startup.