ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[ROS 2] In launch file, set parameter based on value given to another.

asked 2021-04-20 13:09:42 -0500

Carlos Rosuero gravatar image

Hi there.

I am trying to create a launch file where some of the parameters are set based on the value given to others, so I can avoid having multiple launch/parameter files.

A minimal example looks as follows:

Node (
    package = 'package',
    executable = 'executable',
    parameters = [
        *uri to parameter file*,
        {
            'param1' : LaunchConfiguration('param1', default = 1),
            'param2' : ****
        }
)

I need param2 to be equal to param1 == 2.

It would be useful to extract the boolean value of a LaunchConfigurationEquals condition, but I haven't been able to find how to do that. I believe that's what the parsers in frontend are there for, but I don't understand how they work.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-20 19:15:09 -0500

shonigmann gravatar image

I haven't tested it myself, but I believe you could do something to the effect of:

LaunchConfiguration('param1', default=1)
LaunchConfiguration('param2', default='false')
...
SetLaunchConfiguration(name='param2', value='true', condition=LaunchConfigurationEquals('param1', 2))
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-04-20 13:09:42 -0500

Seen: 659 times

Last updated: Apr 20 '21