Go to Post The gates were removed for this game so that it would be easier to get the Zamboni in and out when the field was resurfaced after each round. - dlavery [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 Rating: Thread Rating: 14 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-08-2008, 03:14
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Question Labview: Feedback node doesn't reset on "stop"

Okay, I'm a little early, but I'm *hoping* there's some other kids out there working with Labview already. NI communities doesn't have enough people to get a help question answered within a week.

Anyways, I've been having problems with my feedback nodes not resetting when I stop the simulation. When I wire a value to the initializer terminal, the node simply sends the value wired to the initializer terminal, instead of storing the input value for one loop. I have seemed to get around this with putting a "while" loop around the whole VI instead of testing with a "continuous run", however if I leave subVIs like this, they hang up the VI where they are used.

What can I do to get around all this?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-08-2008, 08:55
Greg McKaskle Greg McKaskle is online now
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

I can't be sure of what you are doing because I can't see your diagram, but it sounds like you are using continuous run, and you either have state data that isn't inited when you don't wire to the init terminal, or is always the initial value when you do.

The continuous run is simply running your entire diagram again and again including the init code. If you want better control over initialization, which you do, place your own loop around this with a button to exit the loop. You can then init on entering the loop and have state data inside the loop.

Personally, I then prefer to switch over to the loop shift registers. They aren't necessarily better, but they are what I learned, and to me are simpler to explain things like initialization.

When you are ready to use the code you are writing as a subVI called from other locations, if the loop doesn't belong inside the subVI, but the state data does, then set the loop to a constant to run only once.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 12-08-2008, 16:08
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,030
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

Quote:
Originally Posted by Greg McKaskle View Post
Personally, I then prefer to switch over to the loop shift registers. They aren't necessarily better, but they are what I learned, and to me are simpler to explain things like initialization.
I've never used feedback nodes. I have always used While Loops for when I need my program to run infinitely. I imagine that at the base of program for the new RC, there will be a giant While loop managing everything.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-08-2008, 02:22
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Labview: Feedback node doesn't reset on "stop"

Yes, I am using continuous run. The default value of a boolean feedback node is FALSE, and that just happens to be what I need to to initialize to.

Quote:
Originally Posted by Greg McKaskle View Post
The continuous run is simply running your entire diagram again and again including the init code. If you want better control over initialization, which you do, place your own loop around this with a button to exit the loop. You can then init on entering the loop and have state data inside the loop.
Huh. I just tried it, and I must have done it wrong, because it didn't work. One of the most basic VIs I'm working on to make my programming easier is the latching relay (the VI I uploaded). The output should only be on if the trigger has been pressed, and should only turn off if reset has been pressed. (in other words, there's one input to turn the signal on, and one to turn it off)
I suppose I could just wire every reset of every subVI I use to the "firstcall" indicator (which I should be doing anyways), but it makes it quite a pain for testing my code.

Quote:
Originally Posted by Greg McKaskle View Post
Personally, I then prefer to switch over to the loop shift registers. They aren't necessarily better, but they are what I learned, and to me are simpler to explain things like initialization.

When you are ready to use the code you are writing as a subVI called from other locations, if the loop doesn't belong inside the subVI, but the state data does, then set the loop to a constant to run only once.
I'm not really sure how I can get a feedback node to initialize only once, when it seems to go through initialization every time it is called.

Apparently feedback nodes have a default initialization value. Shouldn't this mean that it resets to its default value when it is called for the first time, before it has a chance to collect data? (or perhaps even when "abort execution is pressed"*)

* I made a mistake in confusing "abort execution" with "stop" in my previous post.
Attached Files
File Type: vi Latching Relay.vi (10.0 KB, 252 views)
__________________
-- Marshal Horn
Reply With Quote
  #5   Spotlight this post!  
Unread 13-08-2008, 02:36
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,030
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

Quote:
Originally Posted by kamocat View Post
...attached VI...
Can you also attach an image so people without LabView on their home computers can see what you're trying to do?
Reply With Quote
  #6   Spotlight this post!  
Unread 13-08-2008, 02:48
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Labview: Feedback node doesn't reset on "stop"

Quote:
Originally Posted by Greg Marra View Post
Can you also attach an image so people without LabView on their home computers can see what you're trying to do?
Sure! (Thanks for reminding me)

I also removed that array-creating function of the FOR loop.
Attached Thumbnails
Click image for larger version

Name:	latching relay.jpg
Views:	885
Size:	68.4 KB
ID:	6782  
Attached Files
File Type: vi Latching Relay.vi (9.6 KB, 144 views)
__________________
-- Marshal Horn
Reply With Quote
  #7   Spotlight this post!  
Unread 13-08-2008, 09:04
Greg McKaskle Greg McKaskle is online now
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

Have you turned on the Execution hiliting yet? It is the fifth button on the button-bar, next to the pause. It will animate the data flowing down the wires, and it will show FALSE going to the initilization of the feedback every time the diagram runs.

Delete the for loop and constant and I believe you are in business. What may at first seem confusing is that LV code doesn't reset all values when run. Uninitialized shift registers and feedback nodes keep values as long as they are in memeory, kind of like registers in HW do until powered down.

In other words, from one run to the next, from one call to the next, the feedback node will maintain the Boolean value.

A couple LV factoids:
Every datatype in LV has a default value -- no random stuff.
You can set the default of controls and even indicators, but unwired stuff gets what we call the default default, or the default value for the datatype. Generally these aren't hard to guess, things like zero and FALSE, empty strings and empty arrays.
When possible, LV maintains the value of uninitialized things, controls, indicators, shift registers, globals, etc. between runs and between calls. If you specify a value, it changes, otherwise it keeps its value. Recompiling will reset some of these, leaving memory reset all of them.
You can use an uninitialized shift register or feedback node that is always set to true to tell if code has run since loaded, or you can use the First Run node.

I've also attached a picture using a loop and shift register instead of the feedback.

http://www.chiefdelphi.com/forums/at...4&d=1218632460
http://www.chiefdelphi.com/forums/at...4&d=1218632460

Last edited by Greg McKaskle : 13-08-2008 at 09:32. Reason: Image links
Reply With Quote
  #8   Spotlight this post!  
Unread 13-08-2008, 09:22
Russ Beavis Russ Beavis is offline
Registered User
no team
 
Join Date: Nov 2005
Location: Manchester, NH - DEKA R&D Corp.
Posts: 341
Russ Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

I'm not exactly sure what you're trying to do but, from what I can gather, you should consider using a shift register per Greg's earlier comment.

One VERY useful bit of LabVIEW advice - when in doubt, RIGHT-CLICK. You'll be astonished by the number of features that can be unlocked by right-clicking on everything.

To create a shift register (or, similarly, a sequence local in a sequence structure for passing data from frame-to-frame), simply right-click on the border of the FOR loop (also available for WHILE loops). It's good practice to always initialize the shift register.

Happy G-coding!

Russ
Attached Thumbnails
Click image for larger version

Name:	Untitled 1d.png
Views:	520
Size:	21.6 KB
ID:	6785  
Reply With Quote
  #9   Spotlight this post!  
Unread 14-08-2008, 01:10
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Labview: Feedback node doesn't reset on "stop"

Thank you!
I'll just have to reset everything before I test!

(and I do wish that a feedback node gave some configuration options when right-clicked)
__________________
-- Marshal Horn
Reply With Quote
  #10   Spotlight this post!  
Unread 14-08-2008, 08:37
Russ Beavis Russ Beavis is offline
Registered User
no team
 
Join Date: Nov 2005
Location: Manchester, NH - DEKA R&D Corp.
Posts: 341
Russ Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond reputeRuss Beavis has a reputation beyond repute
Re: Labview: Feedback node doesn't reset on "stop"

Maybe I'm missing something. If the initializer input is wired to a constant, it will always start with the same value. If the initializer input is wired to a control or local/global variable, it will always start with whatever the control/variable is set to.

A word about controls - the default value of the control can be changed in a number of ways. You can use "Edit->Make Current Values Default" to set the currently-visible values as the default values for the next time that you open the VI. Also (this is my preference), you can use a local variable to force the control to have a known value at the beginning of execution.

Controls and indicators aren't that different. They're both simply variables that can be written to and read from by your software (generally with local variables) but they've obviously got different accessibility from the front panel when running the application.

Russ
Reply With Quote
  #11   Spotlight this post!  
Unread 09-06-2016, 23:43
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Arkansas
Posts: 53
mshafer1 is an unknown quantity at this point
Re: Labview: Feedback node doesn't reset on "stop"

First note, the feedback node will "default" to what is passed into the bottom on the first execution - and will reset memory only on a stop. This means that if Run continuous or a calling VI is used, the value will be retained from run to run, but if the run button is pressed, the input values are changed, and the run button is pressed again, it will return to the state passed in (False in the picture that was posted).

It looks like you are trying to assemble a JK latch (a variant of the SR flip flop). If this is the case, I would suggest you look at 3937's memory library released on FRC LabVIEW Tutorials.com at http://frclabviewtutorials.com/memory-library/ . If you install the library, you can look at the flip flop to see how they did it (albeit using shift registers instead of feed back nodes - this will retain memory between executions of the calling vi's, only resetting at a power cycle - of on the rio)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop with the "RTFM" stuff Karthik General Forum 31 06-01-2008 16:33
Use a USB Joystick - "FORCE FEEDBACK 2" or yaniv Control System 8 04-12-2005 19:55
New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" Jessica Boucher Team Organization 0 10-08-2005 10:55
"Thunderbirds" Vs. "Team America" Which one will rule the box office? Elgin Clock Chit-Chat 3 07-09-2004 19:53
Stop The "Lesser of two evils" MattK Chit-Chat 8 07-08-2004 23:31


All times are GMT -5. The time now is 08:06.

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