23.ROS2 launch xml.yaml implementation

 

Continuing from the previous section, this section will explain how to use xml and yaml to write launch files.

1. xml implementation

1.1. Create a new launch file

Create a new file [complex_launch.xml] in the same directory as complex_launch.py and add the following content:

Note: This case will display the little turtle window. Before starting the program, please make sure that the docker GUI display is turned on, otherwise the little turtle window cannot be displayed

image-20231031153948268

1.2. xml configuration

image-20231031154138938

1.3. Compile workspace

1.4. Run the program

Terminal input:

Two little turtles will be displayed on the host's vnc

image-20231031154029697

 

2. Yaml implementation

2.1. Create a new launch file

Create a new file [complex_launch.yaml] in the same directory as complex_launch.py and add the following content:

Note: This case will display the little turtle window. Before starting the program, please make sure that the docker GUI display is turned on, otherwise the little turtle window cannot be displayed

image-20231031154616217

2.2. xml configuration

image-20231031154554801

2.3. Compile workspace

2.4. Run the program

Terminal input:

Two little turtles will be displayed on the host's vnc

image-20231031154508968