Skip to content

Update python publisher tutorial with links to relevant docs#6181

Open
EmmanuelMess wants to merge 1 commit intoros2:rollingfrom
EmmanuelMess:emmanuelmess/fix/py_publisher_tutorial
Open

Update python publisher tutorial with links to relevant docs#6181
EmmanuelMess wants to merge 1 commit intoros2:rollingfrom
EmmanuelMess:emmanuelmess/fix/py_publisher_tutorial

Conversation

@EmmanuelMess
Copy link

Description

Update python publisher and subscriber tutorial with links to relevant documentation.

Addresses #4985

Did you use Generative AI?

No.

Additional Information

This first PR is to test the idea. Also see that rosdep's link is explicitly set because the macro doesn't work, see #6180.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with green CI.

@fujitatomoya
Copy link
Collaborator

@christophebedard can i have a second review on this?

@christophebedard
Copy link
Member

christophebedard commented Jan 23, 2026

This first PR is to test the idea.

This PR is OK, but, similar to what was mentioned in #4985 (comment), I would not systematically do this for other articles.

Instead of writing

`Node <{package_link(rclpy)}api/node.html>`__ class

everywhere to link to the API docs for Node, we need tooling that lets us write something like

{api(rclpy, rclpy.Node)} class

and expands it to the correct page. For now, I think we're still generally working on making sure API docs are properly generated, which does mean changes to rosdoc2, but it mostly means fixing a lot of the packages (e.g., ros2/geometry2#857). Then we can think about how to create/find tooling to easily link to it from here. Otherwise the page we link to may not exist or the actual URL may change shortly after.

@Shivam-Bhardwaj
Copy link
Contributor

I can look up for developing/incorporating a proper system for links in a seperate issue. Or help with something that's WIP.

Can this be taken care on the URL side? Maintaining a database of URL matched with the doc links?

@EmmanuelMess EmmanuelMess force-pushed the emmanuelmess/fix/py_publisher_tutorial branch from 0eaa779 to 419088d Compare January 23, 2026 13:35
Copy link
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last minor comment

self.i = 0

``timer_callback`` creates a message with the counter value appended, and publishes it to the console with ``get_logger().info``.
``timer_callback`` creates a message with the counter value appended, publishes it, and prints it to the console with `get_logger() <https://docs.ros.org/en/rolling/p/rclpy/api/node.html#rclpy.node.Node.get_logger>`__'s `info() <{package_link(rclpy)}rclpy.impl.rcutils_logger.html#rclpy.impl.rcutils_logger.RcutilsLogger.info>`__ function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
``timer_callback`` creates a message with the counter value appended, publishes it, and prints it to the console with `get_logger() <https://docs.ros.org/en/rolling/p/rclpy/api/node.html#rclpy.node.Node.get_logger>`__'s `info() <{package_link(rclpy)}rclpy.impl.rcutils_logger.html#rclpy.impl.rcutils_logger.RcutilsLogger.info>`__ function.
``timer_callback`` creates a message with the counter value appended, publishes it, and prints it to the console with `get_logger() <{package_link(rclpy)}api/node.html#rclpy.node.Node.get_logger>`__'s `info() <{package_link(rclpy)}rclpy.impl.rcutils_logger.html#rclpy.impl.rcutils_logger.RcutilsLogger.info>`__ function.

You likely already have the ``rclpy`` and ``std_msgs`` packages installed as part of your ROS 2 system.
It's good practice to run ``rosdep`` in the root of your workspace (``ros2_ws``) to check for missing dependencies before building:
You likely already have the {package(rclpy)} and {package(std_msgs)} packages installed as part of your ROS 2 system.
It's good practice to run `rosdep <https://docs.ros.org/en/independent/api/rosdep/html/>`__ in the root of your workspace (``ros2_ws``) to check for missing dependencies before building:
Copy link
Member

@christophebedard christophebedard Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer linking to the rosdep tutorial in the ROS 2 docs. That tutorial is a bit more user-friendly and up-to-date, and does link to https://docs.ros.org/en/independent/api/rosdep/html/

@christophebedard
Copy link
Member

I can look up for developing/incorporating a proper system for links in a seperate issue. Or help with something that's WIP.

Can this be taken care on the URL side? Maintaining a database of URL matched with the doc links?

I would hold off for now. Please see #6186 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants