Go to Post Thats what makes FIRST so unique how culture and the time is reflected through our bots, but at the same time we all get along...with no problem. - Dan Richardson [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 31-01-2011, 19:06
archwaykitten archwaykitten is offline
Registered User
AKA: John McBryan
FRC #1212 (Sentinels)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Arizona
Posts: 10
archwaykitten is an unknown quantity at this point
Labview objects not distinct?

When I change the settings of a labview object (by double clicking on the object and changing values on its front panel), these settings are changed for all instances of that same object.

For example, I open and name four motors in Begin.vi. When I try to invert one of them through its front panel (by clicking on the invert button), I end up inverting all of them.

At first I thought this behavior was because I copied and pasted all my motors, but it's not. Even when I create new objects through the menu system this non-distinct behavior remains.

Clearly my mental model of how labview works is off. I thought that creating a new object in a block diagram would be the equivalent of instantiating a new object in java: MyClass myObject = new MyClass(); But this is not the case.

So how does it work? What's going on instead? Is there even a way to instantiate new objects the way you would in an object oriented language?
Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2011, 20:09
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,563
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: Labview objects not distinct?

When you call a VI as a sub-vi, all front panel objects become connectors on the sub-vi icon. You can then wire constants to the connectors. The individual connector values are not shared between sub-vis.

I'd suggest looking through the videos on http://frcmastery.com
Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2011, 21:05
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,751
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 objects not distinct?

LV icons do not represent objects. The icons represent function calls. Thus when you open a subVI definition and change that definition, all calls are modified.

Not to complicate things, but LV does support objects, and again they are not represented by icons, but by data instances such as constants or elements returned by other functions or methods.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2011, 23:51
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,112
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: Labview objects not distinct?

Quote:
Originally Posted by archwaykitten View Post
So how does it work? What's going on instead? Is there even a way to instantiate new objects the way you would in an object oriented language?
LabVIEW is a data-flow language. It works a little bit "inside out" from the way you're trying to think of it. Variables (and by extension objects) are represented by the wires between blocks. As Greg said, the blocks represent function calls.

I think it's best not to try to understand it based on what you know of other languages. The more knowledge you bring to the task, the more you will have to unlearn before you can get to know LabVIEW on its own terms.


In your specific example of the Motor Open, you shouldn't be doing anything with the vi front panel. You should create a constant wired to the Invert input of the vi icon (right-click the connector on the icon and choose Create->Constant from the popup menu) and set that constant to be either T or F.
Reply With Quote
  #5   Spotlight this post!  
Unread 05-02-2011, 12:42
archwaykitten archwaykitten is offline
Registered User
AKA: John McBryan
FRC #1212 (Sentinels)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Arizona
Posts: 10
archwaykitten is an unknown quantity at this point
Re: Labview objects not distinct?

Ah. Thanks everyone.
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 10:18.

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