Go to Post Let me tell you, the scariest day ever was the day that I realized since I am a mentor, people actually take my advice and I should be careful of what kind of advice I give. :ahh: - Elgin Clock [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2016, 20:55
grainne grainne is offline
Lead Programmer
FRC #0811 (Team 811 Cardinals)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: New Hampshire, United States
Posts: 10
grainne is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2016, 22:33
MaGiC_PiKaChU's Avatar
MaGiC_PiKaChU MaGiC_PiKaChU is offline
Drive Coach
AKA: Antoine L.
FRC #3360 (Hyperion)
Team Role: Mentor
 
Join Date: Mar 2014
Rookie Year: 2012
Location: Sherbrooke
Posts: 608
MaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond reputeMaGiC_PiKaChU has a reputation beyond repute
Re: global variables?

Quote:
Originally Posted by grainne View Post
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?
i'm just going to assume you're using command based:

you could add this in your shooter subsystem:
Code:
public boolean IsAtFullSpeed(){
return velocity >= x;
}
where x is the speed you need to achieve


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;
}
__________________
2012 - 3360 - Junior member
2013 - 3360 - Lead Programmer, Human player
2014 - 3360 - Lead Programmer, Human player
2015 - 3360 - Lead Programmer, Driver
2016 - 3360 - Mentor, Drive coach




Last edited by MaGiC_PiKaChU : 26-01-2016 at 22:39.
Reply With Quote
  #3   Spotlight this post!  
Unread 27-01-2016, 14:21
grainne grainne is offline
Lead Programmer
FRC #0811 (Team 811 Cardinals)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: New Hampshire, United States
Posts: 10
grainne is an unknown quantity at this point
Re: global variables?

awesome! thank you so much!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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