Microsoft’s newest version of its Robotics Studio is a whole set of tools designed to help developers write code that controls robots.
The Robotics Studio 2008 offering, launched in mid-November, includes an IDE (Integrated Development Environment) for visually and graphically producing your code. Developers can also use the tools in conjunction with Visual Studio to write their own customized code.
Robotics Studio includes the Visual Programming Language IDE, as well as several runtime libraries to handle the connections to the devices. There is also an entire simulation environment and a set of preconfigured services set up to work with several popular robotic devices (such as Lego Mindstorm devices).
Concurrency and Robotics Studio
Robots involve multiple concurrent processes. For example, the robots the United States has sent to Mars have to do an enormous amount of things simultaneously. They move around the terrain, which involves controlling the steering and power of six wheels, each of which has a separate motor. They’re also taking readings from the various instruments, responding to remote commands from Mission Control, and sending data back to Earth. And don’t forget they’re even performing scientific experiments. (For example, they include an alpha particle X-ray spectrometer.)
All of these processes involve separate code in the form of multithreaded processing. For a programmer, that can be nightmarish, as they have to take care of locks, semaphores and all the usual multithreaded headaches. That’s where the Robotics Studio makes life easier: It includes the CCR (Concurrency and Coordination Runtime), which is a programming model that handles messaging and orchestration primitives, alleviating the need to manually handle all the low-level threading headaches. This lets the developer focus on more important tasks and spend less time fighting with low-level code.
Simulation Environment
I ran Microsoft Robotics Studio on a Toshiba Satellite U305, running Microsoft Vista, with Intel Core 2 Duo 1.8GHz and 2GB RAM.
One fun thing about the Robotics Studio is it includes a 3-D simulation environment that models actual physics (using the PhysX engine from Nvidia). At first glance, the presence of this Microsoft Visual Simulation Enviroment in a robotics studio might seem a bit odd, but the reason is that the simulation environment can include a simulation of the robot itself. This simulated robot can interact in an environment in the same way that a real robot would. In other words, if you don’t have access to a robot, you can still control a simulated one that behaves just like the real thing.
Microsoft included with the Simulation Environment several pre-packaged sample simulations of actual robots, such as one called iRobot Create. This is an educational robot for students and researchers made by iRobot, a company that makes robotic vaccuum cleaners. There is also the LBR3 Arm, made by KUKA, NXT Tribot (part of the Lego Mindstorm line), and the Pioneer 3DX, made by Mobile Robots.
VPL (Visual Programming Language)
Included with the Robotics Studio is the Visual Programming Language. This is both a language and an IDE for visually programming robots-not by writing code, but by graphically connecting dataflow pieces on a diagram.
The VPL simplifies the process of developing robotics applications. (However, advanced programmers typically prefer not to use it, instead opting to write code manually, such as in C#, C++ or even Python. Still, Microsoft is quick to point out that while the VPL is targeted to beginners, it can be used by advanced programmers as well.)
When piecing together the various entities in the VPL, the display on the screen is similar to a workflow diagram and includes common programming constructs such as variables and if-statements. In the left panel of the VPL is a list of the basic activities that include those in the previous diagram as well as a few others such as one for handling calculations.
However, below the panel of basic activities is another panel containing more advanced services that are preconfigured for common tasks. I don’t have space to list them here (and you probably wouldn’t want to read the whole thing, anyway) but there are interesting services, such as Game Controller, which lets developers read a game controller via a DirectInput interface; Generic Motor, which-as its name implies-is a generic interface to a motor; and Generic Sonar, which lets programmers interface to a sonar device. Other services are devices such as batteries, articulated arms, differential drives and Web cams. However, there are also interfaces for data processing such as a message logging and accessing SQL devices.
Programming Robotic Studio with Visual Studio
The fundamental approach to programming a robot with Robotics Studio is by piecing together various services so they can all work together. These services can operate independently and concurrently, just as most advanced robots need. Developers use pre-existing services that ship with Robotics Studio along with their own custom-made services. Programmers use services that send messages to a robot to control its actuators and they use other services to receive messages from its sensors. Developers can have services that take input from a human controlling the device, such as through a dialog box on the computer screen or through a remote device such as a game controller. All of these pieces work together to easily create a robot controller.
The Robotic Studio is actually a whole set of tools, but once involved in a project, users will likely be working within good old Visual Studio, writing their own code, such as in C#. The official Microsoft Robotic Studio site includes several tutorials and introductions to help get started. One tutorial is a video that includes a PowerPoint presentation that explains the basic steps of piecing together services to control a wheeled robot (specifically one of the Lego robots that connects to the PC via Bluetooth).
These services are quite simple, but they’re representative of a more advanced project. The first service involves displaying a dialog box called a Direction dialog, which is just a box with five buttons on it, four for each direction (forward, back, left, and right), and one for stop. The next service might seem a bit trivial to a seasoned programmer, but it’s nevertheless a required step-it’s waiting for a button press on the Direction dialog. And then the following service sends the appropriate command to the robot.
The Lego robot in the tutorial has a drive mechanism whereby two wheels are independently controlled and can move either forward or backward at different speeds. Using the Robotics Studio, developers can create a differential drive service that controls the wheels; the Robotics Studio includes a ready-made service called Lego NXT Drive specifically for this purpose. Users can see this service in the VPL, but they don’t need to use VPL-they can access the service from your C# code in Visual Studio.
Programmers can then write the code to connect the different services together by creating instances of classes and then “partnering” their objects using a Partner attribute in the C# code. In no time they’ll get the system up and running. In addition, it’s the user’s choice whether to use the VPL IDE or to code the robotics by hand using C#.
Conclusion
The Robotics Studio is surprisingly easy to use. Programmers can quickly piece together all the services necessary to handle the controlling of a robot and the responding to signals from the robots with little, if any, programming. The software comes in two forms: a free Express form, and a Premium version. For many hobbyists, the free Express version should be sufficient.
Senior Editor Jeff Cogswell can be reached at jeffrey.cogswell@ZiffDavisEnterprise.com.