Performance: Launch file XML syntax
This affects the startup time and resource usage of ROS nodes by how efficiently the launch file is parsed and executed.
<launch>
<group>
<node pkg="pkg1" type="node1" name="node1"/>
<node pkg="pkg1" type="node2" name="node2"/>
<param name="param1" value="value1"/>
<param name="param2" value="value2"/>
<param name="param3" value="value3"/>
</group>
</launch><launch> <node pkg="pkg1" type="node1" name="node1"/> <node pkg="pkg1" type="node2" name="node2"/> <param name="param1" value="value1"/> <param name="param2" value="value2"/> <param name="param3" value="value3"/> </launch>
| Pattern | XML Parsing Steps | Node Startup Delay | File Size Impact | Verdict |
|---|---|---|---|---|
| Flat repeated tags | Many separate parsing steps | Higher delay due to parsing overhead | Minimal but cluttered | [X] Bad |
| Grouped tags with <group> | Fewer parsing steps | Lower delay, faster startup | Slightly smaller and cleaner | [OK] Good |
<launch> file in ROS?pkg, type, and name inside a <node> tag.<launch> <node pkg="turtlesim" type="turtlesim_node" name="sim" /> <param name="background_r" value="255" /> </launch>
<param> tag outside <node> sets a global parameter, not specific to the node.background_r is not recognized globally by turtlesim, so it uses default background color.<launch> <node pkg="demo_pkg" type="demo_node" name="demo"> </launch>
<node> tag is opened but not closed properly (no closing tag or self-closing slash).<launch> tag is properly closed.camera.launch inside your main launch file to start its nodes as well?<include> tag uses the attribute file to specify the file path.$(find package_name)/launch/filename.launch with file attribute.file and the proper path syntax with $(find ...).Pass the test and this pattern moves unknown