Below are the attributes of high-quality ROS2-based systems.
Use standard ROS 2 message formats as much as possible to ensure the project is compatible with other ROS2-based systems.
Avoid using non-standard tools or libraries that may not be accessible to everyone.
Design ROS 2 nodes to be as hardware-independent as possible.
Make it easy to add new features and functionality.
Write and document code so that it is easy to make changes in the future.
Divide nodes into small, independent, loosely coupled, highly cohesive, functional modules to avoid high technical debt. Each node should have a clear responsibility, and make sure nodes have minimal dependence on each other.
The easiest way to ensure modularity is to isolate what changes. Code that is likely to change in the future should be isolated from the rest of the system.
Software should be responsive and stable when run under its expected workload.
One technique for improving performance and reducing overhead at runtime is to not persist raw data if only a piece of it will be used.
For example, if you have a robotic arm on a conveyor belt with an overhead camera, save only the pixels of the camera image that change. Do not save all pixels from all video frames. This technique was used in this ROS system.
Make code easy to understand and follow. Someone else should be able to look at your code and figure out what is going on.
The system should behave as it is expected to behave. You can achieve good reliability by running many tests on the software to minimize the probability of future failure.
ROS 2 nodes should be able to handle gaps in sensor data as well as times when there is an overload of sensor data. Using an Extended Kalman Filter to estimate the robot’s state via a motion model is a good design choice.
Write code so that it could easily be reused in an entirely different project.
Think about different scenarios that could cause the robot to do harm to a person or object, and write code to handle these scenarios (e.g. run into a wall at full speed).
Add safeguards to the system to make it robust to tampering.
Make it easy to debug your code and ensure the system is working correctly.
“Anything that can go wrong, will go wrong.”Murphy’s Law
Think of all the ways that your code can break under abuse from users, and write test cases for those scenarios to see how your system holds up.
What Are the Most Important Attributes?
This paper mentions that maintainability, performance, and reliability (in order from most important to least important) are the most important attributes for a ROS-based system.
I. Malavolta, G. Lewis, B. Schmerl, P. Lago and D. Garlan, “How do you Architect your Robots? State of the Practice and Guidelines for ROS-based Systems,” 2020 IEEE/ACM 42nd International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), 2020, pp. 31-40.