Challenge - 5 Problems
ROS 2 Launch Parameter Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat is the value of the parameter
robot_speed inside the node after launch?Given this ROS 2 launch file snippet, what will be the value of the parameter
robot_speed inside the node when it starts?<launch>
<node pkg="my_robot" exec="controller" name="robot_controller">
<param name="robot_speed" value="2.5" />
</node>
</launch>ROS
<launch> <node pkg="my_robot" exec="controller" name="robot_controller"> <param name="robot_speed" value="2.5" /> </node> </launch>
Attempts:
2 left
💡 Hint
Look at the tag inside the element.
✗ Incorrect
The tag inside the element sets the parameter 'robot_speed' to 2.5 for that node at launch time.
📝 Syntax
intermediateWhich launch file snippet correctly sets a boolean parameter
use_lidar to true?Choose the correct XML snippet to set the boolean parameter
use_lidar to true in a ROS 2 launch file.Attempts:
2 left
💡 Hint
ROS 2 parameters use lowercase true/false for booleans in launch files.
✗ Incorrect
In ROS 2 launch files, boolean parameters are set using lowercase 'true' or 'false' strings. Other values like 'True', '1', or 'yes' are not recognized as booleans.
🔧 Debug
advancedWhat error occurs when this launch file tries to set a parameter with missing
value attribute?Examine this launch file snippet:
What error will ROS 2 raise when launching this?
<launch>
<node pkg="sensor_pkg" exec="sensor_node" name="sensor">
<param name="sensor_enabled" />
</node>
</launch>What error will ROS 2 raise when launching this?
ROS
<launch> <node pkg="sensor_pkg" exec="sensor_node" name="sensor"> <param name="sensor_enabled" /> </node> </launch>
Attempts:
2 left
💡 Hint
Check if tags require a value attribute.
✗ Incorrect
The tag must include a 'value' attribute. Omitting it causes a launch file parsing error.
❓ state_output
advancedWhat is the final value of parameter
max_range if set twice in the launch file?Consider this launch file snippet:
What value will the node receive for
<launch>
<node pkg="mapping" exec="mapper" name="mapper">
<param name="max_range" value="10.0" />
<param name="max_range" value="15.0" />
</node>
</launch>What value will the node receive for
max_range?ROS
<launch> <node pkg="mapping" exec="mapper" name="mapper"> <param name="max_range" value="10.0" /> <param name="max_range" value="15.0" /> </node> </launch>
Attempts:
2 left
💡 Hint
Later parameter definitions override earlier ones.
✗ Incorrect
When the same parameter is set multiple times in a launch file, the last value takes precedence.
🧠 Conceptual
expertWhich statement about setting parameters from a ROS 2 launch file is TRUE?
Select the correct statement about how parameters are set from a ROS 2 launch file.
Attempts:
2 left
💡 Hint
Think about how launch files configure nodes at startup.
✗ Incorrect
Launch files can set parameters that override the node's default values at startup, allowing flexible configuration.
