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

Revision history [back]

click to hide/show revision 1
initial version

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"