Please contribute your BEST tips and tricks relating to LabVIEW - detailed descriptions, how to’s, etc. here in this thread. These should be topics that are NOT [yet] thoroughly covered in the official documentation.
If you’ve documented this information elsewhere, feel free to post links to it.
Please keep discussion to a minimum here - just the facts, please. If information is disputed, please handle via PM/moderator for editing and correction. Let’s leave the thread free of clutter. It’s harder for teams to search CD when all the information is scattered across numerous threads and buried within countless “help me - I’m lost” discussions.
Create new Dashboard Project in a ‘Dashboard’ sub-folder
Combine all into single project by dragging the Dashboard folders to ‘My Computer’ in the Advanced Project. Now all your project files are in 1 place!
Don’t change RobotMain.vi – you can break it!
Don’t code inside the subvi’s making up the TeamCode….simply create subvi’s referring to your Teleop code, your Autonomous Code, etc. Do this by ‘Save As’ ‘Open Additional Copy’ and create your name, e.g. ‘TeamxxxTeleop.vi’. Put them in the appropriate spots in the TeamCode Vi’s. Be sure and wire the appropriate connections and clusters to your new vi.
As you make up the subvi’s, edit the entries in Vi Properties by right-clicking the icon in the upper right. Document it’s purpose and edit history. Also, make a unique icon the first time you save it.
Cleaning up ‘Begin.vi’.
It should be the goal of every vi to be able to visualize the entire vi from a window without scrolling.To that end, you can begin by cleaning up Begin.vi.
Open the ‘TypeDefs’ folder and open RobotData.ctl
Open a new vi (‘File’à’New Vi’)
On the Front Panel, right-click…select ‘Select a Control’ and double-click RobotData.ctl and place it on the Front Panel
Go to the Block Diagram (Ctrl-E)
Right-click the wiring stub and ‘CreateàIndicator’…go back to the Front Panel
Double-click the icon in the upper right and make your own icon
If you have a standard Team icon background, paste that in then make sure it says ‘Robot Data ‘
Then right-click the icon…’Show Connector’
Click the upper right small box and then the indicator image of the control. Make sure the wiring ‘sticks’.
Edit the icon so it says RobotData.
Save the vi as ‘RobotData.vi’
Repeat the process for the PeriodicTaskData Type Def
Now open Begin.vi and place the 2 vi’s you just created near the ‘bundle cluster’ vi’s. You get rid of the large constants that are there and as you add DeviceDefinitions to the TypeDefs, they will be updated without making an unsightly block diagram.
Adding Device Definitions to the TypeDefs.
Open the file RobotData.ctl. Make the cluster bigger to accommodate the new type defs you will be placing inside.
On the block diagram of Begin, right-click and select the WPI Robotics Library. Pin it down. The go through and select ‘Open’ vi’s for each of the devices and sensors you will be using.
As you open each ‘Open.vi’, right-click the edge of the DevRef for that device. Select ‘Open Type Def’. Now, click on the border of the cluster until the entire TypeDef is included. Ctrl-C or drag the selected type def into the RobotData type def until it is inside the cluster (remember I said to make the cluster bigger?). Make sure it is not overlapping another type def.
Make a unique name for each DeviceDef you have multiples of. Do this by editing that type def’s label. This is essential for you to identify which motor or sensor you will be wiring to.
You can group similar items, or related groups of items, by creating blank clusters on the RobotData type def before placing the new type defs inside of it. This is useful when you are unbundling by name. For example, put 4 references to your Joysticks together, even if you don’t think you will use them all.
After you have done this, go to ‘File’ and ‘Apply Changes’ before saving. You can add more motors, sensors and other devices at any time.
Now you can go into Begin.vi, put your cursor on the lower edge of the bundle-by-name vi and enlarge it…you will see the new type defs you have just added! If you don’t, simply right-click and ‘Select Item’…find the type def and choose ‘All elements’. Now, place an ‘Open Gyro.vi.’ (if you added a Gyro type def), and wire it’s cluster to the bundle vi. Be sure to select a channel to sample.
Repeat for all your other devices. Try to line up and arrange your vi’s so they make sense and don’t leave a mess of spaghetti!