Dependency injection patterns in ROS
During "ROS Node Unit Testing" and "ROS Node Integration Testing" I would like to inject dependencies of ROS nodes on library level C++/Python classes explicitly (e.g. to replace real sensors classes with fake sensor classes, replace real actuators with fake actuator classes, etc.).
Are there any dependency injection patterns/techniques in the ROS Node Level?
(In the "Library Unit Test Level" the dependency injection patterns/techniques are quite clear. I am interested in dependency injection patterns in the "ROS Node Level" only.)
Asked by thinwybk on 2017-05-29 13:44:22 UTC
Comments
One way would be to add paramters to the nodes interface. This way one or several of the nodes dependencies could be changed to e.g. a fake dependencies. One or several dependencies could be configured similar to the rostest test nodes.
Asked by thinwybk on 2017-06-28 13:58:24 UTC
An example of how to actually do this will be added here: https://github.com/fkromer/building-reliability-into-ros-packages/blob/master/design/design_for_testability.md
Asked by thinwybk on 2017-10-25 03:15:42 UTC