Go to Post It's just a game. - artdutra04 [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 10-02-2013, 22:35
piguy123 piguy123 is offline
Registered User
FRC #4751
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 6
piguy123 is an unknown quantity at this point
Exclamation Error While Making Relay Work For Certain Time

Hello!
I'm trying to make a relay work for a specified amount of time (not necessarily 500ms as in my screenshot). I couldn't find very good relay examples online, but from what I gathered through various forum searches, I determined that in order to make a relay work, you need to run it continuously in something like a while loop.

I did that, but I'm still receiving errors which state that I'm not running my loop fast enough. Any idea how I can get my code to work?

Here's the full error message:
Quote:
ERROR <Code> -44061 occurred at "Left and Right Motors" in the VI path: Robot Main.vi
<time>02:07:27 01/01/1970
FRC: The loop that contains RobotDrive is not running fast enough. This error can occur if the loop contains too much code, or if one or more other loops are starving the RobotDrive loop.
Could someone also clarify what this message actually means?

Here's the relay code that causes the problem:
Click image for larger version

Name:	relayproblems.png
Views:	21
Size:	12.4 KB
ID:	13921

Thanks for your help.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-02-2013, 22:56
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,834
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Error While Making Relay Work For Certain Time

That message means that your code is too slow to handle the command packets received from the Driver Station 50 times a second.
For instance, if you tried to run this code in Teleop.vi, because Teleop handles the Driver packets directly and subsequently cannot take longer than 20ms to execute.

Code that is allowed to run just as fast as it possibly can (like your example) will also suck all the life out of the cRIO CPU and prevent other code from running in a timely manner.

So, two points:
  1. A delay sequence like this belongs in Periodic Tasks.vi where it won't slow down Teleop
  2. Every loop you use must have a Wait built into it to slow it down, and Waits act to release the CPU for use by other tasks, like Teleop.
The code as written will never end.
Relay's do not have to be in wait loops.

Here's an example of a Relay sequence, a double sequence really, but just ignore the second one for your purposes.
http://www.chiefdelphi.com/forums/at...chmentid=13775
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 10-02-2013 at 23:14.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2013, 23:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Error While Making Relay Work For Certain Time

If you put a delay inside Teleop, you will break things. The way the system works, Teleop gets called once every time a communication packet from the Driver Station arrives. It needs to finish very quickly so it can process the next packet.

Move your relay code into a While loop in Periodic Tasks. You'll have to make some adjustments to the way you're handling your delays before it will work right, though.
Reply With Quote
  #4   Spotlight this post!  
Unread 10-02-2013, 23:25
piguy123 piguy123 is offline
Registered User
FRC #4751
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 6
piguy123 is an unknown quantity at this point
Re: Error While Making Relay Work For Certain Time

Quote:
Originally Posted by Mark McLeod View Post
That message means that your code is too slow to handle the command packets received from the Driver Station 50 times a second.
For instance, if you tried to run this code in Teleop.vi, because Teleop handles the Driver packets directly and subsequently cannot take longer than 20ms to execute.

Code that is allowed to run just as fast as it possibly can (like your example) will also suck all the life out of the cRIO CPU and prevent other code from running in a timely manner.

So, two points:
  1. A delay sequence like this belongs in Periodic Tasks.vi where it won't slow down Teleop
  2. Every loop you use must have a Wait built into it to slow it down, and Waits act to release the CPU for use by other tasks, like Teleop.
The code as written will never end.
Relay's do not have to be in wait loops.

Here's an example of a Relay sequence, a double sequence really, but just ignore the second one for your purposes.
http://www.chiefdelphi.com/forums/at...chmentid=13775
Thanks for the awesome reply! I'll try that out!
In your example, after Button 1, there is an arrow with an asterix underneath it. How do I make that?

Thanks again!
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2013, 23:26
piguy123 piguy123 is offline
Registered User
FRC #4751
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 6
piguy123 is an unknown quantity at this point
Re: Error While Making Relay Work For Certain Time

Quote:
Originally Posted by Alan Anderson View Post
If you put a delay inside Teleop, you will break things. The way the system works, Teleop gets called once every time a communication packet from the Driver Station arrives. It needs to finish very quickly so it can process the next packet.

Move your relay code into a While loop in Periodic Tasks. You'll have to make some adjustments to the way you're handling your delays before it will work right, though.
Thanks!
Reply With Quote
  #6   Spotlight this post!  
Unread 11-02-2013, 08:12
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,834
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Error While Making Relay Work For Certain Time

Quote:
Originally Posted by piguy123 View Post
In your example, after Button 1, there is an arrow with an asterix underneath it. How do I make that?
That's called a Feedback Node and it's used to remember the value from the last time through.
What that little test does is only go True the first time the button is pressed. Holding the button down will get you False everytime after the first. You must release and press the button again before it'll be True again and run the sequence. So if the sequence or action after the button press is fast, it won't rapid fire do it over and over again 50 times a second until you have time to release the button.

It's on the Programming -> Structures palette.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 11-02-2013 at 08:16.
Reply With Quote
  #7   Spotlight this post!  
Unread 11-02-2013, 10:14
chrissevigey chrissevigey is offline
Registered User
FRC #3411
 
Join Date: Feb 2013
Location: Horn Lake
Posts: 3
chrissevigey is an unknown quantity at this point
Re: Error While Making Relay Work For Certain Time

How are you wiring the feedback node? When I attempt to use one it faces the opposite direction.
Reply With Quote
  #8   Spotlight this post!  
Unread 11-02-2013, 10:27
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Error While Making Relay Work For Certain Time

You can right-click a feedback node and tell it to face the other direction, so the input is on the left and the output is on the right. That's just a cosmetic thing; it doesn't change its behavior.
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 22:57.

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