Ask Your Question
0

Relation between Services and Nodes

asked 2014-08-11 12:43:41 -0500

ROSCMBOT gravatar image

Hello,

I have a very simple question. What's the relation between services and nodes? Can we say services are functions/methods defined in a node. For example, according to this tutorial:

http://wiki.ros.org/ROS/Tutorials/Und...

when I'm running the turtlesim_node node, here is the list of active services:

/clear
/kill
/reset
/rosout/get_loggers
/rosout/set_logger_level
/spawn
/teleop_turtle/get_loggers
/teleop_turtle/set_logger_level
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/get_loggers
/turtlesim/set_logger_level

The question is where are all these services defined? Where can I find their codes?

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-08-11 13:17:05 -0500

dornhege gravatar image

updated 2014-09-22 19:31:47 -0500

tfoote gravatar image

Yes, services are functions in a node that can be called remotely.

Therefore they are defined in the source code of the respective node.

You can find out which node is running a service by using rosservice info SERVICE_NAME

edit flag offensive delete link more
1

answered 2014-08-11 13:26:55 -0500

bvbdort gravatar image

services are declared in .srv and functionality defined in .cpp

refrer .srv files for more info.

check srv folder for services declared. turtlesim code

in turtle.cpp

  set_pen_srv_              = nh_.advertiseService("set_pen", &Turtle::setPenCallback, this);
  teleport_relative_srv_ = nh_.advertiseService
                                      ("teleport_relative", &Turtle::teleportRelativeCallback, this);
  teleport_absolute_srv_ = nh_.advertiseService
                                      ("teleport_absolute", &Turtle::teleportAbsoluteCallback, this);
edit flag offensive delete link more

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

Stats

Asked: 2014-08-11 12:43:41 -0500

Seen: 513 times

Last updated: Sep 22 '14