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

Check if service advertised successfully [closed]

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

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
5

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

dornhege gravatar image

There is ros::service::exists for that: http://docs.ros.org/api/roscpp/html/n...

edit flag offensive delete link more

Comments

Exactly what I needed, cheers.

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

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

The simplest way is to use the provided command line tool. http://wiki.ros.org/rosservice#rosser...

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

Comments

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

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

I think dornhege's answer can fulfill your need

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

Question Tools

1 follower

Stats

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

Seen: 4,151 times

Last updated: Jun 24 '15