devxlogo

An Introduction to Programming Robots with Microsoft Robotics Studio

An Introduction to Programming Robots with Microsoft Robotics Studio

arlier this year, Microsoft released a Community Technical Preview (CTP) of its robot-programming SDK, called “Microsoft Robotics Studio,” the result of work done by one of the groups emerging from Microsoft Research. Robotics Studio provides a high-level generic interface for programming a wide range of robots using a distributed model. The utility of this approach is apparent by the fact that both hobbyists controlling robotic kits or toy robots and serious roboticists controlling large and complicated robots can use the same SDK. This article presents an overview of Robotics Studio, and then shows you how to use the SDK to program the iRobot Roomba vacuum robot.

Microsoft Robotics Studio
The small group that created Robotics Studio hopes to simplify robot programming for all sorts of people by offering an easy way to manipulate a robot of any size. The best part is that the runtime supports distributed processing and does not require any particular robotic OS, meaning that you can program robots running on different platforms, using different chip architectures. You can also manipulate complex robots, which sometimes have more than one processor type.

Robotics Studio is made up of three main areas of software. They are as follows:

  • Runtime?This is the central core that allows you to run robots from toys to industrial size models.
  • Concurrency Library (CCR)?This simplifies managing concurrent processes, which is necessary because robots have several things going on at once.
  • Decentralized System Services (DSS)?This is a services-based architecture that lets you write and coordinate distributed applications.
What You Need
Microsoft Robotics SDK (September 2006 CTP release) and an iRobot Roomba Vacuuming Robot (any of the current models). Robotics Studio works with a number of other robots as well.

All these areas are used to build Web-based applications that are lightweight and flexible since they utilize Web services to distribute processing. The application itself resides on a Web server; the robot communicates with the application using a wireless or wired interface. Obviously, the wireless alternative is preferable because that allows the robot to move with the greatest amount of freedom.

Programming robots involves the monitoring and manipulation of multiple processes (or services, as they are referred to in Robotics Studio) that often occur at the same time. For instance, a robot can be moving, (one process) and at the same time one of the robot’s sensors can be collecting information about the environment. These two processes need to occur concurrently. The Robotics SDK utilizes the Concurrency Library (CCR) to support this need for concurrent processing, .

Services are core objects in Robotics Studio. Each service lets you communicate between processes?and each process performs a specific function (such as moving a robots head or retrieving data from a sensor). Your application comprises a set of services that talk to each other at the same time.

The services send messages to each other through ports. The services know how to communicate with each other because they each have a contract. The contract contains all the information about how messages should be formatted and what the service supports. You specify all this in an XML schema definition file (.xsd file). The third core area, a Decentralized System Services (DSS) node, coordinates all this activity. DSS is one of the key software areas that makes up Robotics Studio.

Robotics Studio Features
Unusually for a new product, the Microsoft Research group did well by including several tutorials that step you though how to get your robot up and running. The tutorials are available in multiple languages and cover everything from accessing and coordinating services to using abstract reusable services. Abstract reusable services are great because you can use the same code to run different robots (even if they reside on different platforms). The Robotics SDK installation includes tutorials that demonstrate how you might need to accomplish certain tasks. Tutorial #3 shows how to create reusable orchestration services.

Robotics Studio includes several nice features that give you all sorts of ways to control your robot. One of the nicest features is the ability to control or monitor robots using Internet Explorer (IE). Using the tutorial provided with Robotics Studio and a few lines of JavaScript, you can monitor the sensors from your robot. This allows you to create a control panel that can be monitored remotely.

For example, you could create an HTML page that allowed you to enter information, such as text that you want your robot to speak. You could then use code similar to the following that allowed the robot to speak the text entered.

function sayTextToSpeech(textMessage)      {   IEDSSNode.ThisService().InsertStateItem(         "RunScript","sayMessageImpl(""+textMessage+"");")      var sayRequest = IEDSSNode.CreateObject(        "Microsoft.Robotics.Technologies.Speech.TextToSpeech." +         "Proxy.SpeechMsg",speechConnect);      sayRequest.SpeechText = textMessage;      IEDSSNode.SendMessage(        speechConnect,"Microsoft.Robotics.Technologies.Speech." +         "TextToSpeech.Proxy.SayText",sayRequest,function(){});   } 

This example calls the SayText function, using the text passed in as the textMessage as a parameter. The function uses the IEDSSNode object, which is the Internet Explorer DSS host object.

You can also control your robot using Microsoft Instant Messenger (IM). This is great for quickly and remotely controlling your robot. Using IM and a handheld device, you could build a simple remote control for your robot. Robotics Studio provides a tutorial that walks you through how to do this.

?
Figure 1. iRobot Roomba: iRobot’s product line includes several different robots. Here’s the Roomba Red Vacuuming Robot.

Using the Microsoft Speech SDK 5.1, you can add text-to speech capabilities to a speech-compatible robot, letting your robot communicate with the outside world verbally. For example, you can easily make the Roomba robot (see Figure 1) say “Ouch” when certain sensors are triggered or announce when it has gotten stuck.

For novice programmers or people new to the world of robotics programming, Robotics Studio features a tool called the Visual Programming Language (VPL). This utility allows you to build a dataflow for your application visually by dragging objects onto a worksheet. Included with each tutorial is a VPL file that allows you to quickly see how the tutorial works.

Finally, for those people who want to experiment with robotic control before a robot is actually built (or those who don’t have a robot available), Robotics Studio provides a simulation environment, and includes tutorials that step you through its use. You can effectively build a robot and control the movements virtually. This is great for robotics classes that need to teach about robotics and do not want to waste the entire time just building the robot.

