Programming Guide
Minimize ROS Dependency †
- The purpose of using ROS is connecting your program to other ROS packages.
- In general, your code might be used in other situations where ROS is not used.
- In order to increase the reusability of ROS code, minimize the ROS dependency of your code.
- Separate ROS dependent code (nodes, publishers, etc.) from ROS independent code as classes, functions, etc.
- Example of making a node xxx (e.g. face tracking):
- Create a ROS-independent unit xxx.h and xxx.cpp
- Create a ROS-dependent code xxx_node.cpp
- Write main algorithms in xxx.{h,xxx.cpp}
- Write a ROS interface (node, subscribers, publishers, ...) in xxx_node.cpp where xxx.h is imported to use the main algorithms.