-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conditional tag does not work #832
Comments
Could you provide more information? For example:
Some info that might help you when looking at the source code:
I believe it should look like this: launch:
# ...
- include:
file: $(find-pkg-share my_package)/launch/optional_components.launch.yaml
if: $(var use_optional_component) I agree that, if you're not used to the launch system, it's a bit hard to make sense of the source code and figure out how the actual launch file is supposed to look, especially since there aren't a ton of examples. |
Thanks. I went with condition: because I found a couple of places where that was in an example ros2.,yaml launch file. Your suggestion, after quoting all the strings, which I think is required, worked.
I will study the code and come back maybe with a proposal. Thanks |
Great! If you can point me to the examples you looked at, I can try to see if they need to be updated/fixed. |
Hi Christopher
By the way are you the committer for the launch stuff? And are you the designer?
I am using the yaml launch file because it is far simpler although the syntax can sometimes be confusing.
The python launch file is powerful but boy oh boy is it involved. It doesn’t seem pythonic more like Java. I don’t know the launch mechanisms nearly enough to propose how to change it but it is an unnecessary steep learning curve really early in one’s experience with ROS2 (although it’s better to have the python format than not like ROS1.)
This is not a rant, just a question about the history of how we got to this particular design.
Pito
… On Mar 4, 2025, at 10:28 PM, Christophe Bedard ***@***.***> wrote:
Great! If you can point me to the examples you looked at, I can try to see if they need to be updated/fixed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
christophebedard left a comment (ros2/launch#832)
Great! If you can point me to the examples you looked at, I can try to see if they need to be updated/fixed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sorry for the delay.
I'm just one of the people helping maintain launch. Over the years, I've come to learn how it all works.
You are definitely not the first person to say this! I think the main answer is: the Python "interface" was never meant to be the main interface. It's the backend. The YAML and XML launch frontends should be used instead of Python. The Python interface should only be used if someone wants to go deeper and hopefully if they know what they're doing. Now, this doesn't really help. What's missing is:
Some relevant issues:
|
Interesting. I am surprised I guess that the "backend" is the python api. I thought (maybe this is out of date) that most of ROS2 is in C++ and python is just a patch to allow non-C++ programmers (e.g. like students and early adopters) to use a simpler language. There are advantages obviously in using Python because everyone knows it and you don't have to reinvent concepts like arguments, conditionals, and also it opens possibilities in terms of customization and flow control. But IMO the current Python API is definitely (unnecessarily) hard to use.I wonder if a new one could be built (on top of this one) that simplifies and makes the api and the default launch file more pythonic. Here is a .yaml launch file:
Here is the same logic in a made up python DSL. I'm sure there are things here that conflict with the architecture and are impossible to do just like I have it. Just an outside-in view.
|
There have been attempts at creating a "simpler" Python launch interface, like this one: https://github.com/oKermorgant/simple_launch. It's simpler, but it means it's limited if you're trying to do more complex stuff. Before trying to "improve" the Python ROS 2 launch system, I'd recommend trying to understand its design and capabilities. Yes, it's complex, but it's also very powerful. And, again, users are meant to use the YAML and XML frontends. Since there's nothing actionable here, I'll close this issue. Feel free to keep discussing. |
Thanks. I am interested in the topic but I don't want to waste your time. "And, again, users are meant to use the YAML and XML frontends." -- that may be the case in the develoeprs' minds, but it doesn't come through in the doc, code examples, and functionality available to json and xml launch files. I will take a look at the link you sent. Thanks for engaging on the topic. |
You are definitely right, which is why I'm hoping to change/improve the docs. First step: ros2/ros2_documentation#5093.
You're not wasting my time 😁 If you want to help (we're always looking for help!), I think the best way to help here would be to get familiar with the launch system and then help improve the docs like I've outlined above in #832 (comment). For some actions/substitutions/etc., YAML/XML support might be incomplete, which is part of why there aren't a ton of YAML/XML examples, so improving that would be great too. |
I have tried this and many variations.
I have trolled the source code (e.g. ros2/launch_yaml) and can't figure out where the relevant code is. But I would be happy to offer support for condition if it is not already provided.
The text was updated successfully, but these errors were encountered: