Home

Awesome

LTS CI Join the chat at https://gitter.im/Ada-Open-Source-Projects/RCLAda

ada4ros2

Main repository of the RCLAda project. Currently maintained for ROS 2 Jazzy on Ubuntu 24.04 LTS. Older releases targeted Humble and Foxy and are available under correspondingly named branches.

This repository is actually a ROS 2 workspace. It can be checked out directly and compiled as a regular ROS 2 overlay. Package repositories are brought in as submodules and are individually available at https://github.com/ada-ros/.

Alternatively, you could check out the individual repositories that you need. (E.g., just rclada_common, rosidl_generator_ada, and rclada, which provide the necessary core Ada libraries.)

Instructions

This project relies on the system's default Ada compiler, which means installing the gnat and gprbuild packages.

  1. Follow the official instructions to install ROS2 (either binary or from source should work).
    1. If installing from sources, you can use the contents of ros2deps.txt to build only the necessary dependencies: colcon build --packages-up-to $(cat ros2deps.txt). This will cut your build time in half.
  2. Clone the ada4ros2 repository with submodules: $ git clone --recurse-submodules.
  3. Enter the repository root folder and issue $ colcon build
    1. You may need to install package python3-colcon-common-extensions to make colcon available.
  4. Source the ./install/setup.bash script.
  5. Try to run some example nodes: $ ros2 run rclada_examples listener. Tab completion should work too.

Alternatively, you can import with vcs the ada4ros2.repos file in this repository to prepare the Ada workspace overlay.

  1. Download the ada4ros2.repos file to the folder you're using as workspace.
  2. Run vcs import src < ada4ros2.repos
  3. Continue as in the above list from colcon build.

Testing your installation

Assuming, you have successfully built the ada4ros2 overlay and sourced it, you can run its examples and self-test node to ensure it works as expected:

Developing Ada nodes

Nodes can be entirely written in Ada, without the need for C/C++ files or main program. Please check the examples in the rclada_examples repository for some ideas.

Ada code is compiled using gprbuild. Once you have successfully run colcon build, you can use the aggregate project file ada4ros2.gpr, in the root folder, as a starting point for development. This file includes all RCLAda libraries and a sample user project. The file is designed to be open with the GPS (or GNAT Studio) editor from GNAT, and to develop Ada code without going through the colcon build process every time. Compilation can be launched directly from GPS and should succeed.

Alternatively, you can force the exporting of all necessary project file locations, so you can open yours with GNAT Studio without requiring the ada4ros2.gpr or any other aggregate project, or manual environment exporting. To do so, export RCLADA_EXPORT=TRUE in your environment before running colcon build. After sourcing the install script, the GPR_PROJECT_PATH environment variable will be filled with all project paths from the build. Then, its a matter of running /path/to/gnatstudio -P <your project.gpr>.

While developing in GPS is a convenience, the final package build is to be done through colcon, as with any other ROS2 package, so your nodes and interfaces are locatable by ros2 tools. This project provides some CMake functions to greatly simplify the inclusion of a GPR project in the ROS2 build process:

CMake functions

To simplify the integration of GPR-based Ada projects, the rclada_common package provides the following CMake functions (all of them starting with ada_*. The two first ones are the most important, and the rest could be useful for special Ada projects (like bindings):

Using the rclada ROS 2 Client Library binding.

The library is provided by the rclada ROS 2 package. However, your package must depend on all of:

Check the rclada_examples package for a starting point for your package, since it is written purely as a regular client.

The GPR projects that you can use in your nodes, that you have to with on your own project files, are:

There are two hierarchies of Ada packages in the Ada RCL binding:

  1. RCL.* packages form the high-level, manually curated binding.
  2. RCLx.* is the automatically generated binding (with g++ -fdump-ada-spec). It is not intended for direct use but it should be complete if something is still missing in the high-level binding. It also ensures that changes in the C RCL are detected and properly integrated in the Ada high-level binding.

Additionally, there is both a high-level and low-level binding to rosidl packages:

  1. ROSIDL.* packages are used by RCL.*, and by users to deal with messages/services.
    1. ROSIDL.Static.<importing pkg>.<imported pkg>.Messages|Services.<interface name> contain the Ada types corresponding to messages used by topics and services.
    2. ROSIDL.Dynamic contains Ada types to use messages through runtime introspection (older deprecated method).
  2. The low level bindings to rosidl_generator_c, rosidl_typesupport_c, and rosidl_typesupport_introspection_c are too autogenerated, and should not be needed unless you use something from RCLx.*, which should be a last resort (there is no foreseeable need at present).

All examples provided use exclusively the RCL.* and ROSIDL.* hierarchies.

Implementation status

RCL client library:

These statuses refer to the high-level binding; the low-level one is always generated.

ROSIDL message support for Ada

ColCon integration

API documentation

GNATdoc-generated documents can be found at https://ada-ros.github.io/ada4ros2/ for RCL, RCL.TF2, ROSIDL and their dependencies.

Extras

Some developer notes I have taken:

Since rclada initially attempted to follow the ros2_java project structure, I did these dependency graphs on the java_examples package. This one is simplified removing some common and indirect dependencies, you can see the full one here. These might help in understanding some of the interrelations amongst ROS2 packages.

Simplified dependencies

Acknowledgements

This project exists thanks to the current of former support of the following entities:

<p align="center"> <a href="https://www.adacore.com/community"><img src="https://www.microsemi.com/images/soc/Mi-VEcosystem/AdaCoreLogo-Master_LogoTagline-Color.png" height="48"></a> <a href="http://robots.unizar.es"><img src="http://robots.unizar.es/wp/wp-content/themes/YellowMagazine/images/logo.png" height="48"></a> <a href="http://cud.unizar.es"><img src="http://cud.unizar.es/sites/default/files/imagenes/CUDlogolargo_alta.jpg" height="48"></a> <a href="https://rosin-project.eu/"><img src="https://rosin-project.eu/wp-content/uploads/2017/03/Logo_ROSIN_CMYK-Website.png" height="48"></a> </p>