Skip to content
Snippets Groups Projects
Commit a48149f1 authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Add display the list of nodes and the number of threads.

parent f60963f6
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,11 @@ typedef std_srvs::srv::Empty EmptyServiceType;
*/
RosNodePtr get_ros_node(std::string node_name);
size_t ros_executor_get_nb_threads();
void ros_display_list_of_nodes();
/**
* @brief Add a ros node to the global executor.
*
......
......@@ -131,6 +131,13 @@ class Executor {
}
}
/**
* @brief Return the number of threads
*/
size_t get_number_of_threads() {
return ros_executor_.get_number_of_threads();
}
private:
/**
* @brief Thread callback function
......@@ -204,6 +211,7 @@ std::string executable_name() {
#endif
}
/**
* @brief Private function that allow us to initialize ROS only once.
*/
......@@ -273,6 +281,23 @@ void ros_shutdown() {
// rclcpp::shutdown();
}
size_t ros_executor_get_nb_threads() {
return get_ros_executor()->get_number_of_threads();
}
void ros_display_list_of_nodes() {
GlobalListOfRosNodeType::iterator ros_node_it =
GLOBAL_LIST_OF_ROS_NODE.begin();
while(ros_node_it!=GLOBAL_LIST_OF_ROS_NODE.end()) {
RCLCPP_INFO(rclcpp::get_logger("dynamic_graph_bridge"),
"ros_display_list_of_nodes: %s/%s",
ros_node_it->second->get_namespace(),
ros_node_it->second->get_name());
ros_node_it++;
}
}
void ros_clean() {
ros_stop_spinning();
GlobalListOfRosNodeType::iterator ros_node_it =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment