Although I understand how to use substitutions I don’t see the reason for them. Why doesn’t the ROS2 launch framework allow for example to use the value of an argument directly? Does the launch system generate the code to be executed in two passes so that in the first one it does not know the values of said variables?
Or put another way, how does the launch framework work internally to require the use of substitutions?
When trying to run it, an error occurs due to the line
because obviously the counter variable is of type LaunchConfiguration and cannot be converted to an integer. The only way to directly access the value of an argument to be able to perform some operation on it is by using an OpaqueFunction action and within the function that it calls, access the value through an instructions like the following:
value = LaunchConfiguration(‘counter’).perform(context)
value = value + 1
My question is why the launch framework forces to do this. That is, I would like to know what it does internally that makes it necessary to use substitutions. Why couldn’t something similar to .perform(context) be used outside of an OpaqueFunction action?