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#.
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 [email protected]