Go to Post Obligatory warning: School comes first. If you have to choose between doing homework and going to a build season meeting, do the homework. - Billfred [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 24-01-2014, 22:34
Zaque Zaque is offline
FF: Bobo Brigade
AKA: Zachary H.
FRC #3352 (Flaming Monkeys)
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2013
Location: Belvidere, Illinois
Posts: 91
Zaque has a spectacular aura aboutZaque has a spectacular aura aboutZaque has a spectacular aura about
While loop not working in autonomous

Hi all,

I have created a while loop in autonomous that uses a boolean from the vision processing (hot goal). I have a System.out that will print repeatedly in NetConsole, but my relay will only go forward the first time. Relevant code below:

Code:
        while(h){
            relay.set(Relay.Value.kForward);
            System.out.println("Firing");
        }
__________________
Zaque (Zach) H.
President
Programming/Electrical Lead
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2014, 22:49
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: While loop not working in autonomous

Could you provide some more context to your issue? Are you using the SimpleRobot or IterativeRobot base class? It would help to see the class this code is located in, or at least more of the surrounding code.

I'm not entirely sure what the issue is here. You set the relay to the forward value, and it will stay there until you set a new value for the relay. What is the desired behavior you are looking for?
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2014, 00:19
Zaque Zaque is offline
FF: Bobo Brigade
AKA: Zachary H.
FRC #3352 (Flaming Monkeys)
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2013
Location: Belvidere, Illinois
Posts: 91
Zaque has a spectacular aura aboutZaque has a spectacular aura aboutZaque has a spectacular aura about
Re: While loop not working in autonomous

Sorry for not giving enough information. We are using SimpleRobot. It is located within public void autonomous(). I have the while(isAutonomous() && isEnabled()) loop commented out, so as not to kill the flash on the cRIO. I can post the whole code tomorrow morning, but this is the only code that acts on the relay. To clarify the problem, when I run the program, it prints "Firing" repeatedly in NetConsole, but the relay only turns on for the first time through the while(h) loop. Also, the green LED on the digital sidecar turns on and off with the motor. The h Boolean is set based on whether or not the goal is hot, and I have confirmed this to work.
__________________
Zaque (Zach) H.
President
Programming/Electrical Lead
Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2014, 07:21
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: While loop not working in autonomous

Quote:
Originally Posted by Zaque View Post
To clarify the problem, when I run the program, it prints "Firing" repeatedly in NetConsole, but the relay only turns on for the first time...
So you're saying the relay turns on for the first loop, and then it turns off and won't come back on? If you're trying to fire the ball, I'm assuming you want the motor to stay on for the duration of the loop?

From the code snippet you posted, I see no reason for the relay to turn off. You should check the rest of your code to make sure nothing else is trying to control the relay.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

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:41.

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