Dependency injection patterns in ROS

asked 2017-05-29 13:44:22 -0500

thinwybk gravatar image

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.)

edit retag flag offensive close merge delete

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.

thinwybk gravatar image thinwybk  ( 2017-06-28 13:58:24 -0500 )edit

An example of how to actually do this will be added here: https://github.com/fkromer/building-r...

thinwybk gravatar image thinwybk  ( 2017-10-25 03:15:42 -0500 )edit