Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoware_pointcloud_preprocessor): redesign concatenate and time sync node #8300

Open
wants to merge 116 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 89 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
306d8a2
chore: rebase main
vividf Sep 19, 2024
946365a
chore: solve conflicts
vividf Sep 19, 2024
d4978f7
chore: fix cpp check
vividf Aug 1, 2024
63a870b
chore: add diagnostics readme
vividf Aug 1, 2024
c8cca1f
chore: update figure
vividf Aug 1, 2024
89650a2
chore: upload jitter.png and add old design link
vividf Aug 2, 2024
d423a22
chore: add the link to the tool for analyzing timestamp
vividf Aug 2, 2024
3d21b6c
fix: fix bug that timer didn't cancel
vividf Sep 4, 2024
542ce97
chore: fix logic for logging
vividf Sep 5, 2024
77a3a79
Update sensing/autoware_pointcloud_preprocessor/docs/concatenate-data.md
vividf Sep 18, 2024
52030a7
Update sensing/autoware_pointcloud_preprocessor/src/concatenate_data/…
vividf Sep 18, 2024
3ddf249
Update sensing/autoware_pointcloud_preprocessor/schema/cocatenate_and…
vividf Sep 18, 2024
d679736
Update sensing/autoware_pointcloud_preprocessor/schema/cocatenate_and…
vividf Sep 18, 2024
1f9d24c
Update sensing/autoware_pointcloud_preprocessor/src/concatenate_data/…
vividf Sep 18, 2024
09452e7
Update sensing/autoware_pointcloud_preprocessor/src/concatenate_data/…
vividf Sep 18, 2024
d900d3f
chore: remove distortion corrector related changes
vividf Sep 19, 2024
bcbe94a
feat: add managed tf buffer
vividf Sep 19, 2024
22b654a
chore: fix filename
vividf Sep 20, 2024
076bfaa
chore: add explanataion for maximum queue size
vividf Sep 20, 2024
0e59f48
chore: add explanation for timeout_sec
vividf Sep 20, 2024
8e79976
chore: fix schema's explanation
vividf Sep 20, 2024
66b4092
chore: fix description for twist and odom
vividf Sep 20, 2024
10d83ee
chore: remove license that are not used
vividf Sep 20, 2024
fbb5fe9
chore: change guard to prama once
vividf Sep 20, 2024
3f0732e
chore: default value change to string
vividf Sep 20, 2024
c19250b
Update sensing/autoware_pointcloud_preprocessor/test/test_concatenate…
vividf Sep 20, 2024
089e108
Merge branch 'feature/redesign_concatenate_and_time_sync_node' of git…
vividf Sep 20, 2024
5ec228c
Update sensing/autoware_pointcloud_preprocessor/test/test_concatenate…
vividf Sep 20, 2024
f4c869e
Update sensing/autoware_pointcloud_preprocessor/test/test_concatenate…
vividf Sep 20, 2024
4cca6c1
Update sensing/autoware_pointcloud_preprocessor/test/test_concatenate…
vividf Sep 20, 2024
53279b5
style(pre-commit): autofix
pre-commit-ci[bot] Sep 20, 2024
853b8fe
chore: clang-tidy style for static constexpr
vividf Sep 20, 2024
d32dfbc
chore: remove unused vector header
vividf Sep 20, 2024
07cb753
chore: fix naming concatenated_cloud_publisher
vividf Sep 20, 2024
490b15c
chore: fix namimg diagnostic_updater_
vividf Sep 20, 2024
8f16896
chore: specify parameter in comment
vividf Sep 20, 2024
1d89cdd
chore: change RCLCPP_WARN to RCLCPP_WARN_STREAM_THROTTLE
vividf Sep 20, 2024
651c666
chore: add comment for cancelling timer
vividf Sep 20, 2024
0aae2ec
chore: merge remote branch
vividf Sep 20, 2024
370483c
chore: Simplify loop structure for topic-to-cloud mapping
vividf Sep 23, 2024
4c0b585
chore: fix spell errors
vividf Sep 23, 2024
2decb65
chore: fix more spell error
vividf Sep 23, 2024
eeb310d
chore: rename mutex and lock
vividf Sep 25, 2024
9a85a52
chore: const reference for string parameter
vividf Sep 25, 2024
1114898
chore: add explaination for RclcppTimeHash_
vividf Sep 25, 2024
84b547c
chore: change the concatenate node to parent node
vividf Sep 25, 2024
e49d521
chore: clean processOdometry and processTwist
vividf Sep 25, 2024
5ae681c
chore: change twist shared pointer queue to twist queue
vividf Sep 26, 2024
3a8ff07
chore: refactor compensate pointcloud to function
vividf Sep 26, 2024
49b54d4
chore: reallocate memory for concatenate_cloud_ptr
vividf Sep 26, 2024
de94fa6
chore: remove new to make shared
vividf Sep 26, 2024
7979153
chore: dis to distance
vividf Sep 26, 2024
b344427
chore: refacotr poitncloud_sub
vividf Sep 26, 2024
b0c8a7c
chore: return early return but throw runtime error
vividf Sep 26, 2024
fa0c4dc
chore: replace #define DEFAULT_SYNC_TOPIC_POSTFIX with member variable
vividf Sep 26, 2024
66a62d1
chore: fix spell error
vividf Sep 26, 2024
67bfa26
chore: remove redundant function call
vividf Sep 26, 2024
bafaea1
chore: replace conplex tuple to structure
vividf Sep 26, 2024
c1a4001
chore: use reference instead of a pointer to conveys node
vividf Sep 26, 2024
7ebd332
chore: fix camel to snake case
vividf Sep 26, 2024
52ed5ed
chore: fix logic of publish synchronized pointcloud
vividf Sep 27, 2024
b863d49
chore: fix cpp check
vividf Sep 27, 2024
92d69a4
chore: remove logging and throw error directly
vividf Sep 30, 2024
edb0610
chore: fix clangd warnings
vividf Sep 30, 2024
b6700a9
chore: fix json schema
vividf Sep 30, 2024
130bcb8
chore: fix clangd warning
vividf Sep 30, 2024
31500f8
chore: remove unused variable
vividf Sep 30, 2024
000c890
chore: fix launcher
vividf Oct 1, 2024
55e0d24
chore: fix clangd warning
vividf Oct 1, 2024
0611bb9
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Oct 4, 2024
9199a3d
chore: ensure thread safety
vividf Oct 4, 2024
d6c7a48
style(pre-commit): autofix
pre-commit-ci[bot] Oct 4, 2024
4815917
chore: clean code
vividf Oct 7, 2024
40fe11e
chore: add parameters for handling rosbag replay in loops
vividf Oct 7, 2024
3433bf0
chore: fix diagonistic
vividf Oct 7, 2024
09b8ce3
chore: reduce copy operation
vividf Oct 21, 2024
782228f
chore: reserve space for concatenated pointcloud
vividf Oct 21, 2024
3606114
chore: fix clangd error
vividf Oct 21, 2024
6ed7537
chore: fix pipeline latency
vividf Oct 21, 2024
0248a24
chore: add debug mode
vividf Oct 21, 2024
76d3b4c
chore: refactor convert_to_xyzirc_cloud function
vividf Oct 22, 2024
e709d37
chore: fix json schema
vividf Oct 22, 2024
fcdb989
chore: fix logging output
vividf Oct 22, 2024
460b467
chore: fix the output order of the debug mode
vividf Oct 22, 2024
798cbd6
chore: fix pipeline latency output
vividf Oct 23, 2024
a2e8b77
chore: clean code
vividf Oct 24, 2024
2562d6e
chore: set some parameters to false in testing
vividf Oct 24, 2024
a970f79
chore: fix default value for schema
vividf Oct 24, 2024
4d95a01
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Oct 25, 2024
4e39bbc
chore: fix diagnostic msgs
vividf Oct 28, 2024
fe2e5c2
Merge branch 'feature/redesign_concatenate_and_time_sync_node' of git…
vividf Oct 28, 2024
50036b5
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Oct 29, 2024
afa000d
chore: fix parameter for sample ros bag
vividf Oct 29, 2024
19170a1
chore: autoware point type namespace
vividf Nov 7, 2024
e4dea9f
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Nov 7, 2024
d0d5b51
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Nov 11, 2024
3123849
chore: update readme
vividf Nov 13, 2024
ce2119b
Merge branch 'feature/redesign_concatenate_and_time_sync_node' of git…
vividf Nov 13, 2024
e115071
chore: fix empty pointcloud
vividf Nov 22, 2024
1b2f2b2
Merge branch 'autowarefoundation:main' into feature/redesign_concaten…
vividf Nov 22, 2024
5bcb02d
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Dec 2, 2024
7224ad5
Merge branch 'feature/redesign_concatenate_and_time_sync_node' of git…
vividf Dec 2, 2024
16d1bce
chore: remove duplicated logic
vividf Dec 2, 2024
8d7d1e8
chore: fix logic for handling empty pointcloud
vividf Dec 2, 2024
ba2a3af
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Dec 2, 2024
7b20619
chore: clean code
vividf Dec 2, 2024
972758f
chore: remove rosbag_replay parameter
vividf Dec 2, 2024
e6c6f6a
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Dec 4, 2024
b950f4a
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Dec 6, 2024
dde8466
chore: remove nodelet cpp
vividf Dec 6, 2024
1cc54ac
chore: clang tidy warning
vividf Dec 6, 2024
46fd14d
Merge branch 'main' into feature/redesign_concatenate_and_time_sync_node
vividf Dec 6, 2024
aa89a1f
feat: add naive approach for unsynchronized pointclouds
vividf Dec 9, 2024
76ac99f
chore: add more explanations in docs for naive approach
vividf Dec 9, 2024
edea4e7
Merge branch 'feature/redesign_concatenate_and_time_sync_node' of git…
vividf Dec 9, 2024
fb9bebc
feat: refactor naive method and fix the multithreading issue
vividf Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions sensing/autoware_pointcloud_preprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ ament_target_dependencies(faster_voxel_grid_downsample_filter
)

