Configuring the LEGO Mindstorms NXT

When you first open the LEGO NXT box, you may feel overwhelmed by the number of LEGO pieces provided. Do not worry. It is not necessary for you to use all the pieces to begin working with MSRS and the LEGO NXT. You can simply use the Quick Start instructions to build the Tribot version of the LEGO NXT. You will then attach sensors, such as the sonar, touch, light, and sound.

Run the Installation

When you purchase a LEGO NXT, it should come with an installation CD that contains the software needed to operate your robot. The installation includes the LEGO Mindstorms NXT software version 1.0 and the LEGO Mindstorms NXT driver. You need to install this software on the development machine you use to communicate with the robot.

After the installation completes, use Windows Explorer to copy all files with a .ric file extension from the samplesPlatformsLEGONXTResources folder for the MSRS installation to the enginePictures folder for the LEGO installation. These are image files. They are needed because the LEGO program you will be loading is visual, and the images included with the MSRS installation are not included with the LEGO installation.

Configure Bluetooth

Because the LEGO NXT is already Bluetooth enabled, you do not need to install any additional hardware on the robot itself. However, you need a Bluetooth adapter on your development machine if it is not already Bluetooth enabled. After installing this adapter on your development machine, you must perform some additional steps to configure the LEGO NXT to work with Bluetooth.

The services provided with MSRS require that you use the Bluetooth connection, rather than a USB connection. This means that you will need to purchase a Bluetooth adapter if your computer is not already Bluetooth compatible. After installing the appropriate Bluetooth adapter, you can turn on the LEGO NXT and attempt to make a connection.

Tip

Tip

You need to ensure that the Bluetooth adapter you select is compatible with the LEGO NXT. The Bluetooth adapter that I used to communicate with the Boe-Bot (the Kensington, model #33348) did not recognize the LEGO NXT. I needed to purchase a D-Link, DBT-120 Bluetooth adapter to communicate with the LEGO NXT. Consult the following Web site for a list of NXT-compatible Bluetooth adapters, as reported by NXT users: http://www.vialist.com/users/jgarbers/NXTBluetoothCompatibilityList.

The top-left portion of the screen on the LEGO NXT brick contains information about your Bluetooth connection. If Bluetooth for the NXT is off, then no icon appears in this area. If there is a funny-looking, B-shaped symbol in the left corner, then the Bluetooth for the NXT is on, but your NXT is not visible to your Bluetooth adapter. If there is a funny-looking, B-shaped symbol and a left arrow (<), then your Bluetooth for the NXT is on, and the NXT should be visible to the Bluetooth adapter. Ensure that this symbol is present before continuing.

After you install the adapter and the NXT is accepting commands via Bluetooth, you can add the Bluetooth device. For Windows Vista users, you can do this with the Add Bluetooth Device Wizard. The wizard is accessible by right-clicking the Bluetooth icon (the funny-looking B shape) in your status toolbar and clicking Add Device. When the wizard appears, turn on the LEGO NXT and select the My Device Is Set Up And Ready To Be Found check box. Then, click Next.

The wizard searches for any available Bluetooth devices. If it finds the NXT, an NXT icon appears. Select this icon and click Next to continue. The next page asks you to provide a passkey. The LEGO NXT uses a passkey of 1234. To enter this, select the Use The Passkey Found In The Documentation radio button and type 1234 in the text box. Then, click Next. At this point, the display on the LEGO NXT should ask you to confirm the passkey. You do this by pressing the orange button on the LEGO brick.

At this point, Windows assigns a COM port to your Bluetooth device. This port assignment appears in a status box. You need to take note of the number for the outgoing COM port because you use it in the Update Configuration Settings section later in this appendix. Click Finish to complete the Add Bluetooth Device Wizard.

Install MSRS Interface

Like the Boe-Bot, the LEGO NXT requires an interface between MSRS and the actual robot. This interface runs on the NXT brick, which represents the brain for the LEGO NXT. The samplesPlatformsLEGONXTResources folder for the MSRS installation includes a LEGO software program named msrs006.rbt. This is the program that acts as an interface between MSRS and the LEGO NXT. Double-click this file from Windows Explorer to load the program into the LEGO NXT development tool (see Figure B-4). It may take several seconds for the MSRS program to load, but you should wait until the program finishes loading before continuing to the next step.

When the program is visible in the development tool, you can click the arrow button in the bottom right-hand corner of the design surface. This downloads the program to the LEGO NXT. In order for this to work, the LEGO NXT has to be turned on and connected to your computer through a USB connection or the Bluetooth connection. Ensure that the download is complete before moving on to the next section.

Interface program, which allows MSRS to communicate with the LEGO NXT.

Figure B-4. Interface program, which allows MSRS to communicate with the LEGO NXT.

Update MSRS Services

In September 2007, the MSRS team released an updated set of services for the LEGO NXT. Not only do these services make it much easier to work with the LEGO NXT, they are also necessary to work with the code provided in Chapter 6. To get these services, you must download them from the MSRS Web site: go to http://www.microsoft.com/downloads and search on the words "samples update robotics."

You can update the NXT firmware by clicking Update NXT Firmware from the Tools menu in the LEGO NXT editor. You need a connection to the Internet because this step copies files to your LEGO NXT hardware. Do not assume that a recently purchased NXT has the latest firmware. Refer to the installation instructions included with the update, which, by default, are installed in the following location: C:Microsoft Robotics Studio (1.5)samples SamplesUpdatePackage.htm.

Tip

Tip

Make sure you use the USB cable provided with the NXT to download the firmware. If you try to download the firmware to the NXT using the Bluetooth connection, it will not be able to locate the device.

Update Configuration Settings

Like the Create robot, the services for the LEGO NXT include a Web page that makes configuring the services much easier. By default, the configuration files for the LEGO NXT do not include a COM port assignment. The number assigned to the outgoing Bluetooth port must be set before running any MSRS services with the LEGO NXT. This port assignment was made when you configured Bluetooth for the LEGO NXT.

The first time you execute an MSRS service using one of the LEGO NXT manifest files, you are directed to a configuration Web page (see Figure B-5). On this page, you must enter the COM port number in the available text box and click the Connect button to connect to the NXT. When the connection occurs, you should hear a beep from the NXT and see the words Microsoft Robotics Studio appear on the LEGO NXT brick. At this point, you have a successful connection, and your service should be able to execute.

Configuration Web page for the LEGO NXT robot.

Figure B-5. Configuration Web page for the LEGO NXT robot.

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

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