Performance: Setting parameters from launch file
This affects the startup time and configuration loading speed of ROS nodes during launch.
<launch> <param name="param1" value="precomputed_value"/> <node pkg="my_pkg" type="my_node" name="node1"/> </launch>
<launch> <node pkg="my_pkg" type="my_node" name="node1"> <param name="param1" value="$(eval expensive_function())"/> </node> </launch>
| Pattern | Launch Parsing Time | Parameter Server Calls | Node Startup Delay | Verdict |
|---|---|---|---|---|
| Dynamic eval in param value | High (100+ ms) | Multiple | High delay | [X] Bad |
| Static param set before node | Low (<10 ms) | Single | Minimal delay | [OK] Good |
<param> tags in a ROS launch file?robot_name to "R2D2" in a ROS launch file?<launch> <param name="speed" value="2.5" /> <node pkg="robot_pkg" type="move_node" name="mover" /> </launch>
speed parameter inside the move_node when it starts?<launch> <param name="use_sim" value=true /> <node pkg="sim_pkg" type="sim_node" name="simulator" /> </launch>
max_retries to 5 only if it is not already set by another launch file. Which launch file tag should you use to achieve this?Pass the test and this pattern moves unknown