Ask Your Question

How to use services ?

asked 2017-05-17 02:51:52 -0500

Milow gravatar image

updated 2017-05-17 02:53:48 -0500

According to this tutorial [ ], I thought we could use a service like :

    client = n.serviceClient<std_srvs::Empty>("/reset_positions");
    std_srvs::Empty reset_srv;;

But execution is blocked on the waitForService instruction and return :

[ INFO] [1495007235.234008766]: waitForService: Service [/reset_positions] has not been advertised, waiting...

Is there something I missed to run this service ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-17 03:00:08 -0500

NEngelhard gravatar image

It looks like you have only a client, but no node that is actually providing the service. What is the outout of 'rosservice list' before running your client?

edit flag offensive delete link more


There is only this two lines :

How can I launch the node to provide the service ?

Milow gravatar image Milow  ( 2017-05-17 03:06:58 -0500 )edit

Just do the tutorial you linked...

NEngelhard gravatar image NEngelhard  ( 2017-05-17 09:28:36 -0500 )edit

I did it, I created a ServiceServer who is running a personnal service. I can call this service (only displaying a "hello world" when called). But I don't see how to use the reset_positions service to reset the position of my turtlebot.

Milow gravatar image Milow  ( 2017-05-17 09:33:05 -0500 )edit

So to reword, I know how to create my own service, but it's not what I want to do. I would like to run an existing service called "reset_positions". I can create a service called the same name and advertised it from a node and run that, that's the tutorial, but it would be useless to me. Any idea ?

Milow gravatar image Milow  ( 2017-05-18 02:47:33 -0500 )edit

Can anyone tell me how function uses TCP protocol ?

shantanu543 gravatar image shantanu543  ( 2017-06-21 01:44:09 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-05-17 02:51:52 -0500

Seen: 780 times

Last updated: May 17 '17