Controlling Boe-Bot Movement
After following the setup instructions in Parallax' BluetoothControlledRobot PDF, I recommend that you start with tutorial #4 available in the \Microsoft Robotics Studio (November 2006)\samples\RoboticsTutorials\Tutorial4
directory. This tutorial teaches you how to issue basic drive commands for your robot. Before using this code, you will need to ensure that your Bluetooth module is working properly and able to communicate with your computer.
You will also need to identify the COM port your Bluetooth module is using. When you install the Bluetooth USB adapter for your computer, it will likely install an icon in your System Tray and/or a shortcut on your desktop that represents "My Bluetooth Places." To find the COM port, double-click "My Bluetooth Places," and locate the item named "eb500 A7 serial port." Select that item and click "View or Modify Configuration" to locate the name of the COM port. After that, you will be ready to modify the RoboticsTutorial4
project by following these steps:
- If you have not already done so:
- Follow the setup instructions in Parallax' BluetoothControlledRobot-v1.1.PDF.
- Start the Microsoft Robotics Studio Command Prompt.
- Use it to open the file \Microsoft Robotics Studio (November 2006)\samples\RoboticsTutorials\Tutorial4\CSharp\RoboticsTutorial4.csproj. This will open the RoboticsTutorial4 C# project file in Visual Studio.
- Use Solution Explorer to find and open the RoboticsTutorial4.csproj Properties dialog.
- Select the Debug tab.
- Replace any contents in the "Command Line Arguments" field with the following string (note that it's a single line of code):
<span class="pf">-p:50000 -t:50001 --
- The Dsshost.exe program uses this command line string to initialize the Decentralized System Services (DSS) runtime. This is the part of Robotics Studio that allows you to write and coordinate distributed processes.
- Expand the "Config" node in Solution Explorer and select the file named Parallax.BoeBot.Config.xml. Replace the value in the node named "SerialPort" with the value you identified for your Bluetooth port.
- Save your changes. From the File menu, click "Save All."
- From the Build menu, select "Build Solution." Ensure that the status bar reads that the build succeeded.
- Turn on the Boe-Bot power switch and make sure it is set to position 3.
- Press Ctrl-F5 to start without debugging. A command window appears to display messages (see Figure 2). Initialization takes a few seconds to run, after which the Boe-Bot should respond with two brief beeps. In addition, a small light on the eb500 Bluetooth module should come on.
|Figure 2. Initialization Messages: This screenshot shows the command window output that appears when you execute the RoboticsTutorial4 project.||
|Figure 3. Interface for the Robotics Tutorial #4: This tutorial shows how to drive the robot in any direction. You can use it with the Boe-Bot and other supported robots.||
- After all the manifest files are loaded, you should see a form such as the one in Figure 3. At this point you should be able to control the Boe-Bot's movements using the arrow buttons. Each button moves the Boe-Bot in that direction. Once started, the movement continues until a new direction button is selected or you click the Stop button.