autoware_launch icon indicating copy to clipboard operation
autoware_launch copied to clipboard

Migrate launch XML files to Python scripts

Open esteve opened this issue 2 years ago • 10 comments

Checklist

  • [X] I've read the contribution guidelines.
  • [X] I've searched other issues and no duplicate issues were found.
  • [X] I've agreed with the maintainers that I can plan this task.

Description

Launch XML files are quite expressive, however Python scripts are more flexible and allow for easier composition. In a complex system like Autoware, we can reduce complexity by migrating to Python scripts for launching the components of Autoware.

Purpose

Python scripts are more flexible for launching complex components

https://docs.ros.org/en/humble/How-To-Guides/Launch-file-different-formats.html#python-xml-or-yaml-which-should-i-use

Possible approaches

The formats for launch files are YAML, XML and Python scripts

Definition of done

Launch XML are converted into Python scripts

esteve avatar May 26 '22 11:05 esteve

Maybe we should discuss this in Software WG for other opinion. You are also right that Python launch has more features supported, but I believe XML is more familiar for most of ROS users and we might want to review if we really need to use Python.

mitsudome-r avatar May 27 '22 08:05 mitsudome-r

@mitsudome-r no problem, I'll put this on pause and we can discuss it in the next WG meeting.

esteve avatar May 27 '22 10:05 esteve

As Esteve-san says, Python scripts are more flexible. But from Humble, more features such as Composable Nodes are available in XML. https://docs.ros.org/en/rolling/Releases/Release-Humble-Hawksbill.html#frontend-support-for-composable-nodes

Considering that, I believe that now XML has enough features for the current Autoware. So I think we can keep using XML. It's also beneficial for the people coming from Autoware.AI or other ROS 1 communities.

However, it's true that some features like Lifecycle Nodes, which might be used in Autoware in the future, aren't supported in XML yet. In that case, I guess we can consider the hybrid launch system of Python and XML. For example, we build some complicated component launch files in Python, and combine them in XML.

kenji-miyake avatar May 27 '22 11:05 kenji-miyake

@kenji-miyake I prefer either using all XML or all Python. I personally like consistency a lot, it's easier to maintain, read, etc. Right now, we have the pointcloud_container.launch.py script and the other launch files are XML, which is not optimal.

So I think we can keep using XML. It's also beneficial for the people coming from Autoware.AI or other ROS 1 communities.

True, but also, Python seems to be the preferred option in ROS2, and it was the approach used in Autoware.Auto, so people coming from it would find it easier to work with.

In any case, I created this issue to address https://github.com/autowarefoundation/autoware.universe/issues/910, which was solved in Autoware.Auto using Python scripts for launching components, so I was planning to follow the same approach here, but if people prefer XML, I'm sure we can find a solution that doesn't require migrating to Python.

esteve avatar May 27 '22 12:05 esteve

In any case, I created this issue to address https://github.com/autowarefoundation/autoware.universe/issues/910, which was solved in Autoware.Auto using Python scripts for launching components, so I was planning to follow the same approach here, but if people prefer XML, I'm sure we can find a solution that doesn't require migrating to Python.

Regarding global parameters, it can be resolved with XML, like this.

It was previously used in our proposal, but it was removed when we port the code to https://github.com/autowarefoundation/autoware.universe, so it's not used now.

kenji-miyake avatar May 27 '22 13:05 kenji-miyake

I think we should stick to XML as much as possible and use Python only if certain features are not available in XML.

angry-crab avatar May 30 '22 08:05 angry-crab

As a user I would like to see the Python launch files. I agree with @esteve 's comments on consistency. All the ROS2 projects I have seen so far (Nav2, MoveIt2, drivers etc) use Python launch files and it's awkward to be mixing in XML files if I want to use Autoware

sisaha9 avatar May 30 '22 16:05 sisaha9

I would prefer xml launch files, on the one hand, it's more convenient for Autoware.AI users to transfer to current Autoware, on the other, xml launch files have better format than python scripts, which is more readable. Considering the extra features python launch files could support, and some other third party packages which may use either xml or python launch files, I think the hybrid launch files is acceptable, as there are always third party packages to be used, and the launch files from it is various.

Sharrrrk avatar May 31 '22 02:05 Sharrrrk

Let's discuss this topic on https://github.com/orgs/autowarefoundation/discussions/371

xmfcx avatar May 31 '22 16:05 xmfcx

This pull request has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Jul 30 '22 18:07 stale[bot]

This pull request has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Sep 05 '24 23:09 stale[bot]

We'll keep going with XML files since they are easier to read and harder to become too complex compared to python launch files.

xmfcx avatar Sep 06 '24 08:09 xmfcx