12-20-2008 01:40 PM
Starting out....create your own default template
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.
Adding Device Definitions to the TypeDefs.
1. Open the file RobotData.ctl. Make the cluster bigger to accommodate the new type defs you will be placing inside.
2. 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.
3. 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.
4. 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.
5. 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.
6. 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.
7. 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.
8. 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!