Skip to content

Provide CMake infrastructure for creating a node #114

Closed

Description

@wjwwood

This is a spin off from ros2/ros2#55.

Basically we need to add some lubrication to the process of making a node which can be loaded as a library into a container or run as a stand-alone executable. This is what I imagine it would look like:

rclcpp_add_node(my_node src/my_node.cpp)
target_link_libraries(my_node ...)
ament_target_dependencies(my_node "rclcpp" ...)
...

The rclcpp_add_node macro would create a target my_node which builds a shared library, and also creates a target which builds an executable (name of this target is an implementation detail) with the output name my_node. This allows the user to link extra libraries and what not to the library containing the node. It would also register this node in the ament index.

The output files will be lib/libmy_node.so, bin/my_node, and share/ament_index/resource_index/nodes/pkg_name/my_node (maybe just share/ament_index/resource_index/nodes/pkg_name with the my_node in the contents of that file).

The user's code is compiled into lib/libmy_node.so.
The executable is a boilerplate main which can load and run the shared library in stand alone mode or, with a cli switch, it can tell a remote container to load and run the library, acting as a surrogate until the node is removed from the container.

The infrastructure has been prototyped here: ros2/demos#18

Making all of this work will require us to figure out the issues surrounding multi vendor support in #48

Activity

  1. Karsten1987 commented on Feb 26, 2018

    @Karsten1987
    Contributor
  2. wjwwood commented on Feb 26, 2018

    @wjwwood
    MemberAuthor

    I would say no. We still do not have CMake infrastructure to let users easily create node components. And I still think we should.

  3. added
    enhancement
    on Oct 26, 2018
  4. jacobperron commented on Jun 7, 2019

    @jacobperron
    Member

    I've proposed this for a Dashing patch release since it enables ros2/demos#325.

  5. wjwwood commented on Mar 19, 2020

    @wjwwood
    MemberAuthor

    Closed by #784?

  6. added a commit that references this issue on Jul 9, 2022
  7. added a commit that references this issue on Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions