Introducing the ROS 2 plugin
In this book, we’ve already created a plugin, though we didn’t explicitly call it that. In Chapter 6, we developed controllers for the ROS 2 Control package. Unlike typical ROS nodes, these controllers lack a main function and cannot be compiled into executables. Instead, they provide specific functionality for use by other nodes or libraries. This distinction is key to understanding plugins in ROS. So, what is a library? In C++, a library is a collection of precompiled code reused across programs. Libraries can be:
- Static (
.a
): Linked at compile time, making their code part of the executable. This increases file size but eliminates runtime dependencies. - Shared (
.so
on Linux): Linked at runtime, enabling multiple programs to share the same library. This reduces file size and simplifies updates but requires the library to be available on the system at runtime.
A plugin in C++ is essentially a shared library. Plugins...