ROS2 Launch - How to Concatenate LaunchConfiguration with String
Is there a preferred way to concatenate a LaunchConfiguration
with a string (e.g. a file extension, prefix, or suffix) that can be used in a similar way to PathJoinSubstitution
?
e.g. given:
DeclareLaunchArgument('my_robot', default_value='my_robot_name')
a path could be made to my_robot
using:
PathJoinSubstitution(['path', 'to', LaunchConfiguration('my_robot')])
which would evaluate as:
/path/to/my_robot_name
But what if I want to create a path to my_robot_name.config
? Is there an equivalent way to combine strings and LaunchConfiguration
s?
As a workaround, I've used Command
or PythonExpression
substitutions, e.g.:
Command(['echo -n ', LaunchConfiguration('robot_name'), '.config']) # or
PythonExpression(["'", LaunchConfiguration('robot_name'), ".config'"])
But I think it would be great if there was a cleaner, more readable alternative that I've completely overlooked.