Difference between revisions of "Examining the Simpler Service and Client"

From Lofaro Lab Wiki
Jump to: navigation, search
(Created page with "1) In a new terminal run roscore: <nowiki>roscore</nowiki> 2) '''In a new terminal''' (terminal 2) go to your workspace and source your devel file(if you used catkin like...")
 
 
Line 6: Line 6:
 
source ./devel/setup.bash</nowiki>
 
source ./devel/setup.bash</nowiki>
  
3) In terminal 2, run the server:
+
3) In terminal 2, run the server.
  <nowiki>rosrun beginner_tutorials add_two_ints_server</nowiki>
+
 
 +
For C++:
 +
<nowiki>rosrun beginner_tutorials add_two_ints_server</nowiki>
 +
For Python:
 +
<nowiki>rosrun beginner_tutorials add_two_ints_server.py</nowiki>
 
This terminal should print "Ready to add two ints".
 
This terminal should print "Ready to add two ints".
  
Line 14: Line 18:
 
source ./devel/setup.bash</nowiki>
 
source ./devel/setup.bash</nowiki>
  
5) In terminal 3, run the client:
+
5) In terminal 3, run the client.
  <nowiki>rosrun beginner_tutorials add_two_ints_client 1 3</nowiki>
+
 
 +
For C++
 +
<nowiki>rosrun beginner_tutorials add_two_ints_client 1 3</nowiki>
 +
For Python:
 +
<nowiki>rosrun beginner_tutorials add_two_ints_client.py 1 3</nowiki>
 
The 1 and 3 above can be any positive integer. This terminal will print the answer.  
 
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.
 
If you look at the server (terminal 2), you will see it received the query and sent back the response.

Latest revision as of 14:25, 23 October 2014

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.