ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

ROS 2 launch: Python vs XML

asked 2020-06-10 12:46:05 -0600

Hi,

As a ROS teacher, I am in the process of adapting my lectures / labs to ROS 2 for the next intake in September. My target audience (master students / professionals) has two features:

  • does not know ROS at all
  • has heard / read that ROS will let them easily do complex stuff with their robots

Now that I am planning to create a few example / labs packages (and continue adapting my ROS 1 ones) with Noetic + Foxy, I really wonder about the Python vs XML choice for launch files.

ROS 1 users are used to XML format, its syntax and limitations. Most of it seems to be supported in ROS 2 - so we can do in ROS 2 XML what we used to do in ROS 1 (except, probably, parsing a xacro file, which was common practice).

ROS 2 proposes much more, just citing Composition and Life Cycle. I am not sure, from reading ROS 2 XML architecture and various discussions, what is currently supported in XML.

As a C++ teacher, I believe the first chapter of a C++ course is not a C summary. Similarly, I think the first chapter of a ROS 2 course should not be a ROS summary.

Hence, I have no issue in not talking about XML launch files at all (at least on the beginning), if they cannot express concepts such as composition / life cycle which are important in ROS 2. However, I find the Python syntax to be quite bloated, and I already feel my audience (students / professionals) sigh when facing their first Python launch file (my audience use robots to do stuff, they do not care about doing stuff do use robots)

So, my question is simple: should one take the XML approach, hoping that more and more concepts of ROS 2 get supported, or should they favor the Python approach, being able to do much more at the cost of a higher code length even for simple things?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-06-10 18:32:06 -0600

I think my answer here: https://answers.ros.org/question/3527... gives a good summary of what you mention.

XML is not currently usable in my opinion, so anything you teach them is going to be substantially limited and open to change dramatically in the immediate future. I think its worth teaching them the python3 API since that's more stable and if they need to actually use the skills you're teaching, that's what they're going to need to know (and what all of the code you see on 95% of github uses, so even just modifying files they need to know it).

edit flag offensive delete link more

Comments

If you make a statement that something is unusable it would be helpful to enumerate specific problems or reference tickets with that context.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-06-10 18:45:01 -0600 )edit

@Dirk Thomas, sure thing. I think the other answer I linked to has the context. Its mostly around the lack of component and lifecycle node support. That's been so heavily pushed as core ROS2 features that I don't think there are many examples of nodes that aren't components or lifecycle nodes (or attempting both) so it really restricts the uses of the XML/YAML launch systems, especially when trying to compose larger launch files of several nodes.

stevemacenski gravatar image stevemacenski  ( 2020-06-10 19:02:20 -0600 )edit

Thanks for the answer, which is quite in line with my feelings after reading numerous discussions and issue trackers.

The XML syntax basically boils down to using ROS 1 capabilities - which I was perfectly fine with, until a few weeks ago when digging into ROS 2. Now that more things are possible, I want to use it - at least to be able to do so.

I still find that for simple cases, the Python syntax is pretty heavy and verbose. When presented to people that still need to be convinced about the interest of ROS 2, I am afraid they'll get afraid of the code complexity.

Since raising this question, I have tried encapsulating the Python API (I had to learn it anyway). Contributing to having more launch options in XML / Yaml syntax would probably be more useful than proposing yet another Python API.

Olivier Kermorgant gravatar image Olivier Kermorgant  ( 2020-06-12 16:12:24 -0600 )edit

Agreed. I think its worth mentioning the XML and YAML exist, but for the moment, I don't think its a substitute for the python3 API. A large number of packages only have launch files in the python3 API from legacy before XML/YAML was available or because they make use of components or lifecycle nodes. To have a good overview of the state of things currently and be able to work with existing things, it would be good to expose them to the python3 API. To have a good overview of where things are going, it would be the XML/YAML.

I'd hope in steady state we can move all the python3 work to XML. I don't advocate for python3 because I like it, its mostly that I think if you're going to learn 1 thing, learn the one that does everything you need.

stevemacenski gravatar image stevemacenski  ( 2020-06-12 16:35:56 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2020-06-10 12:46:05 -0600

Seen: 1,194 times

Last updated: Jun 10 '20