View Single Post
  #3   Spotlight this post!  
Unread 16-02-2010, 12:20
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: autonomous programing for lab view

How you go about doing this depends on your programming experience. There is another thread about the topic somewhere - but I will sum up what it said:

There are two ways to do it - state-machine and sequenced.
If you have a state-machine, it will cycle through states until it reaches the end. The state-machine is in a while loop, so the code would run in Autonomous Iterative.vi. This used to be the only way to write autonomous pre-2009, so most experienced veteran teams still use it.

If you are a beginning programmer, there is another way to do it using Autonomous Independent that you might find easier. Basically, you create a SubVI for each major action (e.g. drive straight or turn degrees or kick ball) and make it wait for completion. See drive_str.vi for an example. It is fed a flow in, distance, and max speed and it drives to that position. You would just need to tune the gain and be ready to go. What you do is open Autonomous Independent and delete everything, then arrange your SubVI's as you wish. Wire the flow inputs and outputs of each to each other, and since there is a data wire between the VI's LabVIEW will always follow in that sequence. All of your SubVI's must have this flow wire, so you can string the flow wire around in the order you want. This is basically like putting your code in a Flat Sequence Structure.

The picture shows what I mean.

Notes -
*If you create a new VI and want to add inputs to use it as a SubVI, you can go to the front panel, right-click on the icon and say "Show Connector". Then, you can click on the connector position you want then click on the front-panel control or indicator, and it will link that control or indicator to that connector position.
*The flow wire can be any data type you want, I used Double because I like orange.
Attached Thumbnails
Click image for larger version

Name:	auton_independent.png
Views:	129
Size:	14.7 KB
ID:	8699  
Attached Files
File Type: vi drive_str.vi (16.2 KB, 37 views)
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack