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.

3 Likes

RCL is a pretty cool layer I agree :slight_smile:

2 Likes

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:

https://docs.ros2.org/eloquent/developer_overview.html#internal-api-architecture-overview

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:

1 Like

Is there a C API for rosbage_storage? rosbag_storage: Main Page

Just for reference in this thread: check the C99 ROS 2 API provided by rclc package.

1 Like

No I do not think so, AFAIK only C++ is supported.