From 8acf11fa724fd9b8e1ea94c135d19c08e2920608 Mon Sep 17 00:00:00 2001 From: abhishek5127-hash Date: Fri, 20 Nov 2026 11:36:52 +0530 Subject: [PATCH 1/5] docs: clarify deprecated std_msgs String usage --- .../Writing-A-Simple-Py-Publisher-And-Subscriber.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst index 3c1440e947..0aac5887de 100644 --- a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst +++ b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst @@ -55,6 +55,12 @@ In this tutorial, you will create :doc:`nodes <../../nodes/Working-with-nodes/Un The example used here is a simple "talker" and "listener" system; one node publishes data and the other subscribes to the topic so it can receive that data. +.. note:: + + The ``{interface(std_msgs/msg/String)}`` message used in this tutorial is deprecated as of + ROS 2 Foxy. It is retained here only to demonstrate basic topic communication. For deployed + systems, define a semantically meaningful message type for the data being exchanged. + The code used in these examples can be found `here `__. Prerequisites From 27843f5802171567715d76289c92d1da86696432 Mon Sep 17 00:00:00 2001 From: abhishek5127-hash Date: Fri, 20 Nov 2026 12:48:50 +0530 Subject: [PATCH 2/5] docs: improve deprecation note formatting --- .../Writing-A-Simple-Py-Publisher-And-Subscriber.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst index 0aac5887de..c6cb731bd5 100644 --- a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst +++ b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst @@ -57,9 +57,9 @@ one node publishes data and the other subscribes to the topic so it can receive .. note:: - The ``{interface(std_msgs/msg/String)}`` message used in this tutorial is deprecated as of - ROS 2 Foxy. It is retained here only to demonstrate basic topic communication. For deployed - systems, define a semantically meaningful message type for the data being exchanged. + The ``{interface(std_msgs/msg/String)}`` message is deprecated as of ROS 2 Foxy. + It is retained in this tutorial only to demonstrate basic topic communication. + For deployed systems, define a semantically meaningful message type for the data being exchanged. The code used in these examples can be found `here `__. From 73e6cd6cc2d9031b1335b8fb4b6f0de51173e576 Mon Sep 17 00:00:00 2001 From: abhishek5127-hash Date: Tue, 24 Nov 2026 22:47:12 +0530 Subject: [PATCH 3/5] Update Python pubsub tutorial to use example_interfaces Signed-off-by: abhishek5127-hash --- ...g-A-Simple-Py-Publisher-And-Subscriber.rst | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst index c6cb731bd5..81187c60b0 100644 --- a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst +++ b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst @@ -41,10 +41,10 @@ Create a Python package named ``py_pubsub`` with the ``ament_python`` build type Add two nodes: -* ``talker``, which publishes ``{interface(std_msgs/msg/String)}`` messages on the topic topic every 0.5 seconds. +* ``talker``, which publishes ``{interface(example_interfaces/msg/String)}`` messages on the topic topic every 0.5 seconds. * ``listener``, which subscribes to the same topic and prints each received message. -Declare the ``{package(rclpy)}`` and ``{package(std_msgs)}`` dependencies in package.xml. +Declare the ``{package(rclpy)}`` and ``{package(example_interfaces)}`` dependencies in package.xml. Add both entry points in ``setup.py``, build with ``colcon``, source the workspace setup file, and run the nodes with ``ros2 run``. @@ -135,7 +135,7 @@ Open the file using your preferred text editor. from rclpy.executors import ExternalShutdownException from rclpy.node import Node - from std_msgs.msg import String + from example_interfaces.msg import String class MinimalPublisher(Node): @@ -180,11 +180,11 @@ The first lines of code after the comments import {package(rclpy)} so its `Node from rclpy.executors import ExternalShutdownException from rclpy.node import Node -The next statement imports the built-in {interface(std_msgs/msg/String)} message type that the node uses to structure the data that it passes on the topic. +The next statement imports the built-in {interface(example_interfaces/msg/String)} message type that the node uses to structure the data that it passes on the topic. .. code-block:: python - from std_msgs.msg import String + from example_interfaces.msg import String These lines represent the node's dependencies. Recall that dependencies have to be added to ``package.xml``, which you'll do in the next section. @@ -198,7 +198,7 @@ Next, the ``MinimalPublisher`` class is created, which inherits from (or is a su Following is the definition of the class's constructor. ``super().__init__`` calls the `Node <{package_link(rclpy)}api/node.html>`__ class's constructor and gives it your node name, in this case ``minimal_publisher``. -`create_publisher <{package_link(rclpy)}api/node.html#rclpy.node.Node.create_publisher>`__ declares that the node publishes messages of type {interface(std_msgs/msg/String)} (imported from the ``std_msgs.msg`` module), over a topic named ``topic``, and that the "queue size" is 10. +`create_publisher <{package_link(rclpy)}api/node.html#rclpy.node.Node.create_publisher>`__ declares that the node publishes messages of type {interface(example_interfaces/msg/String)} (imported from the ``example_interfaces.msg`` module), over a topic named ``topic``, and that the "queue size" is 10. Queue size is a required :doc:`Quality of Service <../../interfaces/topics/About-Quality-of-Service-Settings>` (QoS) setting that limits the amount of queued messages if a subscriber is not receiving them fast enough. Next, `create_timer <{package_link(rclpy)}api/node.html#rclpy.node.Node.create_timer>`__ is used to create a callback that executes every 0.5 seconds. @@ -260,9 +260,9 @@ After the lines above, add the following dependencies corresponding to your node .. code-block:: xml rclpy - std_msgs + example_interfaces -This declares the package needs {package(rclpy)} and {package(std_msgs)} when its code is executed. +This declares the package needs {package(rclpy)} and {package(example_interfaces)} when its code is executed. Make sure to save the file. @@ -358,7 +358,7 @@ Open the ``subscriber_member_function.py`` with your text editor. from rclpy.executors import ExternalShutdownException from rclpy.node import Node - from std_msgs.msg import String + from example_interfaces.msg import String class MinimalSubscriber(Node): @@ -443,7 +443,7 @@ Make sure to save the file, and then your pub/sub system should be ready. 4 Build and run ^^^^^^^^^^^^^^^ -You likely already have the {package(rclpy)} and {package(std_msgs)} packages installed as part of your ROS 2 system. +You likely already have the {package(rclpy)} and {package(example_interfaces)} packages installed as part of your ROS 2 system. It's good practice to run `rosdep `__ (check the :doc:`rosdep tutorial `) in the root of your workspace (``ros2_ws``) to check for missing dependencies before building: .. tabs:: From dc4c703702870a4ac55a19e0820585198a6c8013 Mon Sep 17 00:00:00 2001 From: abhishek5127-hash Date: Tue, 24 Nov 2026 22:57:45 +0530 Subject: [PATCH 4/5] Clarify Python pubsub message deprecation Signed-off-by: abhishek5127-hash --- .../Writing-A-Simple-Py-Publisher-And-Subscriber.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst index 81187c60b0..b26aee5007 100644 --- a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst +++ b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst @@ -58,7 +58,7 @@ one node publishes data and the other subscribes to the topic so it can receive .. note:: The ``{interface(std_msgs/msg/String)}`` message is deprecated as of ROS 2 Foxy. - It is retained in this tutorial only to demonstrate basic topic communication. + This tutorial uses ``{interface(example_interfaces/msg/String)}`` instead. For deployed systems, define a semantically meaningful message type for the data being exchanged. The code used in these examples can be found `here `__. From 11cd197650427f092dc695cbdbce6f96f0e661b8 Mon Sep 17 00:00:00 2001 From: abhishek5127-hash Date: Tue, 24 Nov 2026 23:01:14 +0530 Subject: [PATCH 5/5] Polish Python pubsub tutorial message type update Signed-off-by: abhishek5127-hash --- .../Writing-A-Simple-Py-Publisher-And-Subscriber.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst index b26aee5007..485760be75 100644 --- a/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst +++ b/source/ROS-Framework/client-libraries/Working-with-Client-Libraries/Writing-A-Simple-Py-Publisher-And-Subscriber.rst @@ -41,7 +41,7 @@ Create a Python package named ``py_pubsub`` with the ``ament_python`` build type Add two nodes: -* ``talker``, which publishes ``{interface(example_interfaces/msg/String)}`` messages on the topic topic every 0.5 seconds. +* ``talker``, which publishes ``{interface(example_interfaces/msg/String)}`` messages on the topic every 0.5 seconds. * ``listener``, which subscribes to the same topic and prints each received message. Declare the ``{package(rclpy)}`` and ``{package(example_interfaces)}`` dependencies in package.xml.