TOP

Getting Started with Microsoft RDS and Lego NXT

lego-nxt-robot Here2 follow a very quick introduction on how to get started with Microsoft Robotics Developer Studio and Lego Mindstorms NXT. If you have attended one of my presentations on robotics or read my presentation, this is a good guide on getting started on your own. This is the quick and dirty guide to getting started, if you want to dig deeper there are lots of good links at the bottom of this post. This is not the post that will learn you RDS, you can get the introduction here.

Software and Installation

First you have to download and install Visual Studio if you don’t already have it. RDS supports every version of Visual Studio, from Express to Team Suite.

Secondly you have to download and install Microsoft RDS, preferably you should jump straight on the latest version (Currently in 2008 July CTP version).

Pair Your Robot with Your Computer

After the initial software preparations, you need to pair the Lego NXT with your computer. The easiest way to do this is to make the PC discoverable and start the pairing from the NXT brick. Make sure your computer is discoverable in the settings of your Bluetooth software.

Bluetooth
Windows Vista Bluetooth Options

Then you can go into the Bluetooth option on the NXT and choose Search. Select your computer and complete the pairing process. When the pairing is completed, you might have to go into the Bluetooth devices control panel, go into the available services on the Lego NXT device and install the port service. This will install a new virtual COM port on your computer that is used to communicate between your Lego and your computer. Make sure you record what COM port it uses, this is important to know when you are configuring the RDS service later on.

devices
Windows Device Manager 

Opening and Configuring the Ultrasonic Explorer application

Instead of starting from scratch with an empty canvas inside Visual Programming Language (VPL), you should rather jump directly to the Ultrasonic Explorer example that is included with RDS. It’s located at the following path by default: "C:\Users\YourUserName\Microsoft Robotics Dev Studio 2008\samples\Diagrams\LEGO\UltrasonicExplorer\UltrasonicExplorer.mvpl".

(Side note: In the July CTP, the UltrasonicExplorer crashes when I double-click to open it, instead you can open VPL from the start menu and use the open file option. It crashes on two of my computers, so there is a chance that it will happen to you too)

VPL
Visual Programming Language diagram design surface 

You will see a diagram like the one above and to quickly explain what it does, it will make your Lego NXT robot navigate around the room, using the ultrasonic sensor to avoid obstacles. Depending on how close it reaches to a particular obstacle, it does 3 different actions.

Before you can hit F5 to run the application, you need to configure the COM port to communicate with your NXT brick. Select the NxtBrick service in the diagram surface and expand the Configuration option that appears on the right. Enter the serial port on your computer and just forget about the other values.

VPL_Configuration
VPL service configuration settings 

Starting Your Robot

Hit the F5 or click the Start button to launch the application and watch how your Lego NXT robot roams around the house, trying to avoid any obstacle. Remember that it will take a short while for the computer to get everything initialized and for the robot to start driving.

If you have any problems with my instructions, please leave a comment and I can edit the post with some trouble-shooting instructions.

Extending The Visual Application

Before we are finished, you need to learn how to make your first extension and change to the VPL application. Inside the VPL application, start typing the letters “Text” in the “Find service…” input box. This will filter the services list and display services you can put onto the diagram surface. Drag and drop (or double-click) the “Text to speech (TTS)” service and place it somewhere close to the first NxtDrive service. Drag a link between the orange square on the right side of the NxtDrive onto the TexttoSpeechTSS service.

Connections DataConnections
Connection Dialogs 

In the Connections dialog, select the Success event on the left and the SayText operation on the right. In the next dialog, you can check the “Edit values directly” option and write any text you want the computer to say through your computer speakers whenever the robot gets really close to an obstacle.

TextToSpeech
The VPL diagram after changes 

If your VPL diagram looks like this, then you can start your application again and now the robot will have a voice of it’s own. From now on, you’re own your own… but there are plenty of resources out there that teaches you how to write advanced VPL applications. A good place to start is the VPL introduction.

Lego NXT Links

Here are some links to blogs and sites that covers the Lego NXT robot.

RobotThoughts
Lego Mindstorms NXT Forum
Official Lego NXT Home
FirstLegoLeague
Norwegian Robotics User Group
Microsoft Robotics Studio and Lego Mindstorms NXT (bit outdated, there are new and improved Lego services in RDS 2008 which does no longer require installation on the NXT brick)

Here you can download my latest RDS presentation:

5 comments. Leave a Reply

  1. Kostek

    Hi,
    I have problem running this sample project. I am getting following error:

    Error: I2C Communication Error System.InvalidOperationException: I2C Communication Error
    : http://www.w3.org/2003/05/soap-envelope:Receiver -> Fault
    Source: http://hp:50000/lego/nxt/brick/ba871e4a-31d8-4883-b795-46d9b76e7655
    Code site: Void LogError(W3C.Soap.Fault)() at line:0, file
    Time: 2012-03-25 18:39:32
    ————————–
    Warning: Reinitializing UltrasonicSensor on Sensor1
    Source: http://hp:50000/lego/nxt/brick/ba871e4a-31d8-4883-b795-46d9b76e7655
    Code site: Boolean MoveNext()() at line:0, file
    Time: 2012-03-25 18:39:32

    i know that i connect to brick succesfully cuz when running battery sample i am getting readings. But i am getting this error each time i try run sample with sensors.

    I would rly appreciate any tips you could give me.
    Thank you

    • SondreB

      Kostek: Thanks for checking out my blog and the sample. This post is a bit out of date at the moment and I suggest having a look at the latest version of Microsoft Robotics Developer Studio here: http://www.microsoft.com/robotics/

      So your problem might actually be related to the sample I wrote being built for an older version of the Robotics Developer Studio.

  2. Pingback: [Automating and robotizing with Sondre Bjellås] « Einar Ingebrigtsens Playground

  3. John

    I ensured the com ports are identical in VPL wheb config the NXT brick com port to 5 in accordance with NXT Bluetooth Device, Properties, Hardware, Com 5. However, when I run my VPL it shows “false” connection. What exactly do you mean by “Go into the available services on the Lego NXT device and install the port service. ” Can you email me your phone number?

    This is the error I get:

    Fault: [Message = ] [Reason = Access to the port 'COM5' is denied. System.UnauthorizedAccessException: Access to the port 'COM5' is denied. at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str) at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace) at System.IO.Ports.SerialPort.Open() at Microsoft.Robotics.Services.Sample.Lego.Nxt.Comm.LegoCommService.d__21.MoveNext() in c:\Users\jleneschmidt\Microsoft Robotics Dev Studio 4\samples\Platforms\LEGO\NXT\V2\NxtBrick\NxtComm.cs:line 740 ] [Fault = http://www.w3.org/2003/05/soap-envelope:Receiver -> Fault]

    • SondreB

      I suggest going to the official site for the latest changes and updates to how to work with Microsoft Robotics Developer Studio. I might make another article like this with the latest version at a later time.

      http://www.microsoft.com/robotics/

Leave a Reply

Your email is never published nor shared.

You may use these HTML tags and attributes:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>