ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

If condition in ROS2 launch xml

asked 2022-08-14 12:23:03 -0500

adityakamath gravatar image

updated 2022-09-03 23:24:36 -0500

ravijoshi gravatar image

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.

edit retag flag offensive close merge delete



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.

ravijoshi gravatar image ravijoshi  ( 2022-09-03 23:27:00 -0500 )edit

Yep, that's what I eventually did.

adityakamath gravatar image adityakamath  ( 2022-09-04 02:57:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-09-03 14:21:28 -0500

adityakamath gravatar image

It is currently not possible, there is an issue in the ros2 git repo:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-08-14 12:23:03 -0500

Seen: 1,165 times

Last updated: Sep 03