Go to Post That makes it a winning move to, well, win. - EricH [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 18-03-2010, 11:13
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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
periodic tasks in autonomous independent

When Autonomous Independent is running, does the 2010 FRC LabVIEW framework permit the use of user-coded periodic tasks?

For example, hypothetical situation, let's say there's a rotary sensor on the bot that goes from 0 to 360 degrees, and you want to keep track of revolutions. A periodic task at, say, 20ms could do that while the auto independent code is running.

~
Reply With Quote
  #2   Spotlight this post!  
Unread 18-03-2010, 11:20
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,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: periodic tasks in autonomous independent

Unless you do something to prevent parallelism, LV is all about the parallelism. During Autonomous, the Auto Independent VI is running its code, the vision code is parallel and the loop is running -- the code within may be disabled. The periodic tasks are always running, even when disabled. Robot Main is running. Start Communications is running.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 18-03-2010, 11:32
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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: periodic tasks in autonomous independent

Quote:
Originally Posted by Greg McKaskle View Post
Unless you do something to prevent parallelism, LV is all about the parallelism. During Autonomous, the Auto Independent VI is running its code, the vision code is parallel and the loop is running -- the code within may be disabled. The periodic tasks are always running, even when disabled. Robot Main is running. Start Communications is running.
Assuming our new-to-LabVIEW programmers try to stay within the guidelines for proper use of the framework, and don't try to get too "clever", is there anything they could do inadvertently to "prevent parallelism"? I guess what I'm asking is, is there a short list of common LabVIEW programming errors (particularly for newcomers) that I should warn them about?

The answer to the following question is probably obvious to a LabVIEW programmer (which I admittedly am not), but when you say "The periodic tasks are always running, even when disabled" ... why would a task continue running when it is "disabled" ? Maybe the word has a different meaning in this context?


~
Reply With Quote
  #4   Spotlight this post!  
Unread 18-03-2010, 12:07
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: periodic tasks in autonomous independent

Quote:
Assuming our new-to-LabVIEW programmers try to stay within the guidelines for proper use of the framework, and don't try to get too "clever", is there anything they could do inadvertently to "prevent parallelism"? I guess what I'm asking is, is there a short list of common LabVIEW programming errors (particularly for newcomers) that I should warn them about?
I'm sure Greg may have more, but the two main ones I know of are 1)Messing around with Robot Main without understanding what it does
2)Using loops and sequence structures inside Teleoperated or Autonomous Iterative (or in Auto Independent without feeding the Watchdog in the loop)

The main way that I know of to "prevent parallelism" by accident would be to create a loop somewhere other than Teleop (say...Preiodic Tasks) with no delay in it. All of our tasks have the same priority so one won't be preempted if it never gives up the CPU. The 2 default loops in parallel tasks have delays in them so either use those and change the timing if necessary or make sure to follow the same structure when creating additional loops.

Quote:
Originally Posted by Ether View Post
The answer to the following question is probably obvious to a LabVIEW programmer (which I admittedly am not), but when you say "The periodic tasks are always running, even when disabled" ... why would a task continue running when it is "disabled" ? Maybe the word has a different meaning in this context?
~
Disabled in this case is a robot state.

When the robot is in Disabled Mode Periodic Tasks will keep running. They will also keep setting the state of the outputs if programmed to, but those changes will not be transmitted to the Spikes, Jaguars, Victors and Solenoids until the robot is enabled into either Autonomous or Teleoperated modes.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #5   Spotlight this post!  
Unread 18-03-2010, 12:41
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,350
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: periodic tasks in autonomous independent

This is one of the things I really like about Lab View, it visually shows you what is happening. Some people just learn better visually.



This picture of Main.vi and Disabled.vi demonstrates both Serial and Parallel operations.

Begin.vi runs first, then Main.vi and the Vision/Timed tasks. This demonstrates serial because nothing else starts until Begin.vi has completed.
It demonstrates parallel because both Main.vi and Vision and Timed Tasks all run at the same time in parallel to each other and are not Dependant on each other to run.

I also used the disabled.vi to show how this mode works
As you can see, even though the robot is disabled, the dashboard is still being created. One thing to note, in this robot mode, all output to spikes, victors, jaguars, servos etc. on the robot are set to no output at all. This is for both safety and game management. Although, there is still feedback to the drivers station.
A perfect example of how this is a good thing is:
In one of our Autonomous routines we use the cameras image on the console to align our robot to the target even though the robot is disabled. We have to manually lift the camera into position to do this because the servo it is mounted to is disabled.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #6   Spotlight this post!  
Unread 18-03-2010, 12:51
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: periodic tasks in autonomous independent

Quote:
Originally Posted by billbo911 View Post
A perfect example of how this is a good thing is:
In one of our Autonomous routines we use the cameras image on the console to align our robot to the target even though the robot is disabled. We have to manually lift the camera into position to do this because the servo it is mounted to is disabled.
Which reminds me of an example of how it can be a bad thing (or rather something you have to be careful of). A PID loop with an I component located in Periodic Tasks will continue to accumulate error while the robot is in Disabled Mode. If you are thinking of putting such a loop there make sure you initialize it when coming out of disabled.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #7   Spotlight this post!  
Unread 18-03-2010, 13:13
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,350
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: periodic tasks in autonomous independent

Quote:
Originally Posted by Vikesrock View Post
Which reminds me of an example of how it can be a bad thing (or rather something you have to be careful of). A PID loop with an I component located in Periodic Tasks will continue to accumulate error while the robot is in Disabled Mode. If you are thinking of putting such a loop there make sure you initialize it when coming out of disabled.
Hmmm, sounds like the voice of experience.

