0% found this document useful (0 votes)
97 views14 pages

Understand Ros Topics

The document discusses ROS topics and how messages are communicated between nodes through publishers and subscribers. It explains how to run a ROS master node, publisher, and subscriber nodes and establish connections between them to transmit messages. Practical tips are provided for writing ROS topic publishers and subscribers.

Uploaded by

Alan Pereira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views14 pages

Understand Ros Topics

The document discusses ROS topics and how messages are communicated between nodes through publishers and subscribers. It explains how to run a ROS master node, publisher, and subscriber nodes and establish connections between them to transmit messages. Practical tips are provided for writing ROS topic publishers and subscribers.

Uploaded by

Alan Pereira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Understanding ROS Topics

Prof. Anis Koubaa

https://www.udemy.com/user/anis-koubaa/
Topic

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
Message Communication

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim

53
1: Run the Master ROS Node
$ roscore

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
54 ROS Robot Programming
2: Running the Subscriber
$ rosrun PACKAGE_NAME NODE_NAME
$ roslaunch PACKAGE_NAME LAUNCH_NAME

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
3: Running the Publisher

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim

55
4: Provide Publisher Info

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
5: Establish Connection Request

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim

56 ROS Robot Programming


6: Connection Response

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
7: TCP Connection

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim

57
8: Message Transmission

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim


Example

Reference Book: ROS Robot Programming (in English).


Authors: Yoonseok Pyo, Hancheol Cho, Leon Jung, Darby Lim
Practical Tips to Write Publisher and Subscriber
for ROS Topics

• Publisher
• Step 1. Determine a name for the topic to publish
• Step 2. Determine the type of the messages that the
topic will publish
• Step 3. Determine the frequency of topic publication
(how many message per second)
• Step 4. Create a publisher object with parameters chosen
• Step 5. Keep publishing the topic message at the selected
frequency
Practical Tips to Write Publisher and
Subscribers for ROS Topics

• Subscriber
• Step 1. Identify the name for the topic to listen to
• Step 2. Identify the type of the messages to be
received
• Step 3. Define a callback function that will be
automatically executed when a new message is received
on the topic
• Step 4. Start listening for the topic messages
• Step 5. Spin to listen for ever (in C++)

You might also like