If condition in ROS2 launch xml
I am migrating one of my ROS 1 launch files to ROS 2 launch.xml, and I need help implementing an if condition.
I want to implement a condition such as the following:
<param name="x" value="0.0" if="$(var condition)" />
But this is not working with ROS 2 launch.xml. The ROS 2 design documents mentions the eval
expression, but there is no documentation on how to use it.
A launch file in ROS 2 can be written in Python, XML, or YAML. So, a workaround is to rewrite your launch file in Python. Please read the documentation for more information.
Yep, that's what I eventually did.