0
$\begingroup$

I have a python node that I would like to add to a composable node container.

I could not find any documentation on the python equivalent to the rclcpp_components_register_node cmake command. I would assume that I would need to adjust the python code of the node as well as the setup.py file.

Naively, I have just tried to add the executable in the ComposableNode():

ComposableNode(
    package="foo",
    plugin="foo_node",
    name="foo",
),

but got the following error when launching:

[ERROR] [bar.container]: Could not find requested resource in ament index
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'foo_node' of type 'foo_node' in container '/bar/container': Could not find requested resource in ament index

It would be great if you could help me figure this out. Thanks.

$\endgroup$

2 Answers 2

2
$\begingroup$

Welcome to Robotics Stack Exchange!

How to build a python node as a component?

As of ROS 2 Iron Irwinin the features status mentions that the composition of node components at compile, link, load, or run time is currently only in C++.

$\endgroup$
1
  • $\begingroup$ Thanks for checking. I will try to keep an eye on this table. $\endgroup$
    – Metz
    Aug 15, 2023 at 8:17
0
$\begingroup$

You can use your node in launch.py file like this;

from launch import LaunchDescription

def generate_launch_description():
    # For example
    joy_node_command = Node(
        package='joy',
        executable='joy_node',
        name='joy'
    )
    
    ld = LaunchDescription()
    
    ld.add_action(joy_node_command)
    
    return ld

I hope this answer solves your problem. :)

$\endgroup$
2
  • $\begingroup$ Hi, I would like to launch it in a composition so it shares the process with related nodes, and I can use intraprocess communication. This does unfortunately not solve the issue. $\endgroup$
    – Metz
    Aug 15, 2023 at 8:20
  • 1
    $\begingroup$ @Metz oh okay, I got it. I think you have looked that link but you may have overlooked. docs.ros.org/en/galactic/How-To-Guides/… $\endgroup$ Aug 15, 2023 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.