Skip to content

Commit

Permalink
add diagnostics of Controller Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Sep 25, 2024
1 parent 3246b8c commit db7857e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ class ControllerManager : public rclcpp::Node

void hardware_components_diagnostic_callback(diagnostic_updater::DiagnosticStatusWrapper & stat);

void controller_manager_diagnostic_callback(diagnostic_updater::DiagnosticStatusWrapper & stat);

/**
* @brief determine_controller_node_options - A method that retrieves the controller defined node
* options and adapts them, based on if there is a params file to be loaded or the use_sim_time
Expand Down
27 changes: 27 additions & 0 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ void ControllerManager::init_controller_manager()
diagnostics_updater_.add(
"Hardware Components Activity", this,
&ControllerManager::hardware_components_diagnostic_callback);
diagnostics_updater_.add(
"Controller Manager Activity", this,
&ControllerManager::controller_manager_diagnostic_callback);
}

void ControllerManager::robot_description_callback(const std_msgs::msg::String & robot_description)
Expand Down Expand Up @@ -2829,6 +2832,30 @@ void ControllerManager::hardware_components_diagnostic_callback(
}
}

void ControllerManager::controller_manager_diagnostic_callback(
diagnostic_updater::DiagnosticStatusWrapper & stat)
{
stat.add("update_rate", std::to_string(get_update_rate()));
if (is_resource_manager_initialized())
{
stat.summary(diagnostic_msgs::msg::DiagnosticStatus::OK, "Controller Manager is running");
}
else
{
if (robot_description_.empty())
{
stat.summary(
diagnostic_msgs::msg::DiagnosticStatus::WARN, "Waiting for robot description....");
}
else
{
stat.summary(
diagnostic_msgs::msg::DiagnosticStatus::ERROR,
"Resource Manager is not initialized properly!");
}
}
}

void ControllerManager::update_list_with_controller_chain(
const std::string & ctrl_name, std::vector<std::string>::iterator controller_iterator,
bool append_to_controller)
Expand Down

0 comments on commit db7857e

Please sign in to comment.