Untitled

Topic is for unidirection. Service is server-client (bidirectional) order.

In my word, client send a data called service. (Request)

server does a certain behavior.

And return the result to client. (Response)

srv : service’s abbreviation!!

ros2 interface show example_interfaces/srv/AddTwoInts

// request
int64 a
int64 b
---
// response
int64 sum

service can be called without client in terminal!

It directly send request via CLI.

// this is an error
ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a:3, b:4}"

// this works (There should be space after ":")
ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 3, b: 4}"
ros2 node info {your node}

#: You can check all service, topics.

ros2 service list

ros2 service type {your service}

ros2 interface show {your service type}

#: shows response and request format

ros2 service call {your service} {your service type} **[Press tab, then you can see list of possible cmd]**

rqt -plugins - service caller : you can give request much easier, and you can check response on the bottom.

Remap a service at Runtime