Skip to content

Commit

Permalink
added group tabs for launch in using cpp parameters (ros2#690)
Browse files Browse the repository at this point in the history
* added group tabs for launch

* fixed indentation

Signed-off-by: maryaB-osr <[email protected]>

Co-authored-by: maryaB-osr <[email protected]>
  • Loading branch information
peterpena and maryaB-osr committed May 14, 2020
1 parent a1b3eb3 commit 07408a5
Showing 1 changed file with 43 additions and 18 deletions.
61 changes: 43 additions & 18 deletions source/Tutorials/Using-Parameters-In-A-Class-CPP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,24 +241,49 @@ You can also set the parameter in a launch file, but first you will need to add
Inside the ``dev_ws/src/cpp_parameters/`` directory, create a new directory called ``launch``.
In there, create a new file called ``cpp_parameters_launch.py``

.. code-block:: Python
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package="cpp_parameters",
node_executable="parameter_node",
node_name="custom_parameter_node",
output="screen",
emulate_tty=True,
parameters=[
{"my_parameter": "earth"}
]
)
])
.. tabs::

.. group-tab:: Foxy and newer

.. code-block:: Python
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package="cpp_parameters",
executable="parameter_node",
name="custom_parameter_node",
output="screen",
emulate_tty=True,
parameters=[
{"my_parameter": "earth"}
]
)
])
.. group-tab:: Before Foxy

.. code-block:: Python
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package="cpp_parameters",
node_executable="parameter_node",
node_name="custom_parameter_node",
output="screen",
emulate_tty=True,
parameters=[
{"my_parameter": "earth"}
]
)
])
Here you can see that we set ``my_parameter`` to ``earth`` when we launch our node ``parameter_node``.
By adding the two lines below, we ensure our output is printed in our console.
Expand Down

0 comments on commit 07408a5

Please sign in to comment.