[ROS2 Foxy] How to parse launch arguments

asked 2021-07-16 10:09:50 -0500

Myzhar gravatar image

Hi all, I have a launch file with two arguments that allows me to configure it. I'm finding a way to get the value of those arguments, but it seems that it's not possible or I have not understood what to do.

I need the value of the parameters to perform a few checks and to compose the name of the configuration files that must be loaded by the nodes.

I tried using LaunchConfiguration, but the values are not replaced using the CLI syntax <param>:=<value>. I tried using DeclareLaunchArgument but the values are not available until the node is not starting.

Is there a way to get this feature working?

Thank you Walter

edit retag flag offensive close merge delete


Do you have an example of how you use LaunchConfiguration and DeclareLaunchArgument? From my understanding, looking at the ros2launch example, you need to first declare the launch argument and then use the launch configuration

404RobotNotFound gravatar image 404RobotNotFound  ( 2021-07-17 08:18:26 -0500 )edit

The problem is that it's not possible to create an "if" control looking at the value of an argument because that value is not available for pre-processing... at least that's what I understood

Myzhar gravatar image Myzhar  ( 2021-07-17 13:32:25 -0500 )edit

I am having a similar problem, have you managed to find a solution?

morten gravatar image morten  ( 2021-09-30 02:32:19 -0500 )edit

No solutions for the moment

Myzhar gravatar image Myzhar  ( 2021-09-30 03:10:43 -0500 )edit