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

How to use ROS services

asked 2015-08-04 17:31:27 -0500

negotiator14 gravatar image

I am trying to get data from a gps and use it in a program that I am writing. I read somewhere that ROS services would be an ideal tool for me to use to accomplish my task. I read over the tutorial that ROS provides but I am still having troubles understanding how to use them. In the links below I have the information that I need for my program to work.

edit retag flag offensive close merge delete


well negotiator14, could you use messages communication instead of services since this are messages files?

Vinh K gravatar image Vinh K  ( 2015-08-04 20:37:29 -0500 )edit

And the question is...?

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-08-05 01:55:51 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-08-05 01:57:20 -0500

mgruhler gravatar image

You use messages for many-to-many communication over ROS Topics, whereas Services provide Request/Response communication.

So both could be used what you try to do, depending on your actual use case.

See the Tutorials Page on the ROS wiki, especially the Beginner tutorial sections 10. for creating msgs and srvs, 11-13 for Topic communication via Publisher/Subscribers and 14-16 for Services. From the explanation there, the differences should become clear.

edit flag offensive delete link more


So what I need for my program to work is a latitude and a longitude and I need to get it from the geographic_msgs/GeoPoint.msg message but I am still not sure on how to do that. Once I get those two points then my program uses them to send some files to a user.

negotiator14 gravatar image negotiator14  ( 2015-08-05 11:28:58 -0500 )edit

This seems to be a typical use case for a Subscriber. (Assuming you already have a node that works as a driver for the GPS device and publishes this message) See the Tutorials Page on the ROS Wiki, beginner level, Tutorials 11-13 for this.

If you have a specific question, please post a new one.

mgruhler gravatar image mgruhler  ( 2015-08-06 02:13:40 -0500 )edit

Question Tools

1 follower


Asked: 2015-08-04 17:31:27 -0500

Seen: 367 times

Last updated: Aug 05 '15