There are a couple of techniques that I know of, there may be more, to prevent or minimize "Integrator Spin Up".

One way is to hold the "Ki" to zero until the robot is enabled, then set it to the calibrated value once enabled. Another approach is to limit how much "Spin Up" is acceptable. Although, this method might limit the "Ki" value so that it is less effective when enabled.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #8   Spotlight this post!  
Unread 21-03-2010, 12:37
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 744
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: periodic tasks in autonomous independent

Quote:
Originally Posted by Ether View Post
Assuming our new-to-LabVIEW programmers try to stay within the guidelines for proper use of the framework, and don't try to get too "clever", is there anything they could do inadvertently to "prevent parallelism"? I guess what I'm asking is, is there a short list of common LabVIEW programming errors (particularly for newcomers) that I should warn them about?
~
The best way to accidentally prevent parallelism is to run a wire from one loop into to another. The second loop won't run until the first loop is complete. If the first loop never exits, the second loop will NEVER run.

This is the most compelling reason to use local and global variables in LabVIEW. If you need to pass data between parralell loops, you can't wire it, you need to use varaibles. eg: Vision Target information, and anything that the periodic loops are using/generating that are expected to change.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote
  #9   Spotlight this post!  
Unread 22-03-2010, 13:07
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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: periodic tasks in autonomous independent

Quote:
Originally Posted by Vikesrock View Post
All of our tasks have the same priority so one won't be preempted if it never gives up the CPU.
Kevin, I'm looking at our team's code and I don't see anything in there about task priority. Are you doing something special to establish priority for each of your tasks?

~
Reply With Quote
  #10   Spotlight this post!  
Unread 22-03-2010, 13:23
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: periodic tasks in autonomous independent

Quote:
Originally Posted by Ether View Post
Kevin, I'm looking at our team's code and I don't see anything in there about task priority. Are you doing something special to establish priority for each of your tasks?

~
I believe there are special things you can do to set the task priority, but I was referring to the default behavior of the code from what I understand.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #11   Spotlight this post!  
Unread 22-03-2010, 13:37
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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: periodic tasks in autonomous independent

Quote:
Originally Posted by Vikesrock View Post
I believe there are special things you can do to set the task priority, but I was referring to the default behavior of the code from what I understand.
Can you post a brief summary of your understanding of the default behavior of the code (that is, as regards the framework's management of tasks) ? I am very much interested in this subject, and trying to learn more about how the LabVIEW framework handles multitasking.


~
Reply With Quote
  #12   Spotlight this post!  
Unread 22-03-2010, 13:46
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: periodic tasks in autonomous independent

Quote:
Originally Posted by Ether View Post
Can you post a brief summary of your understanding of the default behavior of the code (that is, as regards the framework's management of tasks) ? I am very much interested in this subject, and trying to learn more about how the LabVIEW framework handles multitasking.


~
What you got from Mark/Greg in the other thread is certainly better than what I could provide. Everything I know about Labview was either self-taught, learned from FRC Mastery or learned from here.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Reply With Quote
  #13   Spotlight this post!  
Unread 22-03-2010, 14:15
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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: periodic tasks in autonomous independent

Quote:
Originally Posted by Vikesrock View Post
What you got from Mark/Greg in the other thread is certainly better than what I could provide. Everything I know about Labview was either self-taught, learned from FRC Mastery or learned from here.
OK thanks. I was just wanted to make sure I wasn't misunderstanding something again.

By the way, if you are reading this Mark/Greg, I appreciate the patience and effort you put into answering all my questions.


~
Reply With Quote
  #14   Spotlight this post!  
Unread 22-03-2010, 21:51
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,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: periodic tasks in autonomous independent

No problem. By the way, if you feel confident that changing priorities is what you need, you can set priorities on a VI in the VI Properties dialog>>Execution tab. You can also set priorities on timed loops.

Of course I don't have to explain that higher priority doesn't speed up the CPU or anything magical, it simply gives cuts in the queue, right?

Greg McKaskle
Reply With Quote
  #15   Spotlight this post!  
Unread 22-03-2010, 22:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,040
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: periodic tasks in autonomous independent

Quote:
Originally Posted by Greg McKaskle View Post
Of course I don't have to explain that higher priority doesn't speed up the CPU or anything magical, it simply gives cuts in the queue, right?
I'd say "right", but I'm still wondering if "cuts in the queue" includes not only "going to the head of the line" in the queue, but also preempting a presently-running lower-priority task.

I'm also wondering how the 2010 FRC LabVIEW framework handles what I will call the "standard form" periodic tasks, i.e. like the default templates provided in the framework periodic vi. Does LabVIEW set them up with the same priority? And if so, does the OS preemptively time-slice-multitask all equal-priority tasks, or is the multitasking strictly cooperative (in the "standard form").

I say "wondering" instead of "asking" because I don't want to make it sound like I'm insisting on an answer. But if anyone does know, I'd sure be interested.


~
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
global variables and autonomous independent Team1824 NI LabVIEW 10 19-02-2010 23:00
Autonomous Mode, Independent, Iterative (?) FRC2669_Valery General Forum 4 18-02-2010 09:50
Autonomous Independent Code Issue Watchdog not fed pilum40 FRC Control System 0 11-02-2010 12:00
Periodic Tasks Luke Pike NI LabVIEW 1 04-02-2009 01:14
Using Sensors in Autonomous Independent Felipe Sagui NI LabVIEW 2 27-01-2009 17:25


All times are GMT -5. The time now is 11:21.

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