Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions clearpath_diagnostics/src/clearpath_diagnostic_updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,12 @@ void ClearpathDiagnosticUpdater::setup_topic_rate_diagnostics()
template<class MsgType> void ClearpathDiagnosticUpdater::add_rate_diagnostic(
const std::string topic_name, const double rate)
{
// Skip disabled topics (rate of 0 means the topic is not published)
if (rate == 0.0) {
RCLCPP_INFO(this->get_logger(), "Skipping diagnostic for %s (rate is 0)", topic_name.c_str());
return;
}

// Store the rate so that it can be accessed via a pointer and is not deleted
rates_.push_back(rate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,12 @@ def add_topic(self, sensor: BaseSensor, topic_key: str) -> None:
:param sensor: The sensor object from which the topic info will be gotten
:param topic_key: The key used to identify the topic to be monitored
"""
rate = float(sensor.get_topic_rate(topic_key))
if rate == 0.0:
return
self.diag_dict[sensor.get_topic_name(topic_key, local=True)] = {
'type': sensor.get_topic_type(topic_key),
'rate': float(sensor.get_topic_rate(topic_key))
'rate': rate
}

class FoxgloveBridgeParam(BaseParam):
Expand Down
Loading