|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
global variables?
Hi
So my team's shooter for the boulders is done with a spinning wheel and has a conveyor belt that brings the boulder up to it. However, we do not want the boulder to be up at the spinning wheel until it is at full speed.I am trying to have a global boolean that will turn true when the shooter is full speed and allow the conveyor belt to bring the boulder up to it. However,I don't know where to put this. Our project has a config file, but any variables initialized in there cannot be changed as the program runs. Any ideas as to where to put this boolean so it can be accessed and changed by multiple subsystem? |
|
#2
|
|||||
|
|||||
|
Re: global variables?
Quote:
you could add this in your shooter subsystem: Code:
public boolean IsAtFullSpeed(){
return velocity >= x;
}
and use it in your conveyor subsystem: Code:
if(robot.shooter.IsAtFullSpeed()){
shootBall();
}
Edit: if you want to modify a global variable, (in this case i'm using myBoolean) you need a getter and a setter method. Code:
public boolean getBool(){
return myBoolean;
}
public void setBool(boolean value){
myBoolean = value;
}
Last edited by MaGiC_PiKaChU : 26-01-2016 at 22:39. |
|
#3
|
|||
|
|||
|
Re: global variables?
awesome! thank you so much!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|