|
| 1 | +// Copyright 2025 TIER IV, Inc. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#pragma once |
| 16 | + |
| 17 | +#include "autoware/cuda_pointcloud_preprocessor/cuda_concatenate_data/cuda_traits.hpp" |
| 18 | +#include "autoware/pointcloud_preprocessor/concatenate_data/combine_cloud_handler.hpp" |
| 19 | + |
| 20 | +namespace autoware::pointcloud_preprocessor |
| 21 | +{ |
| 22 | + |
| 23 | +template <> |
| 24 | +class CombineCloudHandler<CudaPointCloud2Traits> : public CombineCloudHandlerBase |
| 25 | +{ |
| 26 | +protected: |
| 27 | + struct CudaConcatStruct |
| 28 | + { |
| 29 | + cudaStream_t stream; |
| 30 | + std::unique_ptr<CudaPointCloud2Traits::PointCloudMessage> cloud_ptr; |
| 31 | + std::size_t max_pointcloud_size{0}; |
| 32 | + }; |
| 33 | + |
| 34 | + std::unordered_map<std::string, CudaConcatStruct> cuda_concat_struct_map_; |
| 35 | + std::unique_ptr<CudaPointCloud2Traits::PointCloudMessage> concatenated_cloud_ptr_; |
| 36 | + std::size_t max_concat_pointcloud_size_{0}; |
| 37 | + std::mutex mutex_; |
| 38 | + |
| 39 | +public: |
| 40 | + CombineCloudHandler( |
| 41 | + rclcpp::Node & node, const std::vector<std::string> & input_topics, std::string output_frame, |
| 42 | + bool is_motion_compensated, bool publish_synchronized_pointcloud, |
| 43 | + bool keep_input_frame_in_synchronized_pointcloud, bool has_static_tf_only); |
| 44 | + |
| 45 | + ConcatenatedCloudResult<CudaPointCloud2Traits> combine_pointclouds( |
| 46 | + std::unordered_map< |
| 47 | + std::string, typename CudaPointCloud2Traits::PointCloudMessage::ConstSharedPtr> & |
| 48 | + topic_to_cloud_map); |
| 49 | + |
| 50 | + void allocate_pointclouds() override; |
| 51 | +}; |
| 52 | + |
| 53 | +} // namespace autoware::pointcloud_preprocessor |
0 commit comments