Back to Learn
Beginner25 min read1 part

Your First ROS 2 Python Node

Write a Python publisher and subscriber to understand nodes, topics and messages.

Goal

Write a Python publisher and subscriber to understand nodes, topics and messages.

Procedure

  1. Create an ament_python package.
  2. Implement a publisher with rclpy.
  3. Add a subscriber and console entry point.
  4. Build, source and run both nodes.

Verification

Record the command output, confirm the expected ROS 2 topic or behaviour, and resolve power, TF and device-permission errors before continuing.

// partsUsed in this tutorial

CONTROLLER-001
ROS 2 Motion Controller Board
Controller