VPL Tutorial 4 - Run Simulation From VPL
Glossary Item Box
This tutorial illustrates how you can start a simulation from VPL. To demonstrate this, you will create a VPL project that drives a robot around in a simulated world.
This tutorial is provided in the Microsoft Visual Programming Language (VPL) language. You can find the project files for this tutorial at the following location under the Microsoft Robotics Developer Studio installation folder:
This tutorial teaches you how to:
This tutorial requires no special hardware.
This tutorial is designed for use with Microsoft Visual Programming Language (VPL) which is included as part of Microsoft Robotics Developer Studio.
Create a Diagram to Run a Simulation
Create a new project by clicking New from the File menu. Now insert an XInput Controller by double-clicking on the icorn or dragging and dropping the service from the Services toolbox. If you do not have an Xbox controller then you can follow the steps in Robotics Tutorial 4 (VPL) - Drive-By-Wire to use a simple "Drive-by-Wire" interface.
Insert a Generic Differential Drive service and connect the Notification output pin of the XInput Controller to it. In the Connections dialog box choose From: TriggersChange and To: SetDrivePower. In the Data Connections click Right for LeftWheelPower and click Left for RightWheelPower. Click OK.
You diagram should look like this:
If you used the Direction Dialog, your diagram should look like this:
Select a Manifest
To connect to the simulated robot all you have to do is select the correct manifest for the Generic Differential Drive. If you have several Generic Differential Drive boxes on your diagram, you only have to set the manifest for one of them. Right click on the box and choose Set Configuration. From the drop-down list, click Use a manifest. Click Import Manifest... and choose: LEGO.NXT.Tribot.Simulation.manifest.xml or MobileRobots.P3DX.Simulation.manifest.xml.
Run the Diagram
Now click Run on the Run menu (or press F5). If you have not saved your project yet, VPL opens the Save dialog box. Type a name for your project and click Save.
VPL now proceeds to run your application. If you get a message asking whether to unblock the application, click Unblock.
You should see the simulation window (and the DirectionDialog box if you used it). Now, depending on which diagram you built, you can either use the triggers from your Xbox controller to drive the robot or the buttons on the dialog box.
To stop your application, click the Stop button in the Run dialog displayed by VPL.
VPL User Guide: Getting Started
© 2012 Microsoft Corporation. All Rights Reserved.