Wednesday, June 21, 2006

Microsoft .NET Interface for Lego Mindstorms RCX

Separate from their announcement of the Robotics Studio, Microsoft also posted an article called "Introduction to Programming LEGO MINDSTORMS" a few days ago. The article describes how to program the Lego Mindstorms RCX using Visual Studio .NET (e.g. Express Edition). It contains code samples in C#, Visual Basic, J# and C++.

Here's how it works in Microsoft's words:
It makes use of the LEGO assembly instruction set (LASM) to interpret and execute both onboard programs and PC-driven requests. LASM bytecode is sent to the RCX from a PC via infrared data transfer, usually from a tower connected to the PC via USB or RS-232 (serial) cable.

Developers planning to build RCX-based applications have two models to choose from:
  • Download LASM bytecode to the RCX and execute it as a complete application. In this model the entire program is sent to the RCX and it is run independently by the RCX's processor. This scenario is known as "autonomous" programming, since the RCX executes independent of the PC.
  • Send a series of requests from a driver (typically a PC) that instructs the RCX on which actions it must take. In this model the business logic occurs on the PC and only imperative commands are sent to the RCX for processing, such as requests to change motor speed. This scenario is known as "integrated" programming since the RCX can be integrated easily with other applications.
What this means is that you can program in C# or Visual Basic, and the program can still be downloaded to the RCX for execution without PC. I can imagine this may have an impact on the people working with Not Quite C (NQC). I'd be very interested to see an evaluation and response from the NQC community.

If you decide to run software on your PC that controls the RCX, then there are some limitations that Microsoft resolves for you:
Although the RCX itself does not provide event notifications to the driver PC, the Microsoft .NET Interface for LEGO MINDSTORMS library simulates this functionality by polling the RCX regularly on a separate thread [...]. The result is that developers are able to enjoy first class .NET support, including support for properties and events, without having to implement the low-level interoperability mechanisms or manage timing.
The features Microsoft could provide by exploiting the 32-bit processor of the NXT would be even better. Since Microsoft intends to provide a development environment for all kinds of robots, they will make robot platforms easier to compare. In my view, Lego Mindstorms NXT is one of the best platforms currently available, and it may well set the bar for other robot platforms.


At November 12, 2007 12:44 AM , Anonymous Anonymous said...

Hello Mr. Filip,

I would like to know. WIth the new Microsoft Robotics Studio 1.5 and new NXT, is it possible to write an application in C# and then download the LASM to the NXT, just like it was with RCX?
thank you daniel


Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home