1
$\begingroup$

I just want to have a log message with the parameter value, and I can't find how to.

  return LaunchDescription([
    arg_i,
    LogInfo(msg=LaunchConfiguration('i')),  # this one has the value, but I want it in a string
    LogInfo(msg=f"i = '{ LaunchConfiguration('i') }'"),  # here I have the object string, not the param value
  ])

-> I don't want to use the OpaqueFunction to have my log.

In case this is not possible, I have another similar problem, I want to use the param value in a mathematical operation, and use the result as a node argument :

i = LaunchConfiguration("i")

spawner = Node(
    package="ros_gz_sim",
    executable="create",
    arguments=[
        "-Y", str( int(i) * (math.pi/4)),
    ],
```
$\endgroup$

1 Answer 1

1
$\begingroup$

To my knowledge the only way to get the LaunchConfiguration parameter value at runtime (not the default parameter value) is to use OpaqueFunction.

The problem is you need to get the right context used to build the LaunchDescription and as far as I know this is the only way to expose it.

A short example is here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.