ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A

Plain C API

Hi to all. I’m new here. My background is embedded stuff, networking, educational robotics and Lua language.

One point of ROS1 that I found limiting was that the API is C++:

  • You can have C code that want to link against ROS libraries.
  • You may have to write a binding to another language besides Python
    • which are designed to bind against plain C, like Lua
    • which are not OO or whose OO is not C++like, like Lua or Java
      Having a conventional low level procedural old-school API is been much better in his regard.
      A C++ API for final programs would be a wrapper around this C API.

Related to this, system written in C is VASTLY more portable than C++.

ROS 2 is taking exactly the approach you are proposing.


RCL is a pretty cool layer I agree :slight_smile:


Others already mentioned it, but we do have a C API in ROS 2, which we use to provide bindings in Python, and community members have used to provide bindings in Java, Rust, and others. Here’s a brief description of the architecture:

The C++ API (rclcpp) is itself based onto the C API (rcl).

Thanks to all!
This actually looks great. Looking through the tutorials for ROS2 I was misguided by the usual mention of C++ and Python APIs.
But now I’m having CORBA flashbacks :slight_smile: