FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you edit/create typdefs?

I am having a difficult time in learning how to modify the Advanced FRC Projects.

Primarily the typdefs and then knowing how to use them.

I started to create a laptop only test program with a typdef and then other VIs.

But I can't figure out how to make a .ctl file

0 Kudos
Message 1 of 7
(8,266 Views)
0 Kudos
Message 2 of 7
(2,966 Views)

THANK YOU.  I was not aware of that document.  There are probably many more.

I do have some questions.  I went through the example without much difficulty until the last steps involved with creating the Global Variables.

1.  There is already a "Robot Global Data.vi" in the framework.  Why create another?

2.  The example actually created 2 global vi files.  Why?

3.  I tried several different ways of just creating one global data vi and couldn't figure out how to add a new global variable to an existing global vi.

4.  I was able to create multiple global data entries in a single file just by creating them on the same front page.  But then I didn't know how to add the global to my vi.

I will investigate more.  Thank you again.

0 Kudos
Message 3 of 7
(2,966 Views)

For your first two questions, I think it was just an example of one way to do it. Feel free to play around with other ways.

I'm not sure what the difference is between your 3rd and 4th questions. If you've created a global variable in your project, you can drag the file from the project wizard to your block diagram. If you have a global variable with multiple values in it, you can click in the middle of the globabl variable on your block diagram to choose which value to use.

0 Kudos
Message 4 of 7
(2,966 Views)

I will try to explain questions 3 & 4 in a different way.

In the Frameworks document we created a global variable and named it Acc Value

This global variable became a vi of its own.

I want this new global variable created/placed/reside in the Robot Global Data.vi file

And the other question is:  I want to use a global variable from the Robot Global Data.vi file in a new/revised vi file within the project.

How do I put it into the block diagram?

Thanks

0 Kudos
Message 5 of 7
(2,966 Views)

I'll answer your questions in the reserse order...

>>I want to use a global variable from the Robot Global Data.vi file in a new/revised vi file within the project.

>>How do I put it into the block diagram?

Global variables exist as stand-alone VI's.

They have to, because their contents get shared between multiple VIs.

So in some ways they are just like any other function VI.

So to USE an exiting Globela Variable in a VI, right click and bring up the fucntions palette.

Click on "Select a VI" and navigate to the VI that is your Global Variable.

Place that global on your Block Diagram, and then click on it to selected the particular data element that you want from that Global.

Note several things here.....

  You really need to name your global VI's proberly, so you can find them later.....

  This also illustrated that a Global can have several data elements in it.  These can be single items, or large cluster ar arrays.

  Always make suure you name the items IN the global smartly as well.

>> In the Frameworks document we created a global variable and named it Acc Value

>> This global variable became a vi of its own.

>> I want this new global variable created/placed/reside in the Robot Global Data.vi file

A global variable IS a VI.  So as soon as you create one, souble click it, and then do a Save As to provide a meaningfull name.

I like to include the word "Global" in the name so you can find it later.  eg:  GlobalArmData.vi

Once you have a Global VI, you can open it (using file open) and mess with it's contents.

Use the Front Panel to add any items you want.

In your case you didn't really need to create a new global, what you really wanted was to add some more items INTO the existing Robot Global Data.

You only had to open  RobotGlobalData.vi and add your new elements to it.

So... the easiest way to do what you want now, is to cut-paste the elements from your new Global VI into the RobotGlobalData.vi.

To do this, just open up both VI's (using File Open) and cut paste the new elements.

Note that there is a difference between adding items into an existing cluster and adding a new cluster.

If you add a new cluster, it's name will appear on the selection list when you use place this global on a new VI (as above).

Hope this helps.

It's confusing at first, but after the first few mess-ups it makes more sense.

The thing to remember is that the representaion on the Front Panel of the VI is what defines the data.

BUT if LabVIEW won't let you change it there, then it's probably defined elsewhere as a Type Def (.ctl file - data structure).

This central .ctl file enables several VI's to use the same data structure.

To add an element to this definition, you need to do it by selecting the whole item and then right clicking to "Open Type Def".

Any changes you make now will be incorporated into all the places that use this data.

Get a life? This IS my life!
0 Kudos
Message 6 of 7
(2,966 Views)

Thank you all. I was able to create and use global variables in a manner that I understand; and works!

0 Kudos
Message 7 of 7
(2,966 Views)