Go to Post There is almost always more than one solution to any engineering problem. One part of elegant design is picking the one that makes the most sense for a particular design problem, even if that means "breaking" some normally established "rules". - Jeff Pahl [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 13-01-2010, 15:31
Nadav Zingerman Nadav Zingerman is offline
Registered User
FRC #2230
Team Role: Programmer
 
Join Date: Jul 2009
Rookie Year: 2009
Location: Israel
Posts: 90
Nadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to beholdNadav Zingerman is a splendid one to behold
The importance of Finish.vi, or lack thereof

I've been hearing for quite a while that calling Finish.vi is better than cutting power and that all device references should be closed there. What I'd like to know is why. During competition the robot is shut down in this "bad" way many times, with no messy results of Finish.vi not being called. So does it really make any difference?
Reply With Quote
  #2   Spotlight this post!  
Unread 14-01-2010, 01:23
lollypop2020 lollypop2020 is offline
Registered User
FRC #2733 (Pigmice)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Portland, OR
Posts: 19
lollypop2020 is an unknown quantity at this point
Re: The importance of Finish.vi, or lack thereof

I would also really like to know this! Is calling Finish.vi better then not? Does it make a noticeable difference?
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2010, 09:48
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,579
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: The importance of Finish.vi, or lack thereof

http://decibel.ni.com/content/message/4182#4182
Reply With Quote
  #4   Spotlight this post!  
Unread 15-01-2010, 15:35
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
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: The importance of Finish.vi, or lack thereof

Quote:
Originally Posted by lollypop2020 View Post
I would also really like to know this! Is calling Finish.vi better then not? Does it make a noticeable difference?
In case the discussion on the forum isn't clear, I'll attempt to summarize.

The WPILib code for the cRIO was written so that aborting a VI will cleanly deal with closing I/O for you. This is not always the case, and some OS resources or 3rd party libraries will lock up or behave incorrectly if you misuse their API.

As a good programming convention it is a good habit to close things you open, and furthermore to strive for having resources opens and closes be consistent, easy to verify, and easy to describe to others. Rube-Goldburg devices may be fun to look at, but are not fun to debug or modify, and you don't want one in control of your resource handles.

On the other hand, simple is good, and if there are no bad consequences to writing infinite loops and letting the auto cleanup deal with resource handles, why not take advantage of it in your code.

These conflicting goals have led to the template code being a little inconsistent. It tends to contain data wires leaving infinite loops wired to close nodes. By definition, an infinite loop does not finish, thus the close will not be called. The auto cleanup is the way most handles are currently being closed in the standard LV template. Meanwhile, if a team decides to change their loop so that it does terminate, then the next thing they'd probably want is to have a close for all the resources outside the loop, so the close was placed there for that purpose -- to show where you would typically close things if/when the loop is changed.

I hope this helps explain the legal usage options.
Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 15-01-2010, 18:10
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,833
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: The importance of Finish.vi, or lack thereof

Thanks for closing the loop...
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
Planning ahead (or lack thereof) dlavery Chit-Chat 9 20-02-2008 12:44
Importance of the Rookie Chairman's Barry Bonzack Chairman's Award 5 28-02-2005 14:54
pic: Ground Clearance (or the lack thereof) ahmed Robot Showcase 14 15-02-2005 17:02
Teasers... or lack thereof Rickertsen2 Robot Showcase 29 30-01-2004 12:42
The Importance of Sound ComBBAT_Albrot 3D Animation and Competition 8 09-03-2002 20:33


All times are GMT -5. The time now is 22:40.

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