[ros2 launch] launch file argument to python variable
Suppose I pass an argument to a launch file by ros2 launch file.launch.py arg:='temp'
. I'd like to pass this into a variable in the launch file such that I can use it, e.g.
def generate_launch_description():
arg = DeclareLaunchArgument("arg", default_value="temp")
output = arg.value + ".yaml"
The expectation is that, given the ros2 launch
call from before, output
becomes "temp.yaml"
. In essence I am looking for how to do this arg.value
part, I can't find anything in this direction online. I have an idea that I need to use substitutions but the documentation on how it works seems to be relatively limited.
Hi I have the same issue, did you find a solution without other to the
LaunchConfiguration
example provided by ChuiV