Examining the Simpler Service and Client

From Lofaro Lab Wiki
Jump to: navigation, search

1) In a new terminal run roscore:

  roscore

2) In a new terminal (terminal 2) go to your workspace and source your devel file(if you used catkin like this series of tutorials):

  cd ~/catkin_ws
source ./devel/setup.bash

3) In terminal 2, run the server.

For C++:

rosrun beginner_tutorials add_two_ints_server

For Python:

rosrun beginner_tutorials add_two_ints_server.py

This terminal should print "Ready to add two ints".

4) In a new terminal (terminal 3) go to your workspace and source your devel file(if you used catkin like this series of tutorials):

  cd ~/catkin_ws
source ./devel/setup.bash

5) In terminal 3, run the client.

For C++

rosrun beginner_tutorials add_two_ints_client 1 3

For Python:

rosrun beginner_tutorials add_two_ints_client.py 1 3

The 1 and 3 above can be any positive integer. This terminal will print the answer. If you look at the server (terminal 2), you will see it received the query and sent back the response.