How to add a service in a node?

asked 2019-10-11 03:07:17 -0600

ros.beginner gravatar image

I have checked a node I am using for my application and what I found out is that there's only publishers and subscribers for this node. I would be doing a record and play function for bag files and I think using a service would be most beneficial. I was just wondering how to add a service in a selected node. Right now, there is no services on the node when I checked rosnode info /node_name.

Any help would be appreciated.

edit retag flag offensive close merge delete



You can refer to tutorial on how to make a service.

Choco93 gravatar image Choco93  ( 2019-10-11 05:06:12 -0600 )edit

Thanks for the response. For this, I was already able to create a service and was successful to perform play function on my app. My concern is before launching the app, i need to manually run the service on a terminal so that my app wont crash because if I dont do that, the service I created isnt available at ROS master. I am thinking of adding the service on the node my app calls on startup. But i dont know how to do that.

ros.beginner gravatar image ros.beginner  ( 2019-10-11 22:20:58 -0600 )edit

You can make a separate service node that will be launched first and client will be in your node where you call the service.

Choco93 gravatar image Choco93  ( 2019-10-12 08:05:02 -0600 )edit