ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

API to know whether node is active or not

asked 2017-03-21 20:30:32 -0500

can-43811 gravatar image

updated 2017-03-21 20:31:56 -0500

Hi, I would like to know what is the API in roscpp which can be used whether particular node is active or not.

~can-43811

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-04-03 02:39:30 -0500

eesttaar gravatar image

Hey There's a way to get the current nodes registered with ros master using the ros::master::getNodes(v) This will push the names of the nodes registered into the vector of strings, v.

     while (ros::ok()) 
   {
        if(!ros::master::getNodes(v))
        {
          ROS_INFO("Error");

        }   
         else
        {  
           //do your stuff 
        }
    }

You will have to include the libraries

#include "ros/this_node.h" 
 #include "ros/master.h"
edit flag offensive delete link more
0

answered 2017-03-22 04:34:48 -0500

Bogdar_ gravatar image

Use rosnode list to see active nodes that are being running in command window, also by using rqt_graph is possible to visualize and debug active nodes and topics graphically. For other wanted applications please detail more what you want to do.

edit flag offensive delete link more

Comments

Thanks for your answer. Usually i need to implement a monitor node which will continuously monitor the health status of the other nodes and in case if some of the nodes are dead it has to restart those node so that they can be rerun again.

can-43811 gravatar image can-43811  ( 2017-03-26 02:11:57 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-03-21 20:30:32 -0500

Seen: 2,181 times

Last updated: Mar 22 '17