ament_auto_add_library(pointcloud_preprocessor_filter SHARED
src/concatenate_data/concatenate_and_time_sync_nodelet.cpp
src/concatenate_data/concatenate_and_time_sync_node.cpp
src/concatenate_data/combine_cloud_handler.cpp
src/concatenate_data/cloud_collector.cpp
src/concatenate_data/concatenate_pointclouds.cpp
src/crop_box_filter/crop_box_filter_node.cpp
src/time_synchronizer/time_synchronizer_node.cpp
Expand Down Expand Up @@ -109,7 +111,7 @@ rclcpp_components_register_node(pointcloud_preprocessor_filter
# ========== Concatenate and Sync data ==========
rclcpp_components_register_node(pointcloud_preprocessor_filter
PLUGIN "autoware::pointcloud_preprocessor::PointCloudConcatenateDataSynchronizerComponent"
EXECUTABLE concatenate_data_node)
EXECUTABLE concatenate_and_time_sync_node)

# ========== CropBox ==========
rclcpp_components_register_node(pointcloud_preprocessor_filter
Expand Down Expand Up @@ -241,8 +243,17 @@ if(BUILD_TESTING)
test/test_distortion_corrector_node.cpp
)

ament_add_gtest(test_concatenate_node_unit
test/test_concatenate_node_unit.cpp
)

target_link_libraries(test_utilities pointcloud_preprocessor_filter)
target_link_libraries(test_distortion_corrector_node pointcloud_preprocessor_filter)
target_link_libraries(test_concatenate_node_unit pointcloud_preprocessor_filter)

add_ros_test(
test/test_concatenate_node_component.py
TIMEOUT "50"
)

endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**:
ros__parameters:
debug_mode: false
has_static_tf_only: false
rosbag_replay: false
rosbag_length: 20.0
maximum_queue_size: 5
vividf marked this conversation as resolved.
Show resolved Hide resolved
timeout_sec: 0.2
is_motion_compensated: true
publish_synchronized_pointcloud: true
keep_input_frame_in_synchronized_pointcloud: true
publish_previous_but_late_pointcloud: false
synchronized_pointcloud_postfix: pointcloud
input_twist_topic_type: twist
input_topics: [
"/sensing/lidar/left/pointcloud_before_sync",
"/sensing/lidar/right/pointcloud_before_sync",
"/sensing/lidar/top/pointcloud_before_sync"
]
output_frame: base_link
lidar_timestamp_offsets: [0.0, 0.04, 0.08]
lidar_timestamp_noise_window: [0.01, 0.01, 0.01]
203 changes: 160 additions & 43 deletions sensing/autoware_pointcloud_preprocessor/docs/concatenate-data.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

vividf marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
mojomex marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
vividf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "combine_cloud_handler.hpp"

#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>

namespace autoware::pointcloud_preprocessor
{

class PointCloudConcatenateDataSynchronizerComponent;
class CombineCloudHandler;

class CloudCollector
{
public:
CloudCollector(
std::shared_ptr<PointCloudConcatenateDataSynchronizerComponent> && ros2_parent_node,
std::shared_ptr<CombineCloudHandler> & combine_cloud_handler, int num_of_clouds,
double timeout_sec, bool debug_mode);

void set_reference_timestamp(double timestamp, double noise_window);
std::tuple<double, double> get_reference_timestamp_boundary();
void process_pointcloud(
const std::string & topic_name, sensor_msgs::msg::PointCloud2::SharedPtr cloud);
void concatenate_callback();

ConcatenatedCloudResult concatenate_pointclouds(
std::unordered_map<std::string, sensor_msgs::msg::PointCloud2::SharedPtr> topic_to_cloud_map);

std::unordered_map<std::string, sensor_msgs::msg::PointCloud2::SharedPtr>
get_topic_to_cloud_map();

private:
std::shared_ptr<PointCloudConcatenateDataSynchronizerComponent> ros2_parent_node_;
std::shared_ptr<CombineCloudHandler> combine_cloud_handler_;
rclcpp::TimerBase::SharedPtr timer_;
std::unordered_map<std::string, sensor_msgs::msg::PointCloud2::SharedPtr> topic_to_cloud_map_;
uint64_t num_of_clouds_;
double timeout_sec_;
double reference_timestamp_min_{0.0};
double reference_timestamp_max_{0.0};
bool debug_mode_;
};

} // namespace autoware::pointcloud_preprocessor
vividf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <deque>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

// ROS includes
#include "autoware_point_types/types.hpp"

#include <autoware/universe_utils/ros/managed_transform_buffer.hpp>
#include <diagnostic_updater/diagnostic_updater.hpp>
#include <point_cloud_msg_wrapper/point_cloud_msg_wrapper.hpp>

#include <diagnostic_msgs/msg/diagnostic_status.hpp>
#include <geometry_msgs/msg/twist_stamped.hpp>
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <tier4_debug_msgs/msg/int32_stamped.hpp>
#include <tier4_debug_msgs/msg/string_stamped.hpp>

#include <message_filters/pass_through.h>
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <message_filters/sync_policies/exact_time.h>
#include <message_filters/synchronizer.h>

namespace autoware::pointcloud_preprocessor
{
using autoware_point_types::PointXYZIRC;
using point_cloud_msg_wrapper::PointCloud2Modifier;

struct ConcatenatedCloudResult
{
sensor_msgs::msg::PointCloud2::SharedPtr concatenate_cloud_ptr{nullptr};
std::optional<std::unordered_map<std::string, sensor_msgs::msg::PointCloud2::SharedPtr>>
topic_to_transformed_cloud_map;
std::unordered_map<std::string, double> topic_to_original_stamp_map;
};

class CombineCloudHandler
{
private:
rclcpp::Node & node_;

std::vector<std::string> input_topics_;
std::string output_frame_;
bool is_motion_compensated_;
bool publish_synchronized_pointcloud_;
bool keep_input_frame_in_synchronized_pointcloud_;
std::unique_ptr<autoware::universe_utils::ManagedTransformBuffer> managed_tf_buffer_{nullptr};

std::deque<geometry_msgs::msg::TwistStamped> twist_queue_;

/// @brief RclcppTimeHash structure defines a custom hash function for the rclcpp::Time type by
/// using its nanoseconds representation as the hash value.
struct RclcppTimeHash
{
std::size_t operator()(const rclcpp::Time & t) const
{
return std::hash<int64_t>()(t.nanoseconds());
}
};

static void convert_to_xyzirc_cloud(
const sensor_msgs::msg::PointCloud2::SharedPtr & input_cloud,
sensor_msgs::msg::PointCloud2::SharedPtr & xyzirc_cloud);

void correct_pointcloud_motion(
const std::shared_ptr<sensor_msgs::msg::PointCloud2> & transformed_cloud_ptr,
const std::vector<rclcpp::Time> & pc_stamps,
std::unordered_map<rclcpp::Time, Eigen::Matrix4f, RclcppTimeHash> & transform_memo,
std::shared_ptr<sensor_msgs::msg::PointCloud2> transformed_delay_compensated_cloud_ptr);

public:
CombineCloudHandler(
rclcpp::Node & node, std::vector<std::string> input_topics, std::string output_frame,
bool is_motion_compensated, bool publish_synchronized_pointcloud,
bool keep_input_frame_in_synchronized_pointcloud, bool has_static_tf_only);
void process_twist(const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr & input);
void process_odometry(const nav_msgs::msg::Odometry::ConstSharedPtr & input);

ConcatenatedCloudResult combine_pointclouds(
std::unordered_map<std::string, sensor_msgs::msg::PointCloud2::SharedPtr> & topic_to_cloud_map);

Eigen::Matrix4f compute_transform_to_adjust_for_old_timestamp(
const rclcpp::Time & old_stamp, const rclcpp::Time & new_stamp);

std::deque<geometry_msgs::msg::TwistStamped> get_twist_queue();
};

} // namespace autoware::pointcloud_preprocessor
vividf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// Copyright 2023 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include <list>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>

// ROS includes
#include "cloud_collector.hpp"
#include "combine_cloud_handler.hpp"

#include <autoware/universe_utils/ros/debug_publisher.hpp>
#include <autoware/universe_utils/system/stop_watch.hpp>
#include <diagnostic_updater/diagnostic_updater.hpp>
#include <point_cloud_msg_wrapper/point_cloud_msg_wrapper.hpp>

#include <diagnostic_msgs/msg/diagnostic_status.hpp>
#include <geometry_msgs/msg/twist_stamped.hpp>
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <tier4_debug_msgs/msg/int32_stamped.hpp>
#include <tier4_debug_msgs/msg/string_stamped.hpp>

#include <message_filters/pass_through.h>
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <message_filters/sync_policies/exact_time.h>
#include <message_filters/synchronizer.h>

namespace autoware::pointcloud_preprocessor
{
class PointCloudConcatenateDataSynchronizerComponent : public rclcpp::Node
{
public:
explicit PointCloudConcatenateDataSynchronizerComponent(const rclcpp::NodeOptions & node_options);
~PointCloudConcatenateDataSynchronizerComponent() override = default;
void publish_clouds(
ConcatenatedCloudResult && concatenated_cloud_result, double reference_timestamp_min,
double reference_timestamp_max);
void delete_collector(CloudCollector & cloud_collector);
std::list<std::shared_ptr<CloudCollector>> get_cloud_collectors();
void add_cloud_collector(const std::shared_ptr<CloudCollector> & collector);

private:
struct Parameters
{
bool debug_mode;
bool has_static_tf_only;
bool rosbag_replay;
double rosbag_length;
int maximum_queue_size;
double timeout_sec;
bool is_motion_compensated;
bool publish_synchronized_pointcloud;
bool keep_input_frame_in_synchronized_pointcloud;
bool publish_previous_but_late_pointcloud;
std::string synchronized_pointcloud_postfix;
std::string input_twist_topic_type;
std::vector<std::string> input_topics;
std::string output_frame;
std::vector<double> lidar_timestamp_offsets;
std::vector<double> lidar_timestamp_noise_window;
} params_;

double current_concatenate_cloud_timestamp_{0.0};
double latest_concatenate_cloud_timestamp_{0.0};
bool drop_previous_but_late_pointcloud_{false};
bool publish_pointcloud_{false};
double diagnostic_reference_timestamp_min_{0.0};
double diagnostic_reference_timestamp_max_{0.0};
std::unordered_map<std::string, double> diagnostic_topic_to_original_stamp_map_;

std::shared_ptr<CombineCloudHandler> combine_cloud_handler_;
std::list<std::shared_ptr<CloudCollector>> cloud_collectors_;
std::mutex cloud_collectors_mutex_;
std::unordered_map<std::string, double> topic_to_offset_map_;
std::unordered_map<std::string, double> topic_to_noise_window_map_;

// default postfix name for synchronized pointcloud
static constexpr const char * default_sync_topic_postfix = "_synchronized";

// subscribers
std::vector<rclcpp::Subscription<sensor_msgs::msg::PointCloud2>::SharedPtr> pointcloud_subs_;
rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr twist_sub_;
rclcpp::Subscription<nav_msgs::msg::Odometry>::SharedPtr odom_sub_;

// publishers
rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr concatenated_cloud_publisher_;
std::unordered_map<std::string, rclcpp::Publisher<sensor_msgs::msg::PointCloud2>::SharedPtr>
topic_to_transformed_cloud_publisher_map_;
std::unique_ptr<autoware::universe_utils::DebugPublisher> debug_publisher_;

std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
diagnostic_updater::Updater diagnostic_updater_{this};

void cloud_callback(
const sensor_msgs::msg::PointCloud2::SharedPtr & input_ptr, const std::string & topic_name);
void twist_callback(const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr input);
void odom_callback(const nav_msgs::msg::Odometry::ConstSharedPtr input);

static std::string format_timestamp(double timestamp);
void check_concat_status(diagnostic_updater::DiagnosticStatusWrapper & stat);
std::string replace_sync_topic_name_postfix(
const std::string & original_topic_name, const std::string & postfix);
};

} // namespace autoware::pointcloud_preprocessor
Loading
Loading