Skip to content

Commit 418c5f3

Browse files
mergify[bot]ahcordeNils-ChristianIseke
authored
Adding $ to some How-To-Guides (backport #5322) (#5333)
* Adding $ to some How-To-Guides (#5322) Co-authored-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Nils-Christian Iseke <[email protected]> (cherry picked from commit 8e77980) Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Nils-Christian Iseke <[email protected]> Co-authored-by: Alejandro Hernandez Cordero <[email protected]>
1 parent 64e1d51 commit 418c5f3

29 files changed

+334
-341
lines changed

source/Concepts/Basic/About-Command-Line-Tools.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ The main entry point for the tools is the command ``ros2``, which itself has var
1919

2020
To see all available sub-commands run:
2121

22-
.. code-block:: bash
22+
.. code-block:: console
2323
24-
ros2 --help
24+
$ ros2 --help
2525
2626
Examples of sub-commands that are available include:
2727

source/Concepts/Intermediate/About-RQt.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ The tools can still run in a traditional standalone method, but RQt makes it eas
1919

2020
You can run any RQt tools/plugins easily by:
2121

22-
.. code-block:: bash
22+
.. code-block:: console
2323
24-
rqt
24+
$ rqt
2525
2626
This GUI allows you to choose any available plugins on your system.
2727
You can also run plugins in standalone windows.
2828
For example, RQt Python Console:
2929

30-
.. code-block:: bash
30+
.. code-block:: console
3131
32-
ros2 run rqt_py_console rqt_py_console
32+
$ ros2 run rqt_py_console rqt_py_console
3333
3434
Users can create their own plugins for RQt with either ``Python`` or ``C++``.
3535
To see what RQt plugins are available for your system, run:
3636

37-
.. code-block:: bash
37+
.. code-block:: console
3838
39-
ros2 pkg list
39+
$ ros2 pkg list
4040
4141
And then look for packages that start with ``rqt_``.
4242

@@ -46,9 +46,9 @@ System setup
4646
Installing From debs
4747
^^^^^^^^^^^^^^^^^^^^
4848

49-
.. code-block:: bash
49+
.. code-block:: console
5050
51-
sudo apt install ros-{DISTRO}-rqt*
51+
$ sudo apt install ros-{DISTRO}-rqt*
5252
5353
5454
RQt Components Structure

source/How-To-Guides/Ament-CMake-Documentation.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,11 @@ A recommended best practice when defining environment hooks is to place them wit
645645

646646
Inside your created ``hooks`` folder, create a ``my_package.sh.in`` as follows:
647647

648-
.. code-block:: bash
648+
.. code-block:: console
649649
650-
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
651-
export RMW_FASTRTPS_USE_QOS_FROM_XML=1
652-
export FASTRTPS_DEFAULT_PROFILES_FILE="$COLCON_CURRENT_PREFIX/my_dds_profile.xml"
650+
$ export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
651+
$ export RMW_FASTRTPS_USE_QOS_FROM_XML=1
652+
$ export FASTRTPS_DEFAULT_PROFILES_FILE="$COLCON_CURRENT_PREFIX/my_dds_profile.xml"
653653
654654
In the same folder, create a ``my_package.dsv.in`` file as follows:
655655

source/How-To-Guides/Configure-ZeroCopy-loaned-messages.rst

+14-14
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The requirements for loaned messages are that the message type is a Plain Old Da
152152

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

155-
.. code-block:: bash
155+
.. code-block:: console
156156
157157
$ ros2 run demo_nodes_cpp talker_loaned_message
158158
[INFO] [1741063656.446278828] [loaned_message_talker]: Publishing: '1.000000'
@@ -167,7 +167,7 @@ We can run the demo by running the ``ros2 run demo_nodes_cpp talker_loaned_messa
167167
If the RMW implementation does not support loaned messages, all the messages will be allocated with the allocator instance provided by the publisher.
168168
We can try that by executing ``RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run demo_nodes_cpp talker_loaned_message``.
169169

170-
.. code-block:: bash
170+
.. code-block:: console
171171
172172
$ RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run demo_nodes_cpp talker_loaned_message
173173
[INFO] [1741064109.676860153] [rclcpp]: Currently used middleware cannot loan messages. Local allocator will be used.
@@ -198,37 +198,37 @@ You can set the environment variable with the following command:
198198

199199
.. code-block:: console
200200
201-
export ROS_DISABLE_LOANED_MESSAGES=1
201+
$ export ROS_DISABLE_LOANED_MESSAGES=1
202202
203203
To maintain this setting between shell sessions, you can add the command to your shell startup script:
204204

205205
.. code-block:: console
206206
207-
echo "export ROS_DISABLE_LOANED_MESSAGES=1" >> ~/.bashrc
207+
$ echo "export ROS_DISABLE_LOANED_MESSAGES=1" >> ~/.bashrc
208208
209209
.. group-tab:: macOS
210210

211211
.. code-block:: console
212212
213-
export ROS_DISABLE_LOANED_MESSAGES=1
213+
$ export ROS_DISABLE_LOANED_MESSAGES=1
214214
215215
To maintain this setting between shell sessions, you can add the command to your shell startup script:
216216

217217
.. code-block:: console
218218
219-
echo "export ROS_DISABLE_LOANED_MESSAGES=1" >> ~/.bash_profile
219+
$ echo "export ROS_DISABLE_LOANED_MESSAGES=1" >> ~/.bash_profile
220220
221221
.. group-tab:: Windows
222222

223223
.. code-block:: console
224224
225-
set ROS_DISABLE_LOANED_MESSAGES=1
225+
$ set ROS_DISABLE_LOANED_MESSAGES=1
226226
227227
If you want to make this permanent between shell sessions, also run:
228228

229229
.. code-block:: console
230230
231-
setx ROS_DISABLE_LOANED_MESSAGES 1
231+
$ setx ROS_DISABLE_LOANED_MESSAGES 1
232232
233233
234234
Subscriptions
@@ -244,34 +244,34 @@ To enable *Loaned Messages* on subscription, you need to set the environment var
244244

245245
.. code-block:: console
246246
247-
export ROS_DISABLE_LOANED_MESSAGES=0
247+
$ export ROS_DISABLE_LOANED_MESSAGES=0
248248
249249
To maintain this setting between shell sessions, you can add the command to your shell startup script:
250250

251251
.. code-block:: console
252252
253-
echo "export ROS_DISABLE_LOANED_MESSAGES=0" >> ~/.bashrc
253+
$ echo "export ROS_DISABLE_LOANED_MESSAGES=0" >> ~/.bashrc
254254
255255
.. group-tab:: macOS
256256

257257
.. code-block:: console
258258
259-
export ROS_DISABLE_LOANED_MESSAGES=0
259+
$ export ROS_DISABLE_LOANED_MESSAGES=0
260260
261261
To maintain this setting between shell sessions, you can add the command to your shell startup script:
262262

263263
.. code-block:: console
264264
265-
echo "export ROS_DISABLE_LOANED_MESSAGES=0" >> ~/.bash_profile
265+
$ echo "export ROS_DISABLE_LOANED_MESSAGES=0" >> ~/.bash_profile
266266
267267
.. group-tab:: Windows
268268

269269
.. code-block:: console
270270
271-
set ROS_DISABLE_LOANED_MESSAGES=0
271+
$ set ROS_DISABLE_LOANED_MESSAGES=0
272272
273273
If you want to make this permanent between shell sessions, also run:
274274

275275
.. code-block:: console
276276
277-
setx ROS_DISABLE_LOANED_MESSAGES 0
277+
$ setx ROS_DISABLE_LOANED_MESSAGES 0

source/How-To-Guides/DDS-tuning.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Reduce the value, for example, to 3s, by running:
4444

4545
.. code-block:: console
4646
47-
sudo sysctl net.ipv4.ipfrag_time=3
47+
$ sudo sysctl net.ipv4.ipfrag_time=3
4848
4949
Reducing this parameter's value also reduces the window of time where no fragments are received.
5050
The parameter is global for all incoming fragments, so the feasibility of reducing its value needs to be considered for every environment.
@@ -58,7 +58,7 @@ Increase the value, for example, to 128MB, by running:
5858

5959
.. code-block:: console
6060
61-
sudo sysctl net.ipv4.ipfrag_high_thresh=134217728 # (128 MB)
61+
$ sudo sysctl net.ipv4.ipfrag_high_thresh=134217728 # (128 MB)
6262
6363
Significantly increasing this parameter's value is an attempt to ensure that the buffer never becomes completely full.
6464
However, the value would likely have to be significantly high to hold all data received during the time window of ``ipfrag_time``, assuming every UDP packet lacks one fragment.
@@ -112,7 +112,7 @@ Set the maximum receive buffer size, ``rmem_max``, by running:
112112

113113
.. code-block:: console
114114
115-
sudo sysctl -w net.core.rmem_max=2147483647
115+
$ sudo sysctl -w net.core.rmem_max=2147483647
116116
117117
Or permanently set it by editing the ``/etc/sysctl.d/10-cyclone-max.conf`` file to contain:
118118

@@ -151,7 +151,7 @@ Set the maximum receive buffer size, ``rmem_max``, by running:
151151

152152
.. code-block:: console
153153
154-
sudo sysctl -w net.core.rmem_max=4194304
154+
$ sudo sysctl -w net.core.rmem_max=4194304
155155
156156
By tuning ``net.core.rmem_max`` to 4MB in the Linux kernel, the QoS profile can produce truly reliable behavior.
157157

source/How-To-Guides/Developing-a-ROS-2-Package.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Creating a package
2828

2929
All ROS 2 packages begin by running the command
3030

31-
.. code-block:: bash
31+
.. code-block:: console
3232
33-
ros2 pkg create --license Apache-2.0 <pkg-name> --dependencies [deps]
33+
$ ros2 pkg create --license Apache-2.0 <pkg-name> --dependencies [deps]
3434
3535
in your workspace (usually ``~/ros2_ws/src``).
3636

@@ -42,13 +42,13 @@ To create a package for a specific client library:
4242

4343
.. code-block:: bash
4444
45-
ros2 pkg create --build-type ament_cmake --license Apache-2.0 <pkg-name> --dependencies [deps]
45+
$ ros2 pkg create --build-type ament_cmake --license Apache-2.0 <pkg-name> --dependencies [deps]
4646
4747
.. group-tab:: Python
4848

4949
.. code-block:: bash
5050
51-
ros2 pkg create --build-type ament_python --license Apache-2.0 <pkg-name> --dependencies [deps]
51+
$ ros2 pkg create --build-type ament_python --license Apache-2.0 <pkg-name> --dependencies [deps]
5252
5353
You can then update the ``package.xml`` with your package info such as dependencies, descriptions, and authorship.
5454

source/How-To-Guides/Documenting-a-ROS-2-Package.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To generate the documentation for a package in HTML format with ``rosdoc2``, run
3838

3939
.. code-block:: console
4040
41-
rosdoc2 build --package-path <package-path>
41+
$ rosdoc2 build --package-path <package-path>
4242
4343
The documentation is written to ``docs_output/<package-name>/index.html`` and can be viewed in a browser.
4444

@@ -61,7 +61,7 @@ To generate a default ``rosdoc2.yaml`` which you can then further customize, run
6161

6262
.. code-block:: console
6363
64-
rosdoc2 default_config --package-path <package-path>
64+
$ rosdoc2 default_config --package-path <package-path>
6565
6666
And add ``<rosdoc2>rosdoc2.yaml</rosdoc2>`` to the export section in your ``package.xml``:
6767

source/How-To-Guides/Getting-Backtraces-in-ROS-2.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ Here's how to ensure your ROS2 code is ready for debugging:
9898

9999
- By using ``--cmake-args``: The easiest way to include debug symbols is by adding ``--cmake-args -DCMAKE_BUILD_TYPE=Debug`` to your ``colcon build`` command:
100100

101-
.. code-block:: bash
101+
.. code-block:: console
102102
103-
colcon build --packages-up-to <package_name> --cmake-args -DCMAKE_BUILD_TYPE=Debug
103+
$ colcon build --packages-up-to <package_name> --cmake-args -DCMAKE_BUILD_TYPE=Debug
104104
105105
- By editing ``CMakeLists.txt`` : Another way is to add ``-g`` to your compiler flags for the ROS package you want to profile / debug.
106106
This flag builds debug symbols that GDB can read to tell you specific lines of code in your project are failing and why.
@@ -115,7 +115,7 @@ However, since this is a ROS project with lots of node configurations and other
115115

116116
.. code-block:: bash
117117
118-
gdb ex run --args /path/to/exe/program
118+
$ gdb ex run --args /path/to/exe/program
119119
120120
Below are sections to describe the three major situations you could run into with ROS 2-based systems.
121121
Read the section that best describes the problem you're attempting to solve.
@@ -145,7 +145,7 @@ This allows us to use the same ``ros2 run`` syntax you're used to without having
145145

146146
.. code-block:: bash
147147
148-
ros2 run --prefix 'gdb -ex run --args' <pkg> <node> --all-other-launch arguments
148+
$ ros2 run --prefix 'gdb -ex run --args' <pkg> <node> --all-other-launch arguments
149149
150150
**The GDB Experience**
151151

@@ -321,29 +321,29 @@ Since the previous build type may be cached by CMake, clean the cache and rebuil
321321

322322
.. code-block:: console
323323
324-
colcon build --cmake-clean-cache --mixin debug
324+
$ colcon build --cmake-clean-cache --mixin debug
325325
326326
In order for GDB to load debug symbols for any shared libraries called, make sure to source your environment.
327327
This configures the value of ``LD_LIBRARY_PATH``.
328328

329329
.. code-block:: console
330330
331-
source install/setup.bash
331+
$ source install/setup.bash
332332
333333
Finally, run the test directly through GDB.
334334
For example:
335335

336336
.. code-block:: console
337337
338-
gdb -ex run ./build/rcl/test/test_logging
338+
$ gdb -ex run ./build/rcl/test/test_logging
339339
340340
If the code is throwing an unhandled exception, you can catch it in GDB before gtest handles it.
341341

342342
.. code-block:: console
343343
344-
gdb ./build/rcl/test/test_logging
345-
catch throw
346-
run
344+
$ gdb ./build/rcl/test/test_logging
345+
$ catch throw
346+
$ run
347347
348348
Automatic backtrace on crash
349349
----------------------------

0 commit comments

Comments
 (0)