ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How does an RMW implementation work? How would I go about writing my own RMW implementation?

asked 2023-02-24 05:23:35 -0500

CraigH100 gravatar image

updated 2023-02-24 05:24:52 -0500

I cannot find any information on the inner workings of this, only how to use them. How are interfaces implemented in C? In C++, this could have been done with virtual methods, or in Rust with traits, so how is it done with C? What is the basic principle behind how the RMW and the RMW implementations link together?

Additionally, if I wanted to learn how to write my own RMW, where should I start? What do I need to know, and how much work would it involve? What would be the basic steps in getting a custom RMW running?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2023-02-24 06:07:48 -0500

jrtg gravatar image

I think this is a good resource about RMW implementation:

https://discourse.ros.org/t/ros-2-ove...

edit flag offensive delete link more
1

answered 2023-02-24 06:02:22 -0500

CraigH100 gravatar image

I've found a partial answer to my own question here: https://docs.ros.org/en/foxy/Concepts...

"The rmw API is located in the ros2/rmw repository. The rmw package contains the C headers which define the interface, the implementation of which is provided by the various packages of rmw implementations for different DDS vendors."

So it is just .h header files with functions without a body, and then the implementer's create a .c file and include this header file, and provide the function body. This becomes a single unit of compilation, and when this is linked against other pieces of code, the linker only cares about the .h files, which is why the RMW implementations are interchangeable. Is this correct?

I am still curious about the other details involved in creating an RMW. Is there a tutorial anywhere? Do I need to use CMake, or know about any specific build processes used by ROS2? What are the steps, from start to finish, in implementing an RMW, and how much effort would you estimate (in days/weeks) this would take for an experienced programmer?

edit flag offensive delete link more

Comments

Did you look at above link? I think it should give you a decent overview? Coincidentally, I came accross following repo which I didn´t look at in detail, but which also seems a concice example for an RMW implementation (for publishers and subscribers).

Re. your other questions: - Obviously you can use whatever build system you want, but in the end if you want to integrate your custom RMW implementation as a ROS 2 package, you will either need to put your code into a ROS 2 package, of define a vendor package to include it as an external library. - How much time it needs is impossible to answer. It depends on how much background info you already know wrt RMW, and which functionality you want to implement (e.g. support for shared memory for intra-process communication, loaned messages,...) In his blog post on ROS 2 over email, Christophe Bedaert ...(more)

jrtg gravatar image jrtg  ( 2023-03-03 01:55:33 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2023-02-24 05:23:35 -0500

Seen: 480 times

Last updated: Feb 24 '23