Access launch argument in LaunchFile ROS2
Hi,
I've been trying to Use my Launch Arguments inside of my Launch File for further purposes. So I can declare it by using launch.actions.DeclareLaunchArgument( 'param1', default_value="defaultString")
and access it later using launch.substitutions.LaunchConfiguration( 'param1')
to pass it to a node or whatever. The type of this element is a launch.substitutions.launch_configuration.LaunchConfiguration object
.
Now I want to use the content of this argument as a string for building filepaths for example. I know several functions are able to interpret the LaunchConfiguration object but I specifically to read it as a string. I have not found a way to do so. As I need to access multiple arguments several times, I am looking for a simple implementation.
Any ideas? Thanks!
(I am working with ROS2 Dashing)
Hi @relffok, have you figured out how to use a launch argument as a string? I'm trying to pass an argument (file path) to
open(yaml_file, 'r').read()
function and it gives me the following error when I launch it: