Getting Started

Glossary Item Box

VPL User Guide: Creating a DiagramConnecting ActivitiesCreating and Editing Activities

See Also Microsoft Robotics Developer Studio Send feedback on this topic

Getting Started

Start Microsoft Visual Program Language (VPL) from the Start menu. When VPL loads, you will see a window with a set of menus, toolboxes, and a tabbed diagram page as shown in the following screenshot.

VPL Project Window

VPL is a dataflow programming language, where you create a program by defining a graph or diagram of activities (blocks that represent DSS services or other functions) linked together using connections that define how data will flow between the activities. One or more diagrams constitute what is called a program in other languages, although in VPL it is usually referred to as a project. You build a diagram in the main workspace in the center of the screenshot above with the tab labeled Diagram. When you open a new project, VPL creates this default diagram for you but you can add more diagrams if you wish.

Messages flow along the connections between activities and can carry data or simply act to control the logical flow of the diagram. In VPL, data/control flows can happen in parallel because the underlying DSS runtime provides support for asynchronous execution.

The VPL User Interface

The VPL window displays a menu bar and toolbar for accessing commands and a central area to compose your diagram as well as several subwindows including toolboxes that display the list of built-in dataflow activities and the available services (pre-written code that performs functions) that can be used in your project diagrams; the current contents of your project (its diagrams and configuration files); and a section for editing properties of selected items.

The toolboxes, project window, and properties windows are movable and collapsible, and can be rearranged within the main VPL window. You can also have multiple diagrams within the one VPL program that can be accessed as separate tabs across the top of the diagram section.

You can also selectively hide or redisplay a hidden toolbox window using the Toolboxes command on the View menu. So if you inadvertently close a toolbox by clicking on the 'X' in the top right-hand corner of the title bar, you can always get it back again.

To begin a dataflow diagram, you drag and drop a dataflow activity or service from the Basic Activities or Services toolboxes to the diagram window (tabbed page). You can also add a new activity by double clicking its Toolbox menu entry. Hovering over a Toolbox entry with the pointer displays a Tooltip that includes a description of how the activity or service can be used. If the item also includes an "i" (Information) icon, the item also provides additional information. Clicking on the Information icon opens a web browser to display the page for that item.

Once you have several blocks on the diagram, you connect them by clicking on the output connection pin of one block (on the right-hand side) and dragging to the input connection pin of the another block (on the left-hand side). Many connections require additional information, so this is covered later in Connecting Activities.

You can cut, copy, paste, or delete activities by selecting the block in the diagram using the Edit menu commands or the Activities Pop-Up Context Menu.

The Basic Activities toolbox window

The Basic Activities toolbox window includes activity blocks for defining data (Data), controlling dataflow (If and Switch), combining messages (Join and Merge), performing calculations (Calculate) and storing results in variables (Variable). Also included is a Comment activity that allows you to place text comment blocks on the diagram.

VPL also includes an activity block that allows you to create your own custom activities. Custom activities can accept information, process it, and output a result. So effectively you might think of a custom activity as a subroutine if you are familiar with other programming languages. If you want to perform the same series of steps in several places in your diagram, then a custom activity is an easy way to write the code only once and re-use it multiple times. Custom Activities are discussed in the Creating and Editing Activities section of this Guide.

The Services toolbox window

The Services toolbox displays the available services. The services included may depend on those that were installed when you installed VPL. The list can be expanded by adding DSS services to you installation's "bin" folder.

Dd126878.hs-note(en-us,MSDN.10).gif

Some of the services listed in the Services toolbox are not intended for use in VPL. In particular, any service that has a name containing "Tutorial" is a separate applications that cannot be used from VPL. Similarly, services with names beginning with "Simulation" are not suitable for use in VPL unless explicitly mentioned in the documentation.

The services displayed in this window also depend on the contents of the Services toolbox's Find Service text box that appears at the top of the list. Entering text here causes only those services with that text to appear in the window. The filter looks for matches in both the display name of the service as well as its description text. A blank filter box displays all services. To clear the Find Service filter, click the 'X' in the text box.

You can also modify the display by entering multiple words, separated with spaces, and the list will display all services with any of those words. Adding a plus (+) before a word causes the filter to display only those services where that word also occurs. Placing a minus (-) before a word removes the display of any entries that include that word.

You can use filters to organize the list of services, by creating a filter section. To create a filter section click the '+' (plus) on the right side of the All Found heading (displayed just below the Find Service text box). This creates a new heading section in the Services toolbox window using the words selected as the search filter and the results of the filter under it.

If you want to create a title for the search filter without the filter words, add = title, to the filter text. Now when you click the '+' in the All Found heading, the new section will use just that text. For example if you enter the following,

 dialog = My Favorite Services

and then click the '+' next to All Found, a new section is displayed with just those services whose name or description include "dialog", but titled as My Favorite Services.

You can use the buttons on the left side of a filter header to display or hide the items that the filter includes. To remove a heading, click the 'X' to the right of the heading's title.

Note that saving your project will save your custom filter settings.

Diagrams window

As you can see in the screenshot above, the first diagram in a project is always called Diagram. For a simple program, you will probably just use this default diagram.

You can create new diagrams from the File menu by selecting Add Diagram. Adding diagrams is a way to break your project into modular pieces to keep it more manageable. Diagrams run in parallel.

When you create a new diagram a new tabbed page appears within the VPL window. You can then add activities and services to this new diagram. To switch to an existing diagram, click on its tab.

To close the current view of a diagram, click the Close button (the 'X') on the diagram's tab. This does not delete the diagram from your project. To redisplay a diagram that you have closed or to delete or rename a diagram, see the following section on the Project window.

The Project window

The Project window displays a list of the diagrams and configuration files included in your project.

To redisplay a diagram, display the Context Pop-up Menu of the diagram in the list and choose Open, or double-click its name in the Project window. If the diagram's name is not currently visible, you may need to expand the Diagrams entry to view the list of diagrams.

To add more diagrams to the project, display the Context Pop-Up Menu for the Diagrams entry and click Add Diagram. Alternatively, you can select Add Diagram from the File menu. Every time that you add a new diagram, its name will be Diagram, or if this is already used VPL will add a number to the end to make it unique, e.g. Diagram0, Diagram1.

To change the name of a diagram, click on its entry in the Project window and edit its name in the Properties window. Names can only contain letters, numbers and the underscore (_) character. They must always begin with a letter. Try to give your diagrams meaningful names that will help you to remember what they do.

To delete a diagram, display the Context Pop-Up menu by right-clicking on the diagram's name in the Project window and then clicking Delete.

The Properties window

The Properties window displays the properties for the currently selected item. This allows you to configure an activity (including services) connection or diagram. To change the properties for an activity, select the activity by clicking it and its properties will appear in the Properties window.

The Errors window

While you are working in VPL you might occassionally make a mistake, forget to set a property or to make a connection. When this happens VPL will place a red exclamation mark on the activity that has an error. This error checking happens in the background, so you might not see errors immediately.

Errors in a diagram

To see all of the errors in the entire project, you can use the Errors window. TheErrors window is not displayed by default. You have to select it from the menu by checking View \ Toolboxes \ Errors. Note that there are some errors that are not flagged by icons on the activity blocks and the only way you will see them is to look in the Errors window.

Errors Window

See Also 

VPL User Guide: Creating a DiagramConnecting ActivitiesCreating and Editing Activities

 

 

© 2012 Microsoft Corporation. All Rights Reserved.