[ROS 2] In launch file, set parameter based on value given to another.
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.
Asked by Carlos Rosuero on 2021-04-20 13:09:42 UTC
Answers
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))
Asked by shonigmann on 2021-04-20 19:15:09 UTC
Comments