Back to the 2026 paper

Module 2: Basics of Robot Operating System (ROS)

20267m

Explain ROS Nodes and ROS Topics.

Worked SolutionAI Assisted

ROS Nodes and ROS Topics

ROS Node

A node is an executable process that performs one specific computation (e.g. camera driver, motor controller, path planner). A robot system is built from many small nodes that talk to each other, which keeps the software modular and reusable.

  • Each node registers with the ROS Master using a unique name.
  • Nodes can be written in Python (rospy) or C++ (roscpp).
  • Useful commands: rosnode list, rosnode info /talker, rosrun pkg node.

ROS Topic

A topic is a named, one-way communication channel (publish/subscribe) over which nodes exchange messages of a fixed type.

  • A publisher sends messages to a topic.
  • A subscriber receives messages from that topic.
  • Many publishers and many subscribers are allowed; they do not know about each other (decoupled).
  • Useful commands: rostopic list, rostopic echo /chatter, rostopic info /chatter.
MermaidDiagram
Rendering diagram…
#!/usr/bin/env python
import rospy
from std_msgs.msg import String


def talker():
    pub = rospy.Publisher('chatter', String, queue_size=10)
    rospy.init_node('talker', anonymous=True)
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        pub.publish('hello robot')
        rate.sleep()


if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass

Node vs Topic

Point Node Topic
What it is Process doing a task Named message channel
Role Publisher / subscriber Carries data between nodes
Example /talker /chatter

Exam tip

Draw the talker → topic → listener diagram and write the two short code snippets; mention the Master only does name lookup, data flows directly node to node.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.