There's currently no high level API for this, but it's only a couple of lines of code. The example below is cturtle. For boxturtle use "roslib.masterapi" instead.

$ rospython rosgraph
>>> import rosgraph.masterapi
>>> m = rosgraph.masterapi.Master('/mynode')
>>> m.getSystemState()[2]
[['/rosout/set_logger_level', ['/rosout']], ['/rosout/get_loggers', ['/rosout']]]
>>> services = m.getSystemState()[2]
>>> service_names = [x[0] for x in services]
>>> service_names
['/rosout/set_logger_level', '/rosout/get_loggers']

or, more briefly:

service_names = [x[0] for x in rosgraph.masterapi.Master('/mynode').getSystemState()[2]]

 - Ken

On Mon, Jun 14, 2010 at 12:30 PM, Sarah Osentoski <sosentos@cs.brown.edu> wrote:
Hi everyone,

I'm working on some code using python.  I noticed that while there is a nice way to get the list of published topics and their types using get_published_topics, there doesn't seem to be a similar function for services.  

Am I missing something?  If not, will this functionality be added sometime in the future?

Thanks,

Sarah Osentoski
Postdoctoral Research Associate
Department of Computer Science, Brown University





_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users