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

Launch Composed Nodes using the launch XML Frontend

asked 2019-09-19 05:37:42 -0600

eric1221bday gravatar image

updated 2019-09-19 14:49:42 -0600

Hi everyone

I've been looking through the new launch_ros xml/yaml frontend design and parsing recently, and noticed that there doesn't seem to be a way currently to launch composed nodes through this frontend? It looks as if the parser, when in python, uses the frontend to generate a Node, and thus not a ComposableNode let alone a ComposableNodeContainer.

Is there currently a plan to include launching composable nodes at all via the launch frontend? It seems quite important especially since there is a way to do so using the old ROS1 nodelet API.

EDIT: Some links to provide context

As an example, this is the current workflow for launch composition nodes using the launch_ros python interface.

Looking at the design of the roslaunch XML frontend. The only allowed tags which would launch a process would be executable and node.

In the file in launch_ros, special provisions and imports were made to expose this action to the frontend, but it seems that currently the does not have any similar implementations.

Since this feature is not mentioned in either the design or the implementation, I wonder if this is something that the frontend is planned to support?

edit retag flag offensive close merge delete


Please edit your question to include links to what you're reading and where you're referencing.

tfoote gravatar image tfoote  ( 2019-09-19 13:00:54 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-09-19 15:52:32 -0600

ivanpauno gravatar image

Hi eric1221bday,

The design document you're referring to is actually a format, and the implementation is not limited to just those tags. We started by writing the "parsing functions" of the tags that were available in roslaunch XML, but new ones can be easily added.

Here is Node's parsing function as an example.

The following actions will need a parsing function to get the functionality you're asking for:

I'm not currently planning to add it, contributions are welcomed. Also, you can ping me if you have any question.

Best, Regards

edit flag offensive delete link more



Thanks for the response. Since this would entail extending the current XML frontend tags, I'll have to put some more thought into it. But perhaps a <composable> tag might work?

eric1221bday gravatar image eric1221bday  ( 2019-09-19 22:17:04 -0600 )edit

I would use the following tags:

  • node_container
  • load_composable_node
  • composable_node

The last tag is for the composable node description, which doesn't have to be exposed with expose_action as the others.

For this one, I would recommend writing a free function that does the parsing, and you can reuse it from both node_container and load_composable_node actions.

ivanpauno gravatar image ivanpauno  ( 2019-09-20 07:54:59 -0600 )edit

So looking at the API here, it occurs to me that I'm not sure if the current API will allow for loading composable nodes in separate launch files. The current LoadComposableNode has a target_container argument which is required to be a ComposableNodeContainer and beyond that it also requires it to have already been executed. Am I missing something? Or does this mean that the current system cannot allow for launching the node container in one launch file and then launching components targeting that container in other launch files.

eric1221bday gravatar image eric1221bday  ( 2019-09-21 06:58:15 -0600 )edit

That's a good question. The current implementation of LoadComposableNodes needs the target container at construction, but if you see the implementation detail, the only needed thing is the node name. I would add a new argument to the constructor: node_name. One of node_name and target_container should be required (IMO, target_container should be deprecated).

The topic of having references (i.e.: being able to identify) another action in the XML/YAML frontend is an interesting feature currently not supported. It would be useful, for example, to support event handlers.

ivanpauno gravatar image ivanpauno  ( 2019-09-23 07:35:54 -0600 )edit

Yeah I’ve actually since then gonna ahead and implemented this exact idea, though in my case i made target container a Union so as to not disrupt the current API. The pull request is here

eric1221bday gravatar image eric1221bday  ( 2019-09-23 08:36:57 -0600 )edit

answered 2022-01-06 07:31:57 -0600

xperroni gravatar image

It seems there's still no direct support for loading components from XML files, for the time being I'm using the <executable> tag as below:

<?xml version="1.0" encoding="utf-8"?>

  <node name="container" pkg="rclcpp_components" exec="component_container"/>

  <executable cmd="ros2 component load /container composition composition::Talker"/>
  <executable cmd="ros2 component load /container composition composition::Listener"/>
edit flag offensive delete link more



I believe it would be available from Humble!

Kenji Miyake gravatar image Kenji Miyake  ( 2022-01-06 10:09:01 -0600 )edit

Question Tools



Asked: 2019-09-19 05:37:42 -0600

Seen: 572 times

Last updated: Jan 06 '22