This website uses browsing/session and functional cookies to ensure you get the best experience. Learn More
How to write a module
Although you can contribute any working piece of software to the repository, we require that your module respects a minimum set of requirements. These are listed here:
- Module configuration: it should be possible to change the parameters used by the module from the command line. Paths to configuration files should not be machine or configuration dependent.
- Remotization: it should be possible to execute the module remotely, using yarprun. If the module accepts commands, there should be a yarp interface that allows to send these commands to the module (one or more yarp ports).
- Clean shutdown: make sure there is a way to shut down the module without killing it.
The software infrastructures we provide facilitate writing modules that have these characteristics.
We provide sections in the manual and software tutorials that explain how to achieve this behavior.
The class ResourceFinder in YARP simplifies this task.
- These tutorials explain all you need to know about the ResourceFinder and how you can use it to write your module:
- A more detailed description of the ResourceFinder class and how it works is reported here: Resource finder overview.
Remotization and clean shutdown
Modules are managed using the yarprun utility. In particular yarprun uses signals to stop or kill modules. Normal shutdown is requested by sig-term (the equivalent of hitting ctrl+c at the console). This means that your module will have to intercept and correctly handle this signal.
The helper class RFModule in YARP deals with this automatically, so you do not have to do anything special. It also supports the use of the ResourceFinder class described above.
This tutorial shows how to use the RFModule: