Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the services of the omnipresent rosapi node, these are equivalent to the command line statements:

rosservice call rosapi/topics rosservice call rosapi/services

Roscpp

ros::ServiceClient topicclient = n.serviceClient<rosapi::Topics>("rosapi/topics");
ros::ServiceClient servicesclient = n.serviceClient<rosapi::Services>("rosapi/services");

topicclient.call()

Rospy

from rosapi.srv import Topics, Services

topics = rospy.ServiceProxy('/rosapi/topics', Topics)
services = rospy.ServiceProxy('/rosapi/services', Services)
topiclist = topics()
servicelist = services()

You can use the services of the omnipresent rosapi node, these are equivalent to the command line statements:

rosservice call rosapi/topics rosservice call rosapi/services

Roscpp

ros::ServiceClient topicclient topicfinder = n.serviceClient<rosapi::Topics>("rosapi/topics");
ros::ServiceClient servicesclient servicesfinder = n.serviceClient<rosapi::Services>("rosapi/services");

topicclient.call()
rosapi::Topics topicsrv;
rosapi::Services servicessrv;

topicfinder.call(topicsrv);
servicesfinder.call(servicessrv);

Rospy

from rosapi.srv import Topics, Services

topics = rospy.ServiceProxy('/rosapi/topics', Topics)
services = rospy.ServiceProxy('/rosapi/services', Services)
topiclist = topics()
servicelist = services()

I've probably got some typos and mistakes in here, but that's the general gist.