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

Revision history [back]

click to hide/show revision 1
initial version

What does the second parameter in the advertise Funktion mean?

That is the name of the function (or callback) that will be called whenever a remote node invokes the add_two_ints service. The function is defined in the lines above the service definition (roscpp_tutorials/add_two_ints_server/add_two_ints_server.cpp, lines 31 - 38)):

bool add(roscpp_tutorials::TwoInts::Request  &req, roscpp_tutorials::TwoInts::Response &res )
{
  [..]
}

And what could I write there instead of "add".

Essentially any function that has the correct prototype for that service definition. In this case bool (*f)(roscpp_tutorials::TwoInts::Request &req, roscpp_tutorials::TwoInts::Response &res).

Is there some kind of library where I can look up how to use that function?

I'm not sure what you mean by that actually. The function is just a plain C++ function, defined in the same file.

What does the second parameter in the advertise Funktion mean?

That is the name of the function (or callback) that will be called whenever a remote node invokes the add_two_ints service. The function is defined in the lines above the service definition (roscpp_tutorials/add_two_ints_server/add_two_ints_server.cpp, lines 31 - 38)):

bool add(roscpp_tutorials::TwoInts::Request  &req, roscpp_tutorials::TwoInts::Response &res )
&res)
{
  [..]
}

And what could I write there instead of "add".

Essentially any function that has the correct prototype for that service definition. In this case bool (*f)(roscpp_tutorials::TwoInts::Request &req, roscpp_tutorials::TwoInts::Response &res).

Is there some kind of library where I can look up how to use that function?

I'm not sure what you mean by that actually. The function is just a plain C++ function, defined in the same file.