Go to Post It is NOT possible to fail within FIRST. It IS possible to fail within the competition (whatever your criteria for failure may be). - JVN [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-12-2011, 08:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Various Labview Questions

Quote:
Originally Posted by Greg McKaskle View Post
...
I have bookmarked the above post so I can refer others to it when necessary. It is one of the most clear, complete, and concise explanations I have yet seen of this common problem which plagues newcomers.

Thanks Greg.


Reply With Quote
  #2   Spotlight this post!  
Unread 31-12-2011, 10:55
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Various Labview Questions

I am very interested in the parallel task and I understand it in theory but I have no idea how to implement it. Where would you put such a thread? Would it be out of robot main? Would you control the motors directly from there or just do computation? And what is the difference between doing this and just having the computation in a subvi?
Reply With Quote
  #3   Spotlight this post!  
Unread 31-12-2011, 11:29
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: Various Labview Questions

Good questions.

Quote:
but I have no idea how to implement it.
A parallel task in LabVIEW is implemented using a parallel loop. To keep things more organized, the LV framework has a Team Code VI called Periodic Tasks, though the icon says Timed Tasks. By default there are a few mostly empty loops that run at different rates. They contain a sleep function to control how often they run. In reality, the vision loop is a special purpose parallel loop/task, and so is the compressor control. You can have as many as you like. The LV dataflow scheduler allocates a pool of OS threads, and the threads take turns executing the loop contents. In reality, this is no different than spawning threads in C/C++, it is just simpler syntax and since LV manages the threads, there are no leaks or runaway threads.

While you could put your parallel loop in Robot Main, I would encourage you to put it into Periodic tasks or its own subVI containing your loop. Robot Main is full of other machinery, and the idea is that Team code is where you will place your team's robot-specifid code.

Quote:
Would you control the motors directly from there or just do computation?
You will typically do the motor control in the control loop, but in cases where you layer or cascade these, you may find situations where you are simply communicating set points to other loops.

Quote:
And what is the difference between doing this and just having the computation in a subvi?
SubVIs are just synchronous function calls. Any code that depends on the results waits for the subVI to return, and the calling diagram waits as well. SubVIs are a great way to share code or abstract code, but they don't affect parallelism except that the contents are within a subDiagram. The Vision Processing subVI contains an infinite loop, so will never return. Periodic tasks contains many parallel infinite loops, so never returns. Other subVIs such as TeleOp will process inputs and return a result as quickly as practical and internal loops are simply to visit data in an array, average results, etc.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 31-12-2011, 11:40
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: Various Labview Questions

Wow. Thanks, that makes everything much clearer and no I have an idea of how to go about this. A+
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 20:48.

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