Go to Post devote your life to FIRST. It will pay off. - suneel112 [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 22-02-2011, 09:52
j.cole j.cole is offline
Registered User
FRC #0379
 
Join Date: Jan 2010
Location: Girard
Posts: 159
j.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud of
Code doesnt work With While Loops

Whenever I try to use while loops the robot farts out and decides to not let anything work (Drive system, arm motors, sensors, ect.). But when I take the loop out everything is fine and dandy. I have the while loop set to always run (constant false to a stop if true) and I have a 50ms timer. I'm trying to use a button latching system like it has in the example code. I figured out a way around it with globals but I'm afraid that when I put in the autonomous it won't work. Any suggestions?
__________________

It's not normally a good idea to give a programmer a drill but rules are made to be broken.
Reply With Quote
  #2   Spotlight this post!  
Unread 22-02-2011, 10:01
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,512
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Code doesnt work With While Loops

Loops in the teleop section of the code will not work. Teleop already loops at speeds between 15 and 50 ms (depending on the comms from the driver station and your code). Putting a loop in means that teleop has to wait to loop until your loop is complete. That will cause all the watch-dog safety timers to trip because teleop will take too long.

That is in direct opposition to autonomous independent, which only runs once and CAN have loops in it.

That's why I've never like having independent - it's a distinctly different programming structure than what happens in teleop and causes confusion.
Reply With Quote
  #3   Spotlight this post!  
Unread 22-02-2011, 10:17
j.cole j.cole is offline
Registered User
FRC #0379
 
Join Date: Jan 2010
Location: Girard
Posts: 159
j.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud ofj.cole has much to be proud of
Re: Code doesnt work With While Loops

Alright thanks I've been wondering about that. As for latching writing the opposite of the global value when the button is true works just fine.
__________________

It's not normally a good idea to give a programmer a drill but rules are made to be broken.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-02-2011, 10:49
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Code doesnt work With While Loops

Loops in periodic tasks run in parallel with the rest of the code. You can put your while loop there.
Reply With Quote
  #5   Spotlight this post!  
Unread 23-02-2011, 01:26
bstites82 bstites82 is offline
Registered User
AKA: Blake Stites
FRC #2164 (multiple)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Harrisonville
Posts: 12
bstites82 is an unknown quantity at this point
Re: Code doesnt work With While Loops

for button latching like the example you cited, you can do one of two things. if you only need to latch one button, go to the teleop front panel and drag two Boolean controls and two Boolean constants onto the front panel. I recommend naming the controls something like 'previous button value' &'last latched value' and the indicators 'button value' & 'latched value'. in the upper right corner of the front panel, right click on the vi icon and choose show connectors. hover over an empty box on the left side until the wire spool shows up,click the box and then click one of the controls, repeat for other control. then do the same for the indicators on the right side of the vi. now in the teleop block diagram you can recreate the case structures from the example but wire the shift registers on the while loop to the controls and indicators. finally in the robot main vi right click on the while loop and 'add shift register'(twice) then wire the shift registers to the new terminals we created on the teleop vi. this gives your latching function access to the main loop. 2nd option check out the typedef tutorial on FRCMastery.com, it is similar but way more useful for multiple reasons.
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 08:13.

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