Is it proper to use the class RobotMap…? I know that RobotBuilder gives it to you or default java code gives it to you when you create a new java project but I just don’t see the point in having it other than organization. Any insight on why it should/shouldn’t be used?
If you use RobotBuilder, you’ll need to use RobotMap. If you don’t use RobotBuilder, don’t do it. It breaks encapsulation, which generally is a bad thing.
I wouldn’t do RobotMap the way that RobotBuilder does it (declaring all objects in one file). However, it is very useful having constants for all ports you use defined in one place. Then you can reference those ports when you construct the objects in the subsystems.
As Joe Ross said, its best to do a robot map like this (pardon two year ago me’s inability to write beautiful code) mainly for two reasons
- Electronic configuration. If you’re doing anything with the board than you can easily reference the ports in a clean manner
- Code management. Its generally more beautiful to show what each specific number means instead of just throwing in random numbers in places
Of course, it’s also heavily opinion based.