Skip to content

Commit 7919ad7

Browse files
committed
add counter
1 parent 7d89dcf commit 7919ad7

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

sensing/pointcloud_preprocessor/include/pointcloud_preprocessor/concatenate_data/concatenate_and_time_sync_nodelet.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ class PointCloudConcatenateDataSynchronizerComponent : public rclcpp::Node
181181
void timer_callback();
182182

183183
void checkConcatStatus();
184+
int concat_miss_count_{0};
185+
184186
std::string replaceSyncTopicNamePostfix(
185187
const std::string & original_topic_name, const std::string & postfix);
186188

sensing/pointcloud_preprocessor/src/concatenate_data/concatenate_and_time_sync_nodelet.cpp

+20-8
Original file line numberDiff line numberDiff line change
@@ -696,14 +696,26 @@ void PointCloudConcatenateDataSynchronizerComponent::checkConcatStatus()
696696
diag_status_msg.values.push_back(key_value_msg);
697697
}
698698

699-
const int8_t level = not_subscribed_topic_names_.empty()
700-
? diagnostic_msgs::msg::DiagnosticStatus::OK
701-
: diagnostic_msgs::msg::DiagnosticStatus::WARN;
702-
const std::string message = not_subscribed_topic_names_.empty()
703-
? "Concatenate all topics"
704-
: "Some topics are not concatenated";
705-
diag_status_msg.level = level;
706-
diag_status_msg.message = message;
699+
if(not_subscribed_topic_names_.size() > 0) {
700+
concat_miss_count_ += 1;
701+
}else{
702+
concat_miss_count_ = 0;
703+
}
704+
705+
{
706+
diagnostic_msgs::msg::KeyValue key_value_msg;
707+
key_value_msg.key = "miss_count";
708+
key_value_msg.value = std::to_string(concat_miss_count_);
709+
diag_status_msg.values.push_back(key_value_msg);
710+
}
711+
712+
if(concat_miss_count_ > 2){
713+
diag_status_msg.level = diagnostic_msgs::msg::DiagnosticStatus::WARN;
714+
diag_status_msg.message = "Some topics are not concatenated";
715+
}else{
716+
diag_status_msg.level = diagnostic_msgs::msg::DiagnosticStatus::OK;
717+
diag_status_msg.message = "Concatenate all topics";
718+
}
707719

708720
diagnostic_msgs::msg::DiagnosticArray diag_msg;
709721
diag_msg.header.stamp = this->now();

0 commit comments

Comments
 (0)