ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The most flexible answer would be to use different params files. That way you will have different features for 'robot1' and 'robot2' rather easily. The benefit being that when you test or make changes you do not have to build your system each and every-time. You can also make individual packages for each robot but creating folders called 'robot1' and 'robot2' inside the same package will also do the trick. Params as I know have their limitations.
But it also depends on the complexity. If the differences cannot be handled by rosparam then you can also have several working branches in git for each of your individual packages. This way your system would be very modular. Then with git you will have three branches for each package: 'robot1', 'robot2' and 'common' so that if there are packages you want to update for both robots, you can simply upload it to the 'common' branch.
The solution with #define is a bit tricky as it would make a single file very flexible, but this would also make the code structure a bit complex. I would choose this as the last option.