Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Pulling Variables from Robot (http://www.chiefdelphi.com/forums/showthread.php?t=134095)

VaneRaklan 06-02-2015 20:39

Pulling Variables from Robot
 
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?

Fauge7 06-02-2015 21:34

Re: Pulling Variables from Robot
 
In robot map you declare the constants for the robot.

For example:

Code:

public static final int MOTOR_SPOT_1 = 1;
Then in any class simply reference it by typing

Code:

RobotMap.MOTOR_SPOT_1

defied 06-02-2015 23:23

Re: Pulling Variables from Robot
 
Quote:

Originally Posted by Fauge7 (Post 1439535)
In robot map you declare the constants for the robot.

For example:

Code:

public static final int MOTOR_SPOT_1 = 1;
Then in any class simply reference it by typing

Code:

RobotMap.MOTOR_SPOT_1

Would there be a way to change the value during runtime from the command pulling it? Remove final?

Thanks,
D

TFleig78 06-02-2015 23:35

Re: Pulling Variables from Robot
 
Quote:

Originally Posted by defied (Post 1439578)
Would there be a way to change the value during runtime from the command pulling it? Remove final?
D

Yes, removing final will allow you to change the value during runtime.

defied 06-02-2015 23:37

Re: Pulling Variables from Robot
 
Perfect! Thanks!

D

Fauge7 07-02-2015 23:28

Re: Pulling Variables from Robot
 
The final keyword in java is used when a variable value is known at runtime.


All times are GMT -5. The time now is 22:25.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi