Skip to content

Add $ to Demos (backport #5352) #5392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/Tutorials/Demos/Content-Filtering-Subscription.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ The ``ContentFilteringPublisher`` node publishes simulated temperature data star

We can run the demo by running the ``ros2 run demo_nodes_cpp content_filtering_publisher`` executable (don't forget to source the setup file first):

.. code-block:: bash
.. code-block:: console

$ ros2 run demo_nodes_cpp content_filtering_publisher
[INFO] [1651094594.822753479] [content_filtering_publisher]: Publishing: '-100.000000'
Expand Down Expand Up @@ -248,7 +248,7 @@ Applications can use the ``is_cft_enabled`` method to check if content filtering

To test content filtering subscription, let's run it:

.. code-block:: bash
.. code-block:: console

$ ros2 run demo_nodes_cpp content_filtering_subscriber
[INFO] [1651094590.682660703] [content_filtering_subscriber]: subscribed to topic "/temperature" with content filter options "data < %0 OR data > %1, {-30.000000, 100.000000}"
Expand Down Expand Up @@ -277,7 +277,7 @@ You should see a message showing the content filtering options used and logs for
If content filtering is not supported by the RMW implementation, the subscription will still be created without content filtering enabled.
We can try that by executing ``RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run demo_nodes_cpp content_filtering_publisher``.

.. code-block:: bash
.. code-block:: console

$ RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run demo_nodes_cpp content_filtering_subscriber
[WARN] [1651096637.893842072] [content_filtering_subscriber]: Content filter is not enabled since it is not supported
Expand Down
14 changes: 7 additions & 7 deletions source/Tutorials/Demos/Intra-Process-Communication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ This demonstrates that intra process communication is indeed working and unneces

Let's run the demo by executing ``ros2 run intra_process_demo two_node_pipeline`` executable (don't forget to source the setup file first):

.. code-block:: bash
.. code-block:: console

$ ros2 run intra_process_demo two_node_pipeline
Published message with value: 0, and address: 0x7fb02303faf0
Expand Down Expand Up @@ -263,7 +263,7 @@ Because the message is being published and subscribed to as a ``unique_ptr`` the

To test those expectations, let's run it:

.. code-block:: bash
.. code-block:: console

$ ros2 run intra_process_demo cyclic_pipeline
Published first message with value: 42, and address: 0x7fd2ce0a2bc0
Expand Down Expand Up @@ -302,7 +302,7 @@ In this demo we'll use OpenCV to capture, annotate, and then view images.

If you are on macOS and these examples do not work or you receive an error like ``ddsi_conn_write failed -1``, then you'll need to increase your system wide UDP packet size:

.. code-block:: bash
.. code-block:: console

$ sudo sysctl -w net.inet.udp.recvspace=209715
$ sudo sysctl -w net.inet.udp.maxdgram=65500
Expand All @@ -329,9 +329,9 @@ The watermark and image view nodes are designed to modify the image without copy

Let's run the demo by executing the following executable:

.. code-block:: bash
.. code-block:: console

ros2 run intra_process_demo image_pipeline_all_in_one
$ ros2 run intra_process_demo image_pipeline_all_in_one

You should see something like this:

Expand All @@ -352,9 +352,9 @@ All the nodes are still in the same process, but now two image view windows shou
(Note for macOS users: your image view windows might be on top of each other).
Let's run it with the command:

.. code-block:: bash
.. code-block:: console

ros2 run intra_process_demo image_pipeline_with_two_image_view
$ ros2 run intra_process_demo image_pipeline_with_two_image_view


.. image:: images/intra-process-demo-pipeline-two-windows-copy.png
Expand Down
136 changes: 68 additions & 68 deletions source/Tutorials/Demos/Logging-and-logger-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ In this `demo <https://github.com/ros2/demos/tree/{REPOS_FILE_BRANCH}/logging_de

Start the demo with:

.. code-block:: bash
.. code-block:: console

ros2 run logging_demo logging_demo_main
$ ros2 run logging_demo logging_demo_main

Over time you will see output from various log calls with different properties.
To start with you will only see output from log calls with severity ``INFO`` and above (``WARN``, ``ERROR``, ``FATAL``).
Expand All @@ -170,24 +170,24 @@ For example, to set the logging directory to ``~/my_logs``:

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export ROS_LOG_DIR=~/my_logs
ros2 run logging_demo logging_demo_main
$ export ROS_LOG_DIR=~/my_logs
$ ros2 run logging_demo logging_demo_main

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export ROS_LOG_DIR=~/my_logs
ros2 run logging_demo logging_demo_main
$ export ROS_LOG_DIR=~/my_logs
$ ros2 run logging_demo logging_demo_main

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "ROS_LOG_DIR=~/my_logs"
ros2 run logging_demo logging_demo_main
$ set "ROS_LOG_DIR=~/my_logs"
$ ros2 run logging_demo logging_demo_main

You will then find the logs under ``~/my_logs/``.

Expand All @@ -200,24 +200,24 @@ For example, with ``ROS_HOME`` set to ``~/my_ros_home``:

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export ROS_HOME=~/my_ros_home
ros2 run logging_demo logging_demo_main
$ export ROS_HOME=~/my_ros_home
$ ros2 run logging_demo logging_demo_main

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export ROS_HOME=~/my_ros_home
ros2 run logging_demo logging_demo_main
$ export ROS_HOME=~/my_ros_home
$ ros2 run logging_demo logging_demo_main

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "ROS_HOME=~/my_ros_home"
ros2 run logging_demo logging_demo_main
$ set "ROS_HOME=~/my_ros_home"
$ ros2 run logging_demo logging_demo_main

You will then find the logs under ``~/my_ros_home/log/``.

Expand All @@ -239,17 +239,17 @@ In the meantime, this demo provides an **example** service that can be called ex
The demo previously started is already running this example service.
To set the level of the demo's logger back to ``INFO``\ , call the service with:

.. code-block:: bash
.. code-block:: console

ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: 'logger_usage_demo', level: INFO}"
$ ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: 'logger_usage_demo', level: INFO}"

This service call will work on any logger that is running in the process provided that you know its name.
This includes the loggers in the ROS 2 core, such as ``rcl`` (the common client library package).
To enable debug logging for ``rcl``, call:

.. code-block:: bash
.. code-block:: console

ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: 'rcl', level: DEBUG}"
$ ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: 'rcl', level: DEBUG}"

You should see debug output from ``rcl`` start to show.

Expand All @@ -263,32 +263,32 @@ As an example, if you want to debug the ``composition::Talker`` demo, you can st

Shell 1:

.. code-block:: bash
.. code-block:: console

ros2 run rclcpp_components component_container
$ ros2 run rclcpp_components component_container

Shell 2:

.. code-block:: bash
.. code-block:: console

ros2 component load /ComponentManager composition composition::Talker
$ ros2 component load /ComponentManager composition composition::Talker

And then when you want to enable debug logging, load the ``LoggerConfig`` component with:

Shell 2

.. code-block:: bash
.. code-block:: console

ros2 component load /ComponentManager logging_demo logging_demo::LoggerConfig
$ ros2 component load /ComponentManager logging_demo logging_demo::LoggerConfig

And finally, configure all unset loggers to the debug severity by addressing the empty-named logger.
Note that loggers that have been specifically configured to use a particular severity will not be affected by this call.

Shell 2:

.. code-block:: bash
.. code-block:: console

ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: '', level: DEBUG}"
$ ros2 service call /config_logger logging_demo/srv/ConfigLogger "{logger_name: '', level: DEBUG}"

You should see debug output from any previously unset loggers in the process start to appear, including from the ROS 2 core.

Expand All @@ -299,9 +299,9 @@ As of the Bouncy ROS 2 release, the severity level for loggers that have not had
Restart the demo including the following command line argument:


.. code-block:: bash
.. code-block:: console

ros2 run logging_demo logging_demo_main --ros-args --log-level debug
$ ros2 run logging_demo logging_demo_main --ros-args --log-level debug

This configures the default severity for any unset logger to the debug severity level.
You should see debug output from loggers from the demo itself and from the ROS 2 core.
Expand All @@ -313,9 +313,9 @@ Restart the demo including the following command line arguments:

.. group-tab:: Galactic and newer

.. code-block:: bash
.. code-block:: console

ros2 run logging_demo logging_demo_main --ros-args --log-level logger_usage_demo:=debug
$ ros2 run logging_demo logging_demo_main --ros-args --log-level logger_usage_demo:=debug


Console output formatting
Expand All @@ -328,24 +328,24 @@ For example, to additionally get the timestamp and location of the log calls, st

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
ros2 run logging_demo logging_demo_main
$ export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
$ ros2 run logging_demo logging_demo_main

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
ros2 run logging_demo logging_demo_main
$ export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
$ ros2 run logging_demo logging_demo_main

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "RCUTILS_CONSOLE_OUTPUT_FORMAT=[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
ros2 run logging_demo logging_demo_main
$ set "RCUTILS_CONSOLE_OUTPUT_FORMAT=[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"
$ ros2 run logging_demo logging_demo_main

You should see the timestamp in seconds and the function name, filename and line number additionally printed with each message.
*The ``time`` option is only supported as of the ROS 2 Bouncy release.*
Expand All @@ -361,24 +361,24 @@ For example:

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export RCUTILS_COLORIZED_OUTPUT=0 # 1 for forcing it
ros2 run logging_demo logging_demo_main
$ export RCUTILS_COLORIZED_OUTPUT=0 # 1 for forcing it
$ ros2 run logging_demo logging_demo_main

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export RCUTILS_COLORIZED_OUTPUT=0 # 1 for forcing it
ros2 run logging_demo logging_demo_main
$ export RCUTILS_COLORIZED_OUTPUT=0 # 1 for forcing it
$ ros2 run logging_demo logging_demo_main

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "RCUTILS_COLORIZED_OUTPUT=0" :: 1 for forcing it
ros2 run logging_demo logging_demo_main
$ set "RCUTILS_COLORIZED_OUTPUT=0" :: 1 for forcing it
$ ros2 run logging_demo logging_demo_main

You should see that debug, warn, error and fatal logs aren't colorized now.

Expand All @@ -400,21 +400,21 @@ For example:

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export RCUTILS_LOGGING_USE_STDOUT=1
$ export RCUTILS_LOGGING_USE_STDOUT=1

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export RCUTILS_LOGGING_USE_STDOUT=1
$ export RCUTILS_LOGGING_USE_STDOUT=1

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "RCUTILS_LOGGING_USE_STDOUT=1"
$ set "RCUTILS_LOGGING_USE_STDOUT=1"


Line buffered console output
Expand All @@ -429,24 +429,24 @@ For example:

.. group-tab:: Linux

.. code-block:: bash
.. code-block:: console

export RCUTILS_LOGGING_BUFFERED_STREAM=1
$ export RCUTILS_LOGGING_BUFFERED_STREAM=1

.. group-tab:: macOS

.. code-block:: bash
.. code-block:: console

export RCUTILS_LOGGING_BUFFERED_STREAM=1
$ export RCUTILS_LOGGING_BUFFERED_STREAM=1

.. group-tab:: Windows

.. code-block:: bash
.. code-block:: console

set "RCUTILS_LOGGING_BUFFERED_STREAM=1"
$ set "RCUTILS_LOGGING_BUFFERED_STREAM=1"

Then run:

.. code-block:: bash
.. code-block:: console

ros2 run logging_demo logging_demo_main
$ ros2 run logging_demo logging_demo_main
Loading