ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Check if service advertised successfully [closed]

asked 2015-06-24 04:31:46 -0600

Reiner gravatar image

Hi, is there a way to check (ex. get a bool returned) if a service has been successfully advertised?

My node advertises multiple services, and it would be usefull to be able to check, if every service is advertised properly and signal to the user in case sth. went wrong.

Is it possible to get some information from ros::ServiceServer? Does it make sense to maybe use C++ try/catch mechanism? Or maybe am I completely wrong and should assume, that nothing can go wrong when advertising a service? (My node basically advertises services for functions of a third parity lib and it is pretty important, that all functions of that lib are accessible)

thanks for Your input :-)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Reiner
close date 2015-06-25 01:21:02.173516

2 Answers

Sort by ยป oldest newest most voted

answered 2015-06-24 05:38:27 -0600

dornhege gravatar image

There is ros::service::exists for that:

edit flag offensive delete link more


Exactly what I needed, cheers.

Reiner gravatar image Reiner  ( 2015-06-25 01:20:54 -0600 )edit

answered 2015-06-24 04:47:57 -0600

The simplest way is to use the provided command line tool.

You can use command below (but you need to modify it) to call a service

rosservice call /service_name service-args
edit flag offensive delete link more


Not exactly, what I meant, I need my code to check it.

Reiner gravatar image Reiner  ( 2015-06-24 04:51:40 -0600 )edit

I think dornhege's answer can fulfill your need

Po-Jen Lai gravatar image Po-Jen Lai  ( 2015-06-24 06:41:22 -0600 )edit

Question Tools

1 follower


Asked: 2015-06-24 04:31:46 -0600

Seen: 3,466 times

Last updated: Jun 24 '15