Ros Publish Subscibe - make a topic

Any node can publish (send) a message to any topic. And similarly, any node can subscribe (read) a message from any topic.

A Message

The message is defined in the file with extension .msg. The messages will be compiled into C++/Python class after running catkin build.

Header header

The Header is a bult-in ROS class for messages that comes with some handy methods that are automatically filled by ROS such as:

  • seq: it’s a counter

The only exception is for the time which must be hard coded in the callback