So we are having some problems with variables in Command base programming. What we want to do is to create a variable in either Robot.Java or Robot.Map (or just any one class) that we can call from (i.e Robot.(variable name)) to be used in a command or subsystem. We just cant seem to be able to do just that. Anyone have any ideas as to why or for how we can do this?
In robot map you declare the constants for the robot.
For example:
public static final int MOTOR_SPOT_1 = 1;
Then in any class simply reference it by typing
RobotMap.MOTOR_SPOT_1
Would there be a way to change the value during runtime from the command pulling it? Remove final?
Thanks,
D
Yes, removing final will allow you to change the value during runtime.
Perfect! Thanks!
D
The final keyword in java is used when a variable value is known at runtime.