Available Robots
At this time, the SDK provides tutorials that support nine different robots?and I’m sure that number will increase with every new release. Table 1 lists the robots supported by the latest release.

Table 1: Robots currently supported by Microsoft Robotics Studio.

RobotTypical PriceDescription
iRobot Roomba$149.99 and upSeveral different models are available. The best part about this robot is that it also provides a practical service and vacuums your floors.
LEGO Mindstorms RCX$119.99Programmable LEGO brick that you can use to transform a LEGO model into a robot.
LEGO Mindstorms NXT$249.95LEGO?s latest robot kit, featuring Bluetooth capabilities and several redesigned sensors.
Parallax Boe-Bot BASIC Stamp Robot$198.77 (for a limited time)A wheeled robot that features a Bluetooth module. This is a great robot for students and hobbyists.
Lynxmotion Lynx 6 Robotic Arm$388.75This robotic arm features motion in the base, shoulder, elbow and wrist and also has a functional gripper.
fischertechnik$199.00 and upThis flexible construction kit allows you to design and build your own robot.
Kondo KHR-1$1499.00 and upFor the serious robot lover, this fighting Japanese robot is popular in the robot wars.
MobileRobots Pioneer P3 DXContact Sales for quoteThis general purpose wheeled robot includes a laser, arm, bumpers, and vision.

No matter which robot you choose, you’ll need a way to communicate with it. For a limited time, Parallax is offering a discount on a bundle that allows you to program their Boe-Bot BASIC stamp robot using Bluetooth. Parallax is a true innovator in the field of robotics, striving to make robotics accessible to a wide range of people. The Boe-Bot is a great robot for people wanting to enter robotics competitions, which are rapidly gaining popularity across the United States.

The Boe-Bot kit does require you to assemble the robot, but should only take a couple of hours to do so. You can also expand the Boe-Bot to speech (using a speech board) and/or a wireless camera controlled from a connected computer. The Boe-Bot is a great robot for hobbyists or students wanting to learn more about how robots work.

I chose to test Robotics Studio using the iRobot Roomba, a programmable robotic vacuum cleaner.

iRobot’s Roomba Vacuuming Robot
Founded in 1990 by a group from the Massachusetts Institute of Technology, iRobot’s flagship product is the popular Roomba vacuum. Over two million units have been sold and the company makes constant improvements to the product. The company offers several different models that do everything from simple cleaning to allowing for scheduled operations and remote control.

The Roomba Red vacuuming robot (see Figure 1) is the least expensive of iRobot’s vacuuming robots. This one lets you clean both hardwood and carpeted floors. Using one of the interfaces available at http://www.roombadevtools.com, you can control your Roomba programmatically.

In 2005, the company added a Serial Command Interface (SCI) to all models that allows owners to program their Roombas. The SCI gave hobbyists who may not be interested in actually building a robot a way to enter the world of robotics.

Programming your Roomba with Robotics Studio
Robotics Studio offers several tutorials that get you up and running with your robot. You can use the Robotics tutorial #4 to work with the Roomba. A manifest file is included which specifically allows you to control your Roomba. The XML-based manifest file, seen below, contains the information needed by Robotics Studio to work with a specific type of hardware.

                                            http://schemas.microsoft.com/robotics/2006/08/roomba.html                                                                        http://localhost/mountpoint/Samples/Config/                  iRobot.Roomba.Config.xml
?
Figure 2. DataFlow Tab: Here's a screenshot of the dataflow tab for the robotics tutorial #4, as shown in the Microsoft Visual Programming Language utility.
dssp:StateService
http://schemas.microsoft.com/robotics/ 2006/09/roombadrive.html

The tutorial project is available in CSharp, VB.NET, and Jscript versions. The Robotics Studio installs the tutorial in the samples subdirectory. In addition to the different language versions, the tutorial includes a Microsoft Visual Programming Language (MVPL) file, which lets you see the way data flows through your application (see Figure 2). You can use this tool to convert the dataflow into actual code.

The tutorial project itself initializes the DSS node using the manifest files located in the config folder for the project. It also brings up a small form (see Figure 3) that lets you control the direction in which your robot moves.

?
Figure 3. Simple Robot Motion Control: Here’s the control form available with the robotics tutorial #4. You can use this form to control the motion of your Roomba vacuum.

You need to make a change to the configuration file, iRobot.Roomba.Drive.manifest.xml, before executing the tutorial. You will need to add a element and set the value to the COM port to which the Roomba interface is connected. If you are using a wireless connection, then this will be the RooTooth (see the sidebar “Roomba Development Tools“).

Is this Artificial Intelligence?
If you are thinking that Microsoft has solved problems associated with Artificial Intelligence (AI), you are partly right. They have created a software tool that makes it easier to control robots, which is often associated with AI. But, most scientists would define AI as the ability for a machine to think for itself. Robotics Studio may be used as a basis for adding higher level abstractions that represent intelligence, but in itself, it is only a tool for controlling the robot.

What makes Robotics Studio so special is that it opens up more opportunities for people to access the world of robotics. According to Tandy Towler, program manager for the Robotics Studio group, “Robots are about to be unshackled from forced labor. Expect them everywhere”. So, now is a great opportunity for you as a developer to get involved with the world of robotics. I encourage everyone to download Robotics Studio and take a look. Even if you do not want to invest in a robot, you can still experiment with the service tutorials that require no hardware. You can also play with the Simulation Tool which allows you to simulate what your robot will do before you actually build it. And most importantly, it’s a lot of fun.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist