Skip to content

Commit

Permalink
Adding more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hilary-luo committed Jan 23, 2025
1 parent 107d6dd commit 92202ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class ClearpathDiagnosticUpdater : public rclcpp::Node
diagnostic_updater::Updater updater_;
std::map<std::string, std::map<std::string, rclcpp::Parameter>> topic_map_;

// Lists to ensure all variables relating to the rate monitoring persist until spin
std::list<double> rates_;
std::list<std::shared_ptr<diagnostic_updater::HeaderlessTopicDiagnostic>>
topic_diagnostics_;
std::list<std::shared_ptr<diagnostic_updater::HeaderlessTopicDiagnostic>> topic_diagnostics_;
std::list<std::shared_ptr<void>> subscriptions_;

void mcu_callback(const clearpath_platform_msgs::msg::Status & msg);
Expand Down
12 changes: 7 additions & 5 deletions clearpath_diagnostics/src/clearpath_diagnostic_updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ ClearpathDiagnosticUpdater::ClearpathDiagnosticUpdater()
setup_topic_rate_diagnostics();
}

// get parameter from yaml and log an error if the parameter is not present
std::string ClearpathDiagnosticUpdater::get_mandatory_param(std::string param_name)
{
try {
Expand All @@ -62,6 +63,7 @@ std::string ClearpathDiagnosticUpdater::get_mandatory_param(std::string param_na
}
}

// save data from MCU Status messages
void ClearpathDiagnosticUpdater::mcu_callback(const clearpath_platform_msgs::msg::Status & msg)
{
firmware_version_ = msg.firmware_version;
Expand Down Expand Up @@ -165,11 +167,11 @@ void ClearpathDiagnosticUpdater::setup_topic_rate_diagnostics()
}

/*
The section below does not use a generic subscription because the generic subscription was
observed to have significantly hgiher CPU usage seemingly related to too short of callbacks
and allocating / releasing the memory too quickly with Fast DDS. Standard subscriptions
perform more reliably.
*/
* The section below does not use a generic subscription because the generic subscription was
* observed to have significantly hgiher CPU usage seemingly related to too short of callbacks
* and allocating/releasing the memory too quickly with Fast DDS. Standard subscriptions
* perform more reliably.
*/

// Create a subscription using the topic name and message type info from the yaml
if (type == "sensor_msgs/msg/CompressedImage") {
Expand Down

0 comments on commit 92202ff

Please sign in to comment.