diff --git a/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst b/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst index 1b3c208e07f..2929a621ea9 100644 --- a/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst +++ b/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst @@ -182,18 +182,48 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e ~~~~~~~~~~~~~~~~~~~~~~~~~ Now let's create a launch file for this example. -With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory, and add the following lines: +With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_cpp/launch`` directory, and add the following lines: -.. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.yaml + :language: yaml This launch file imports the required packages and then creates a ``demo_nodes`` variable that will store nodes that we created in the previous tutorial's launch file. The last part of the code will add our fixed ``carrot1`` frame to the turtlesim world using our ``fixed_frame_tf2_broadcaster`` node. -.. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.py - :language: python - :lines: 14-18 +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.py + :language: python + :lines: 14-18 + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.xml + :language: xml + :lines: 3-4 + + .. group-tab:: YAML + + .. literalinclude:: launch/turtle_tf2_fixed_frame_demo_launch.yaml + :language: yaml + :lines: 6-9 1.4 Build ~~~~~~~~~ @@ -275,7 +305,7 @@ Now you can start the turtle broadcaster demo: .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.xml # .py or .yaml are also acceptable You should notice that the new ``carrot1`` frame appeared in the transformation tree. @@ -290,7 +320,7 @@ One way is to pass the ``target_frame`` argument to the launch file directly fro .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.py target_frame:=carrot1 + $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.xml target_frame:=carrot1 # .py or .yaml are also acceptable The second way is to update the launch file. To do so, open the ``turtle_tf2_fixed_frame_demo_launch.py`` file, and add the ``'target_frame': 'carrot1'`` parameter via ``launch_arguments`` argument. @@ -442,10 +472,24 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e 2.3 Write the launch file ~~~~~~~~~~~~~~~~~~~~~~~~~ -To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory and paste the following code: +To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_cpp/launch`` directory and paste the following code: + +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_dynamic_frame_demo_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_dynamic_frame_demo_launch.xml + :language: xml + + .. group-tab:: YAML -.. literalinclude:: launch/turtle_tf2_dynamic_frame_demo_launch.py - :language: python + .. literalinclude:: launch/turtle_tf2_dynamic_frame_demo_launch.yaml + :language: yaml 2.4 Build @@ -528,7 +572,7 @@ Now you can start the dynamic frame demo: .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_dynamic_frame_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_dynamic_frame_demo_launch.xml # .py or .yaml are also acceptable You should see that the second turtle is following the carrot's position that is constantly changing. diff --git a/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst b/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst index 6500386b432..112db8990a3 100644 --- a/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst +++ b/source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst @@ -159,19 +159,49 @@ Add the following line between the ``'console_scripts':`` brackets: ~~~~~~~~~~~~~~~~~~~~~~~~~ Now let's create a launch file for this example. -With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory, and add the following lines: +With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_py/launch`` directory, and add the following lines: -.. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.py - :name: turtle_tf2_fixed_frame_demo_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.py + :name: turtle_tf2_fixed_frame_demo_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.yaml + :language: yaml This launch file imports the required packages and then creates a ``demo_nodes`` variable that will store nodes that we created in the previous tutorial's launch file. The last part of the code will add our fixed ``carrot1`` frame to the turtlesim world using our ``fixed_frame_tf2_broadcaster`` node. -.. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.py - :language: python - :lines: 14-18 +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.py + :language: python + :lines: 14-18 + + .. group-tab:: XML + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.xml + :language: xml + :lines: 3-4 + + .. group-tab:: YAML + + .. literalinclude:: launch/py_turtle_tf2_fixed_frame_demo_launch.yaml + :language: yaml + :lines: 6-9 1.4 Build ~~~~~~~~~ @@ -253,7 +283,7 @@ Now you can start the turtle broadcaster demo: .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_fixed_frame_demo_launch.py + $ ros2 launch learning_tf2_py turtle_tf2_fixed_frame_demo_launch.xml # .py or .yaml are also acceptable You should notice that the new ``carrot1`` frame appeared in the transformation tree. @@ -268,7 +298,7 @@ One way is to pass the ``target_frame`` argument to the launch file directly fro .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_fixed_frame_demo_launch.py target_frame:=carrot1 + $ ros2 launch learning_tf2_py turtle_tf2_fixed_frame_demo_launch.xml target_frame:=carrot1 # .py or .yaml are also acceptable The second way is to update the launch file. To do so, open the ``turtle_tf2_fixed_frame_demo_launch.py`` file, and add the ``'target_frame': 'carrot1'`` parameter via ``launch_arguments`` argument. @@ -398,10 +428,24 @@ Add the following line between the ``'console_scripts':`` brackets: 2.3 Write the launch file ~~~~~~~~~~~~~~~~~~~~~~~~~ -To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory and paste the following code: +To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_py/launch`` directory and paste the following code: + +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/py_turtle_tf2_dynamic_frame_demo_launch.py + :name: turtle_tf2_dynamic_frame_demo_launch.py + + .. group-tab:: XML + + .. literalinclude:: launch/py_turtle_tf2_dynamic_frame_demo_launch.xml + :language: xml + + .. group-tab:: YAML -.. literalinclude:: launch/py_turtle_tf2_dynamic_frame_demo_launch.py - :name: turtle_tf2_dynamic_frame_demo_launch.py + .. literalinclude:: launch/py_turtle_tf2_dynamic_frame_demo_launch.yaml + :language: yaml 2.4 Build @@ -485,7 +529,7 @@ Now you can start the dynamic frame demo: .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_dynamic_frame_demo_launch.py + $ ros2 launch learning_tf2_py turtle_tf2_dynamic_frame_demo_launch.xml # .py or .yaml are also acceptable You should see that the second turtle is following the carrot's position that is constantly changing. diff --git a/source/Tutorials/Intermediate/Tf2/Debugging-Tf2-Problems.rst b/source/Tutorials/Intermediate/Tf2/Debugging-Tf2-Problems.rst index 3d249218db8..841fcaa30e0 100644 --- a/source/Tutorials/Intermediate/Tf2/Debugging-Tf2-Problems.rst +++ b/source/Tutorials/Intermediate/Tf2/Debugging-Tf2-Problems.rst @@ -70,10 +70,24 @@ to } catch (const tf2::TransformException & ex) { And save changes to the file. -In order to run this demo, we need to create a launch file ``start_tf2_debug_demo_launch.py`` in the ``launch`` subdirectory of package ``learning_tf2_cpp``: +In order to run this demo, we need to create a launch file ``start_tf2_debug_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``launch`` subdirectory of package ``learning_tf2_cpp``: -.. literalinclude:: launch/start_tf2_debug_demo_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/start_tf2_debug_demo_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/start_tf2_debug_demo_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/start_tf2_debug_demo_launch.yaml + :language: yaml Don't forget to add the ``turtle_tf2_listener_debug`` executable to the ``CMakeLists.txt`` and build the package. @@ -81,7 +95,7 @@ Now let's run it to see what happens: .. code-block:: console - $ ros2 launch learning_tf2_cpp start_tf2_debug_demo_launch.py + $ ros2 launch learning_tf2_cpp start_tf2_debug_demo_launch.xml # .py or .yaml are also acceptable You will now see that the turtlesim came up. At the same time, if you run the ``turtle_teleop_key`` in another terminal window, you can use the arrow keys to drive the ``turtle1`` around. @@ -155,7 +169,7 @@ And now stop the running demo, build it, and run it again: .. code-block:: console - $ ros2 launch learning_tf2_cpp start_tf2_debug_demo_launch.py + $ ros2 launch learning_tf2_cpp start_tf2_debug_demo_launch.xml # .py or .yaml are also acceptable [turtle_tf2_listener_debug-4] [INFO] [1630223704.617382464] [listener_debug]: Could not transform turtle2 to turtle1: Lookup would require extrapolation into the future. Requested time 1630223704.617054 but the latest data is at time 1630223704.616726, when looking up @@ -203,7 +217,7 @@ Stop the demo, build and run: .. code-block:: console - $ ros2 launch turtle_tf2 start_tf2_debug_demo_launch.py + $ ros2 launch turtle_tf2 start_tf2_debug_demo_launch.xml # .py or .yaml are also acceptable And you should finally see the turtle move! diff --git a/source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp.rst b/source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp.rst index f2ab0f42e66..840a1eddb50 100644 --- a/source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp.rst +++ b/source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp.rst @@ -70,7 +70,7 @@ Now build the package and try to run the launch file. .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable [INFO] [1629873136.345688064] [listener]: Could not transform turtle2 to turtle1: Lookup would require extrapolation into the future. Requested time 1629873136.345539 but the latest data is at time 1629873136.338804, when looking up transform from frame [turtle1] to frame [turtle2] @@ -110,7 +110,7 @@ You can now build the package and run the launch file. .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable You should notice that ``lookupTransform()`` will actually block until the transform between the two turtles becomes available (this will usually take a few milliseconds). Once the timeout has been reached (fifty milliseconds in this case), an exception will be raised only if the transform is still not available. diff --git a/source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp.rst b/source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp.rst index c6696056426..5b6f27112d4 100644 --- a/source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp.rst +++ b/source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp.rst @@ -53,7 +53,7 @@ Build the package then let's just give it a try: .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.xml # .py or .yaml are also acceptable .. image:: images/turtlesim_delay1.png @@ -112,7 +112,7 @@ Build the package then let's run the simulation again, this time with the advanc .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_fixed_frame_demo_launch.xml # .py or .yaml are also acceptable .. image:: images/turtlesim_delay2.png diff --git a/source/Tutorials/Intermediate/Tf2/Using-Stamped-Datatypes-With-Tf2-Ros-MessageFilter.rst b/source/Tutorials/Intermediate/Tf2/Using-Stamped-Datatypes-With-Tf2-Ros-MessageFilter.rst index 64e5e0474a9..7f0747e355f 100644 --- a/source/Tutorials/Intermediate/Tf2/Using-Stamped-Datatypes-With-Tf2-Ros-MessageFilter.rst +++ b/source/Tutorials/Intermediate/Tf2/Using-Stamped-Datatypes-With-Tf2-Ros-MessageFilter.rst @@ -233,10 +233,24 @@ Then we fill up the ``PointStamped`` messages of ``turtle3`` with incoming ``Pos 1.2 Write the launch file ~~~~~~~~~~~~~~~~~~~~~~~~~ -In order to run this demo, we need to create a launch file ``turtle_tf2_sensor_message_launch.py`` in the ``launch`` subdirectory of package ``learning_tf2_py``: +In order to run this demo, we need to create a launch file ``turtle_tf2_sensor_message_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``launch`` subdirectory of package ``learning_tf2_py``: -.. literalinclude:: launch/turtle_tf2_sensor_message_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_sensor_message_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_sensor_message_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/turtle_tf2_sensor_message_launch.yaml + :language: yaml 1.3 Add an entry point @@ -669,11 +683,11 @@ Open a new terminal, navigate to the root of your workspace, and source the setu 3 Run ^^^^^ -First we need to run several nodes (including the broadcaster node of PointStamped messages) by launching the launch file ``turtle_tf2_sensor_message_launch.py``: +First we need to run several nodes (including the broadcaster node of PointStamped messages) by launching the launch file ``turtle_tf2_sensor_message_launch``: .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_sensor_message_launch.py + $ ros2 launch learning_tf2_py turtle_tf2_sensor_message_launch.xml # .py or .yaml are also acceptable This will bring up the ``turtlesim`` window with two turtles, where ``turtle3`` is moving along a circle, while ``turtle1`` isn't moving at first. But you can run the ``turtle_teleop_key`` node in another terminal to drive ``turtle1`` to move: diff --git a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst index a988ead3231..1b4c80f82f9 100644 --- a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst +++ b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst @@ -247,26 +247,79 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e Now create a launch file for this demo. Create a ``launch`` folder in the ``src/learning_tf2_cpp`` directory. -With your text editor, create a new file called ``turtle_tf2_demo_launch.py`` in the ``launch`` folder, and add the following lines: +With your text editor, create a new file called ``turtle_tf2_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``launch`` folder, and add the following lines: -.. literalinclude:: launch/turtle_tf2_demo_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_demo_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_demo_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/turtle_tf2_demo_launch.yaml + :language: yaml 2.1 Examine the code ~~~~~~~~~~~~~~~~~~~~ -First we import required modules from the ``launch`` and ``launch_ros`` packages. -It should be noted that ``launch`` is a generic launching framework (not ROS 2 specific) and ``launch_ros`` has ROS 2 specific things, like nodes that we import here. +Let's examine the launch file structure. +Each format has its own way of setting up the launch file: + +.. tabs:: + + .. group-tab:: Python + + In Python launch files, we first import required modules from the ``launch`` and ``launch_ros`` packages. + It should be noted that ``launch`` is a generic launching framework (not ROS 2 specific) and ``launch_ros`` has ROS 2 specific things, like nodes that we import here. + + .. literalinclude:: launch/turtle_tf2_demo_launch.py + :language: python + :lines: 1-2 -.. literalinclude:: launch/turtle_tf2_demo_launch.py - :language: python - :lines: 1-2 + .. group-tab:: XML + + XML launch files start with an XML declaration and a root ```` element. + + .. literalinclude:: launch/turtle_tf2_demo_launch.xml + :language: xml + :lines: 1-2 + + .. group-tab:: YAML + + YAML launch files start with a YAML version declaration and a ``launch:`` key. + + .. literalinclude:: launch/turtle_tf2_demo_launch.yaml + :language: yaml + :lines: 1-3 Now we run our nodes that start the turtlesim simulation and broadcast ``turtle1`` state to the tf2 using our ``turtle_tf2_broadcaster`` node. -.. literalinclude:: launch/turtle_tf2_demo_launch.py - :language: python - :lines: 7-19 +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/turtle_tf2_demo_launch.py + :language: python + :lines: 7-19 + + .. group-tab:: XML + + .. literalinclude:: launch/turtle_tf2_demo_launch.xml + :language: xml + :lines: 3-6 + + .. group-tab:: YAML + + .. literalinclude:: launch/turtle_tf2_demo_launch.yaml + :language: yaml + :lines: 4-9 2.2 Add dependencies ~~~~~~~~~~~~~~~~~~~~ @@ -377,7 +430,7 @@ Now run the launch file that will start the turtlesim simulation node and ``turt .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable In the second terminal window type the following command: diff --git a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Py.rst b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Py.rst index bb89775898c..616ac898838 100644 --- a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Py.rst +++ b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Py.rst @@ -252,28 +252,81 @@ Add the following line between the ``'console_scripts':`` brackets: Now create a launch file for this demo. Create a ``launch`` folder in the ``src/learning_tf2_py`` directory. -With your text editor, create a new file called ``turtle_tf2_demo_launch.py`` in the ``launch`` folder, and add the following lines: +With your text editor, create a new file called ``turtle_tf2_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``launch`` folder, and add the following lines: -.. literalinclude:: launch/py_turtle_tf2_demo_launch.py - :language: python - :name: turtle_tf2_demo_launch.py +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.py + :language: python + :name: turtle_tf2_demo_launch.py + + .. group-tab:: XML + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.yaml + :language: yaml 2.1 Examine the code ~~~~~~~~~~~~~~~~~~~~ -First we import required modules from the ``launch`` and ``launch_ros`` packages. -It should be noted that ``launch`` is a generic launching framework (not ROS 2 specific) and ``launch_ros`` has ROS 2 specific things, like nodes that we import here. +Let's examine the launch file structure. +Each format has its own way of setting up the launch file: + +.. tabs:: + + .. group-tab:: Python + + In Python launch files, we first import required modules from the ``launch`` and ``launch_ros`` packages. + It should be noted that ``launch`` is a generic launching framework (not ROS 2 specific) and ``launch_ros`` has ROS 2 specific things, like nodes that we import here. + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.py + :language: python + :lines: 1-2 -.. literalinclude:: launch/py_turtle_tf2_demo_launch.py - :language: python - :lines: 1-2 + .. group-tab:: XML + + XML launch files start with an XML declaration and a root ```` element. + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.xml + :language: xml + :lines: 1-2 + + .. group-tab:: YAML + + YAML launch files start with a YAML version declaration and a ``launch:`` key. + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.yaml + :language: yaml + :lines: 1-3 Now we run our nodes that start the turtlesim simulation and broadcast ``turtle1`` state to the tf2 using our ``turtle_tf2_broadcaster`` node. -.. literalinclude:: launch/py_turtle_tf2_demo_launch.py - :language: python - :lines: 7-19 +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.py + :language: python + :lines: 7-19 + + .. group-tab:: XML + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.xml + :language: xml + :lines: 3-6 + + .. group-tab:: YAML + + .. literalinclude:: launch/py_turtle_tf2_demo_launch.yaml + :language: yaml + :lines: 4-9 2.2 Add dependencies ~~~~~~~~~~~~~~~~~~~~ @@ -395,7 +448,7 @@ Now run the launch file that will start the turtlesim simulation node and ``turt .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_py turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable In the second terminal window type the following command: diff --git a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst index f1c01bb19d8..49a5b8f18db 100644 --- a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst +++ b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst @@ -278,11 +278,25 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e 2 Update the launch file ^^^^^^^^^^^^^^^^^^^^^^^^ -Open the launch file called ``turtle_tf2_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports. +Open the launch file called ``turtle_tf2_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_cpp/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports. The resulting file should look like: -.. literalinclude:: launch/listener_cpp_launch.py - :language: python +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/listener_cpp_launch.py + :language: python + + .. group-tab:: XML + + .. literalinclude:: launch/listener_cpp_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/listener_cpp_launch.yaml + :language: yaml This will declare a ``target_frame`` launch argument, start a broadcaster for the second turtle that we will spawn and a listener that will subscribe to those transformations. @@ -366,7 +380,7 @@ Now you're ready to start your full turtle demo: .. code-block:: console - $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_cpp turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable You should see the turtle sim with two turtles. In the second terminal window type the following command: diff --git a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Py.rst b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Py.rst index 72bc186cc24..d519284277b 100644 --- a/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Py.rst +++ b/source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Py.rst @@ -227,12 +227,26 @@ Add the following line between the ``'console_scripts':`` brackets: 2 Update the launch file ^^^^^^^^^^^^^^^^^^^^^^^^ -Open the launch file called ``turtle_tf2_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports. +Open the launch file called ``turtle_tf2_demo_launch`` with extension ``.py``, ``.xml``, or ``.yaml`` in the ``src/learning_tf2_py/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports. The resulting file should look like: -.. literalinclude:: launch/listener_py_launch.py - :language: python - :name: turtle_tf2_demo_launch.py +.. tabs:: + + .. group-tab:: Python + + .. literalinclude:: launch/listener_py_launch.py + :language: python + :name: turtle_tf2_demo_launch.py + + .. group-tab:: XML + + .. literalinclude:: launch/listener_py_launch.xml + :language: xml + + .. group-tab:: YAML + + .. literalinclude:: launch/listener_py_launch.yaml + :language: yaml This will declare a ``target_frame`` launch argument, start a broadcaster for second turtle that we will spawn and listener that will subscribe to those transformations. @@ -318,7 +332,7 @@ Now you're ready to start your full turtle demo: .. code-block:: console - $ ros2 launch learning_tf2_py turtle_tf2_demo_launch.py + $ ros2 launch learning_tf2_py turtle_tf2_demo_launch.xml # .py or .yaml are also acceptable You should see the turtle sim with two turtles. In the second terminal window type the following command: diff --git a/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.xml new file mode 100644 index 00000000000..126c361af60 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.yaml new file mode 100644 index 00000000000..71f70ad4d78 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/listener_cpp_launch.yaml @@ -0,0 +1,33 @@ +%YAML 1.2 +--- +launch: + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + - arg: + name: "target_frame" + default: "turtle1" + description: "Target frame name." + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_broadcaster" + name: "broadcaster2" + param: + - name: "turtlename" + value: "turtle2" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_listener" + name: "listener" + param: + - name: "target_frame" + value: "$(var target_frame)" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.xml new file mode 100644 index 00000000000..afe5e5b657f --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.yaml new file mode 100644 index 00000000000..24d82cfd7ce --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/listener_py_launch.yaml @@ -0,0 +1,33 @@ +%YAML 1.2 +--- +launch: + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + - node: + pkg: "learning_tf2_py" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + - arg: + name: "target_frame" + default: "turtle1" + description: "Target frame name." + - node: + pkg: "learning_tf2_py" + exec: "turtle_tf2_broadcaster" + name: "broadcaster2" + param: + - name: "turtlename" + value: "turtle2" + - node: + pkg: "learning_tf2_py" + exec: "turtle_tf2_listener" + name: "listener" + param: + - name: "target_frame" + value: "$(var target_frame)" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.xml new file mode 100644 index 00000000000..61708e5ea10 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.yaml new file mode 100644 index 00000000000..994412c6b6c --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_demo_launch.yaml @@ -0,0 +1,15 @@ +%YAML 1.2 +--- +launch: + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + - node: + pkg: "learning_tf2_py" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.xml new file mode 100644 index 00000000000..bf45551a526 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.yaml new file mode 100644 index 00000000000..cda623faf3e --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_dynamic_frame_demo_launch.yaml @@ -0,0 +1,13 @@ +%YAML 1.2 +--- +launch: + - include: + file: "$(find-pkg-share learning_tf2_py)/launch/turtle_tf2_demo_launch.py" + let: + - name: "target_frame" + value: "carrot1" + - node: + pkg: "learning_tf2_py" + exec: "dynamic_frame_tf2_broadcaster" + name: "dynamic_broadcaster" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.xml new file mode 100644 index 00000000000..26a0084fd14 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.yaml new file mode 100644 index 00000000000..3f5f99257a9 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/py_turtle_tf2_fixed_frame_demo_launch.yaml @@ -0,0 +1,10 @@ +%YAML 1.2 +--- +launch: + - include: + file: "$(find-pkg-share learning_tf2_py)/launch/turtle_tf2_demo_launch.py" + - node: + pkg: "learning_tf2_py" + exec: "fixed_frame_tf2_broadcaster" + name: "fixed_broadcaster" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.xml new file mode 100644 index 00000000000..bd5eee3ee96 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.yaml new file mode 100644 index 00000000000..77ead6a6d4b --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/start_tf2_debug_demo_launch.yaml @@ -0,0 +1,34 @@ +%YAML 1.2 +--- +launch: + - arg: + name: "target_frame" + default: "turtle1" + description: "Target frame name." + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + output: "screen" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_broadcaster" + name: "broadcaster2" + param: + - name: "turtlename" + value: "turtle2" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_listener_debug" + name: "listener_debug" + param: + - name: "target_frame" + value: "$(var target_frame)" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.xml new file mode 100644 index 00000000000..fadafacea89 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.yaml new file mode 100644 index 00000000000..519f0987706 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_demo_launch.yaml @@ -0,0 +1,15 @@ +%YAML 1.2 +--- +launch: + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + - node: + pkg: "learning_tf2_cpp" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.xml new file mode 100644 index 00000000000..03ae056c2c0 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.yaml new file mode 100644 index 00000000000..a8082e31ca4 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_dynamic_frame_demo_launch.yaml @@ -0,0 +1,13 @@ +%YAML 1.2 +--- +launch: + - include: + file: "$(find-pkg-share learning_tf2_cpp)/launch/turtle_tf2_demo_launch.py" + let: + - name: "target_frame" + value: "carrot1" + - node: + pkg: "learning_tf2_cpp" + exec: "dynamic_frame_tf2_broadcaster" + name: "dynamic_broadcaster" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.xml new file mode 100644 index 00000000000..0bef8375a29 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.yaml new file mode 100644 index 00000000000..d150f91c510 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_fixed_frame_demo_launch.yaml @@ -0,0 +1,10 @@ +%YAML 1.2 +--- +launch: + - include: + file: "$(find-pkg-share learning_tf2_cpp)/launch/turtle_tf2_demo_launch.py" + - node: + pkg: "learning_tf2_cpp" + exec: "fixed_frame_tf2_broadcaster" + name: "fixed_broadcaster" + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.xml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.xml new file mode 100644 index 00000000000..fcb5eb62cf3 --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.yaml b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.yaml new file mode 100644 index 00000000000..504fe499dda --- /dev/null +++ b/source/Tutorials/Intermediate/Tf2/launch/turtle_tf2_sensor_message_launch.yaml @@ -0,0 +1,31 @@ +%YAML 1.2 +--- +launch: + - arg: + name: "target_frame" + default: "turtle1" + description: "Target frame name." + - node: + pkg: "turtlesim" + exec: "turtlesim_node" + name: "sim" + output: "screen" + - node: + pkg: "turtle_tf2_py" + exec: "turtle_tf2_broadcaster" + name: "broadcaster1" + param: + - name: "turtlename" + value: "turtle1" + - node: + pkg: "turtle_tf2_py" + exec: "turtle_tf2_broadcaster" + name: "broadcaster2" + param: + - name: "turtlename" + value: "turtle3" + - node: + pkg: "turtle_tf2_py" + exec: "turtle_tf2_message_broadcaster" + name: "message_broadcaster" +