Question about generalizing a system
This question is about the best practices when generalizing a working ROS stack. I have a system that has many nodes working together to control a dynamic system. There is a vision processing node, an estimation node, a controller node, a wireless communication node, and a keyboard interface node (that allows the user to control all of the rest of the system). The way that the system runs is that there are a few rosparams that govern everything. For instance, there is a param that says what state the system is in e.g. calibration, running, idling, etc.; there is a param that says where the robot is supposed to start in a world frame (used for calibration and initializing an ekf); and there is a param that sets an index that tells my wireless system which robot I am talking to.
I have this system fully debugged and working nicely, and now I am looking to run multiple robots at the same time. I could make a parameter that specifies the number of robots I'm using, and then in every node add for-loops around all of the relevant pieces of code to handle multiple robots. However it seems to me that there should be a far easier solution. If I can just start up multiple instances of each node, and then have each node only have access to parameters in its own namespace, then I can create the functionality I want by just creating a bit more complicated launch file.
Does this seem possible? Where should I go to look for examples?