What is the purpose of setting parameters in a ROS launch file?
Setting parameters in a ROS launch file allows you to configure nodes with specific values before they start. This helps customize node behavior without changing the code.
Click to reveal answer
beginner
How do you set a parameter named robot_speed to 1.5 in a ROS launch file?
You use the <param name="robot_speed" value="1.5" /> tag inside the launch file to set the parameter before nodes start.
Click to reveal answer
intermediate
What is the difference between param and rosparam tags in ROS launch files?
<param> sets simple parameters like numbers or strings. <rosparam> can load complex data like dictionaries or lists from YAML files or inline YAML.
Click to reveal answer
intermediate
Can parameters set in a launch file be changed while the node is running?
Parameters set in a launch file are loaded at node start. To change them while running, you need to use dynamic reconfigure or set parameters manually using command line or code.
Click to reveal answer
beginner
Why is it useful to set parameters in a launch file instead of hardcoding them in the node code?
Setting parameters in a launch file makes your nodes flexible and reusable. You can change behavior without editing code, which is easier and safer for testing and deployment.
Click to reveal answer
Which tag is used to set a simple parameter in a ROS launch file?
A<rosparam>
B<include>
C<node>
D<param>
✗ Incorrect
The tag sets simple parameters like numbers or strings in a launch file.
How do you load a YAML file with parameters in a ROS launch file?
A<rosparam file="params.yaml" />
B<include file="params.yaml" />
C<node params="params.yaml" />
D<param file="params.yaml" />
✗ Incorrect
The tag with the file attribute loads parameters from a YAML file.
If you want to set a parameter named 'max_speed' to 2.0, which is correct?
A<param max_speed="2.0" />
B<param name="max_speed" value="2.0" />
C<rosparam name="max_speed" value="2.0" />
D<param name="max_speed">2.0</param>
✗ Incorrect
The correct syntax uses .
Can parameters set in a launch file be accessed by nodes after they start?
AYes, nodes can read parameters from the parameter server anytime.
BNo, parameters are only available during launch.
COnly if the node is restarted.
DOnly if parameters are hardcoded in the node.
✗ Incorrect
Parameters set in launch files are stored on the parameter server and can be accessed anytime by nodes.
What is a benefit of using <rosparam> over <param> in launch files?
A<rosparam> automatically restarts nodes.
B<rosparam> is faster to load parameters.
C<rosparam> can load complex data like lists and dictionaries.
D<rosparam> is deprecated.
✗ Incorrect
supports loading complex YAML data structures, unlike .
Explain how to set a parameter in a ROS launch file and why it is useful.
Think about how launch files help customize nodes without code changes.
You got /4 concepts.
Describe the difference between and tags in ROS launch files.
Consider the type of data each tag can handle.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using <param> tags in a ROS launch file?
easy
A. To start multiple nodes at the same time
B. To set parameters that nodes can use when they start
C. To define the order in which nodes run
D. To stop nodes after they finish
Solution
Step 1: Understand the role of <param> in launch files
The <param> tag is used to set parameters that nodes read when they start running.
Step 2: Differentiate from other launch file tags
Tags like <node> start nodes, but <param> specifically sets values nodes use.
Final Answer:
To set parameters that nodes can use when they start -> Option B
A. The value true should be in quotes: value="true"
B. The param tag should be inside the node tag
C. The node tag is missing the required args attribute
D. The launch tag is missing a closing slash
Solution
Step 1: Check the value attribute format
Boolean values in <param> tags must be strings, so true should be "true" in quotes.
Step 2: Verify tag placement and syntax
The <param> tag can be outside the <node> tag, and the <launch> tag is correctly closed.
Final Answer:
The value true should be in quotes: value="true" -> Option A
Quick Check:
Boolean values need quotes in <param> = C [OK]
Hint: Always put boolean values in quotes in <param> tags [OK]
Common Mistakes:
Leaving boolean values unquoted
Placing <param> tags only inside <node>
Misunderstanding launch tag syntax
5. You want to set a parameter 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?
hard
A.
B. 5
C.
D.
Solution
Step 1: Understand conditional parameter setting
The <param> tag supports the 'unless' attribute to set a parameter only if it is not already set.
Step 2: Check the options for correct usage
<param unless="max_retries" name="max_retries" value="5" /> uses 'unless="max_retries"' with name and value, which is the correct syntax.
Final Answer:
<param unless="max_retries" name="max_retries" value="5" /> -> Option A
Quick Check:
Use 'unless' attribute to avoid overwriting = A [OK]
Hint: Use 'unless' attribute to set param only if unset [OK]
Common Mistakes:
Omitting the 'name' attribute when using 'unless'
Using <rosparam> without condition
Misplacing 'unless' attribute
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.