Skip to content

Commit 10052ad

Browse files
committed
chore: fix min max
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
1 parent a6495c9 commit 10052ad

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

sensing/pointcloud_preprocessor/include/pointcloud_preprocessor/concatenate_data/concatenate_and_time_sync_node.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ class PointCloudConcatenateDataSynchronizerComponent : public rclcpp::Node
113113
std::vector<double> lidar_timestamp_noise_window;
114114
} params_;
115115

116+
// remove this later
117+
rclcpp::Clock::SharedPtr debug_clock = std::make_shared<rclcpp::Clock>(RCL_ROS_TIME);
118+
116119
std::set<std::string> missed_cloud_;
117120
std::shared_ptr<CombineCloudHandler> combine_cloud_handler_;
118121
std::shared_ptr<CloudCollector> cloud_collector_;

sensing/pointcloud_preprocessor/src/concatenate_data/cloud_collector.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ void CloudCollector::setReferenceTimeStamp(double timestamp, double noise_window
8484
{
8585
reference_timestamp_max_ = timestamp + noise_window;
8686
reference_timestamp_min_ = timestamp - noise_window;
87+
88+
std::cout << "timestamp: " << timestamp << std::endl;
89+
std::cout << "noise_window: " << noise_window << std::endl;
90+
std::cout << "reference_timestamp_max_: " << reference_timestamp_max_ << std::endl;
91+
std::cout << "reference_timestamp_min_: " << reference_timestamp_min_ << std::endl;
8792
}
8893

8994
std::tuple<double, double> CloudCollector::getReferenceTimeStampBoundary()

sensing/pointcloud_preprocessor/src/concatenate_data/concatenate_and_time_sync_node.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ std::string PointCloudConcatenateDataSynchronizerComponent::replaceSyncTopicName
223223
void PointCloudConcatenateDataSynchronizerComponent::cloud_callback(
224224
const sensor_msgs::msg::PointCloud2::SharedPtr & input_ptr, const std::string & topic_name)
225225
{
226-
std::cout << "topic name pointcloud arrive: " << topic_name << " " << std::fixed
226+
// Get the current time
227+
rclcpp::Time now = debug_clock->now();
228+
std::cout << "Current time: " << now.seconds() << " seconds" << std::endl;
229+
230+
std::cout << "pointcloud name and timestamp: " << topic_name << " " << std::fixed
227231
<< std::setprecision(9) << rclcpp::Time(input_ptr->header.stamp).seconds() << std::endl;
228232
sensor_msgs::msg::PointCloud2::SharedPtr xyzi_input_ptr(new sensor_msgs::msg::PointCloud2());
229233
auto input = std::make_shared<sensor_msgs::msg::PointCloud2>(*input_ptr);
@@ -242,12 +246,22 @@ void PointCloudConcatenateDataSynchronizerComponent::cloud_callback(
242246
// std::cout << "topic_to_offset_map_[topic_name]: " << topic_to_offset_map_[topic_name] <<
243247
// std::endl;
244248
if (!cloud_collectors_.empty()) {
245-
// std::cout << "Searching collect in size: " << cloud_collectors_.size() << std::endl;
249+
std::cout << "Searching collect in size: " << cloud_collectors_.size() << std::endl;
246250
for (const auto & cloud_collector : cloud_collectors_) {
247251
// std::cout << "collector timestamp: " << std::fixed << std::setprecision(9) <<
248252
// cloud_collector->getTimeStamp() << std::endl; cloud_collector->printTimer();
249-
auto [reference_timestamp_max, reference_timestamp_min] =
253+
auto [reference_timestamp_min, reference_timestamp_max] =
250254
cloud_collector->getReferenceTimeStampBoundary();
255+
256+
std::cout
257+
<< "rclcpp::Time(input_ptr->header.stamp).seconds() - topic_to_offset_map_[topic_name]: "
258+
<< rclcpp::Time(input_ptr->header.stamp).seconds() - topic_to_offset_map_[topic_name]
259+
<< std::endl;
260+
std::cout << "reference_timestamp_max + topic_to_noise_window_map[topic_name]: "
261+
<< reference_timestamp_max + topic_to_noise_window_map[topic_name] << std::endl;
262+
std::cout << "reference_timestamp_min - topic_to_noise_window_map[topic_name]: "
263+
<< reference_timestamp_min - topic_to_noise_window_map[topic_name] << std::endl;
264+
251265
if (
252266
rclcpp::Time(input_ptr->header.stamp).seconds() - topic_to_offset_map_[topic_name] <
253267
reference_timestamp_max + topic_to_noise_window_map[topic_name] &&
@@ -263,7 +277,7 @@ void PointCloudConcatenateDataSynchronizerComponent::cloud_callback(
263277
}
264278
// if collecotrs is empty or didn't find matched collector.
265279
if (!collector_found) {
266-
// std::cout << "create new collector " << std::endl;
280+
std::cout << "create new collector " << std::endl;
267281
auto new_cloud_collector = std::make_shared<CloudCollector>(
268282
std::dynamic_pointer_cast<PointCloudConcatenateDataSynchronizerComponent>(shared_from_this()),
269283
cloud_collectors_, combine_cloud_handler_, params_.input_topics.size(), params_.timeout_sec);

0 commit comments

Comments
 (0)