Export (0) Print
Expand All

Creating and Editing Activities

Microsoft Robotics

Glossary Item Box

Microsoft Robotics Developer StudioSend feedback on this topic

Creating and Editing Activities

With Microsoft Visual Programming Language (VPL), you can create your own custom activities that are composed of dataflows of other activities. This allows you to reuse common dataflow sequences within your VPL program. To start, drag an Activity icon from the Basic Activities toolbox and open it by using its context pop-up menu or double-clicking the Activity block. This opens a new tabbed diagram window for the activity.

Bb483008.image001(en-us,MSDN.10).jpg

As with pre-built activities, your custom activity can support one or more input actions (handlers). VPL automatically creates a default Start and Action template for your custom activity. The Start template enables you to define a dataflow that starts when your custom activity starts (that is, when your project is run), regardless of your activity's input connections. Start can perform tasks such as initializing variables. The Action template enables you to define a dataflow that allows for input and output connections. If the Start or Action template is not currently displayed when the activity opens, use the Action drop-down box just under the activity's tab area to select it. Then you can insert other activities from the Activity or Services toolboxes and connect them in the same way you do with the main dataflow diagram.

To enable your custom activity to be connected in another dataflow, you must connect its internal dataflow to its external pins. To support an input connection, drag a connection from the Action connection pin on the left border of your custom activity to the action pin at the input of the appropriate activity block of the internal dataflow you have defined.

Typically, an Action template also provides output. To enable the output from your Action's internal diagram dataflow with activities in main diagram dataflow (or another dataflow), drag a connection from the appropriate output pin of the dataflow to a connection pin on the right border. If your output is the result of an input, you will use the Result connection pin. If your activity provides notifications, drag a connection to the round Notification connection pin.

You can use the Actions and Notifications dialog box to define the name and datatype for your activity’s external input and output connection pins. To display this dialog, select the Actions and Notifications command from the Edit menu or click the icon beside the Action drop-down list under the tab for your custom activity diagram.

For an action, you can add an input or output value by clicking the Action tab in the dialog and then the Add button in the Input Values or Output Values section. Then you can edit its name, description, and set its datatype. You can add (or delete) multiple values this way. Similarly, you can add, edit, or delete notification values by clicking on the Notifications tab. When you are finished editing your input and output connections, click OK. You can always bring this dialog up again to add or change these settings.

 

Bb483008.image002(en-us,MSDN.10).jpg

The Actions and Notifications dialog also allows you to create additional Notification connection pins. To add a notification, click the Notifications tab in the dialog, then click the Add button and supply a name and type. After clicking OK, you can drag a connection from an output of your custom activity dataflow to the round notification connection you just created.

You can also use the Actions and Notifications dialog to create additional action handlers for your custom activity. To add another action handler, click the Actions tab in this dialog and then click the Add button. (You will need to define the input and output values for the new action too, as explained above).

To switch to the newly created action, select it from the Action drop-down list at the top of the Activity's page. Each action has its own page where you can define a separate dataflow as well as its own outputs. Just as for pre-built activities, the appropriate dataflow will be executed based on the connection settings selected through the Connections dialog when you connect to your custom activity in another dataflow.

VPL User Guide: Configuring ServicesRunning And Debugging

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show:
© 2015 Microsoft