Executing and Debugging a VPL Application

When you have completed the previous tasks, your VPL application should appear similar to the diagram in Figure 3-12. You can save the application as a file with an .mvpl file extension. It is best for you to save the application in a new subfolder within the MSRS application directory. You should name the application BoeBotBumperTest.mvpl. You can also run the application in a way that is similar to running a Visual Studio application. This includes the ability to step through your program using debug mode.

To execute the application without going into debug mode, click Start from the Run menu, or press F5. Alternatively, you could click the green arrow icon from the top left menu bar. This initiates the Run dialog box (see Figure 3-13). Because the DSS runtime is required even when the application is executing within VPL, a connection to the DSS runtime will be initiated.

Tip

Tip

By default, VPL will start the DSS runtime using 50000 as the HTTP port and 50001 as the TCP port. If you have chosen to work with different port numbers, you can change the values that VPL uses by clicking Port Settings from the Run menu.

Complete diagram for the simple application design with VPL.

Figure 3-12. Complete diagram for the simple application design with VPL.

The Run dialog box automatically appears when you start an application in VPL.

Figure 3-13. The Run dialog box automatically appears when you start an application in VPL.

After the connection is established, the application starts. This process could take several seconds, and you will know the Boe-Bot is ready when the robot’s speaker beeps twice and the green light on the Bluetooth module turns on. At this point, you can trigger the contact sensors on the Boe-Bot to test the application.

Even if you chose not to run the application in debug mode, you can view the program by clicking the application link within the Run dialog box. For the BoeBotBumperTest application, the link should be http://localhost:50000/Model/BoeBotBumperTest. Clicking this link brings you to the debug view, but it will not allow you to step through the diagram like you can when you are in debug mode.

To run the application in debug mode, you need to select Debug Start from the Run menu, or press F10. This also initiates the Run dialog box, but when you click the application link, you can step through the VPL application using the Microsoft VPL Debug View (see Figure 3-14).

The Microsoft VPL Debug View allows you to step through a VPL program, set breakpoints, and view the values of state variables.

Figure 3-14. The Microsoft VPL Debug View allows you to step through a VPL program, set breakpoints, and view the values of state variables.

The MVPL Debug View, which is hosted inside of your Internet browser, includes the following four sections:

  • Diagram State. Displays the state of the current program and lists any partner subscriptions that have been established. For the BoeBotBumperTest program, a subscription has been created for the GenericContactSensors service.

  • Current Node. Displays the VPL diagram and indicates the status of the program. Arrow buttons allow you to step through the blocks and observe the values of state variables as the program is executing. For example, Figure 3-15 displays the value of state variables while executing the BoeBotBumperTest program.

    While in debug mode, you can step through the program and observe the values of state variables as the program is executing.

    Figure 3-15. While in debug mode, you can step through the program and observe the values of state variables as the program is executing.

  • BreakpointsYou can set breakpoints through the Pending Nodes section that appears in this section. This is particularly useful when you are debugging a VPL program that contains several blocks. You can clear, enable, or disable breakpoints from the Breakpoints section.

  • Pending Node. Lists all pending nodes for the current instance. From here you can set breakpoints by clicking the SetBP button located next to the desired node.

Hardware identifier values are used to distinguish each contact sensor. The services that are used to operate the Boe-Bot automatically assign hardware identifier values 1 through 4 (see Table 3-4).

Table 3-4. Hardware Identifier Values Assigned to the Contact Sensors for the Boe-Bot

Sensor Name

Hardware Identifier

Left IR Bumper

1

Right IR Bumper

2

Left Whisker

3

Right Whisker

4

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.54.239