Note: This tutorial assumes that you have completed the previous tutorials: writing a simple publisher and subscriber (python) (c++).

Examining the Simple Publisher and Subscriber

Description: This tutorial examines running the simple publisher and subscriber.

Tutorial Level: BEGINNER

Next Tutorial: Writing a simple service and client (python) (c++)

Running the Publisher

Make sure that a roscore is up and running:

$ roscore

In the last tutorial we made a publisher called "talker". Let's run it:

$ rosrun beginner_tutorials talker      (C++)
$ rosrun beginner_tutorials talker.py   (Python) 

You will see something similar to:

  • [INFO] [WallTime: 1314931831.774057] hello world 1314931831.77
    [INFO] [WallTime: 1314931832.775497] hello world 1314931832.77
    [INFO] [WallTime: 1314931833.778937] hello world 1314931833.78
    [INFO] [WallTime: 1314931834.782059] hello world 1314931834.78
    [INFO] [WallTime: 1314931835.784853] hello world 1314931835.78
    [INFO] [WallTime: 1314931836.788106] hello world 1314931836.79

The publisher node is up and running. Now we need a subscriber to receive messages from the publisher.

Running the Subscriber

In the last tutorial we made a subscriber called "listener". Let's run it:

$ rosrun beginner_tutorials listener     (C++)
$ rosrun beginner_tutorials listener.py  (Python) 

You will see something similar to:

  • [INFO] [WallTime: 1314931969.258941] /listener_17657_1314931968795I heard hello world 1314931969.26
    [INFO] [WallTime: 1314931970.262246] /listener_17657_1314931968795I heard hello world 1314931970.26
    [INFO] [WallTime: 1314931971.266348] /listener_17657_1314931968795I heard hello world 1314931971.26
    [INFO] [WallTime: 1314931972.270429] /listener_17657_1314931968795I heard hello world 1314931972.27
    [INFO] [WallTime: 1314931973.274382] /listener_17657_1314931968795I heard hello world 1314931973.27
    [INFO] [WallTime: 1314931974.277694] /listener_17657_1314931968795I heard hello world 1314931974.28
    [INFO] [WallTime: 1314931975.283708] /listener_17657_1314931968795I heard hello world 1314931975.28

Now that you have examined the simple publisher and subscriber, let's write a simple service and client (python) (c++).

Wiki: ROS/Tutorials/ExaminingPublisherSubscriber (last edited 2011-09-02 03:07:34 by DereckWonnacott)