The ROS 2 Foxy Content Sharing extensions

These extensions help you snap ROS 2 applications for the Foxy Fitzroy distribution using the content-sharing feature.

Note that this set of extensions are based on the ros2-foxy extension.

Therefore, they are applied on top of the ros2-foxy extension.

See ros2-foxy for more information.

:information_source: This extension requires Snapcraft 8.x+.

How to use it

Add extensions: [ ros2-foxy-<metapackage> ] to the application definition in your snapcraft.yaml file, where ‘<metapackage>’ is one and only one of:

  • ros-core
  • ros-base
  • desktop

For instance, extensions: [ ros2-foxy-ros-core ].

See ROS 2 applications for a complete tutorial on how to use this extension.


apps:
  colcon-ros2-foxy-rlcpp-hello:
    command: ros2 run colcon_ros2_rlcpp_hello colcon_ros2_rlcpp_hello
    extensions: [ros2-foxy-ros-base]
    ...

What it does for the build-time environment

  • Everything the ros2-foxy extension does.
  • Adds ros-foxy-ros-environment, ros-foxy-ros-workspace, ros-foxy-ament-index-cpp & ros-foxy-ament-index-python to the stage-packages.
  • Adds a content plug mounting the provider snap content at $SNAP/opt/ros/underlay_ws and defines a default provider.
  • Sets the CMAKE_SYSTEM_PREFIX_PATH variable to point at the mounted system path.
  • Adds the build snap providing the build-time equivalent of the default content-sharing provider snap to ros-build-snaps.

This implies that you can avoid declaring as build-packages all the ROS 2 packages that are found inside the ROS 2 metapackage corresponding to the extension name used above.

What it does for the run-time environment

  • Everything the ros2-foxy extension does.
  • Expands the runtime environment required by ROS 2 to include the ROS 2 workspace provided by the content-sharing snap. Similar to the typical chaining of ROS 2 workspaces.
Warning:

This extension is currently marked as experimental. We enable experimental extensions by setting the environment variable: SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS to 1.

Further reading

  • For an example of this extension being used, see the using content-sharing with core20 section of the ROS 2 applications page.
  • For a complete picture of what this extension does, add it to your app definition and run snapcraft expand-extensions.

:information_source: Snapcraft extensions enable snap developers to easily incorporate a set of common requirements into a snap. See Snapcraft extensions for further details.