LanguagesRobotics Made Easy

Robotics Made Easy

Robots have been a part of movies for decades. Even more in the center of people’s lives are animated items that use the concepts found in robotics. Whether this be an arm with pinchers for grabbing things or a full-scale humanoid robotic system that looks semi-human, Robots and robotics have been around.

Expect the number of robotic type devices to increase. More to the point, expect the number of electronic devices that can be controlled easily by your computer to increase.


Figure 1: The Roomba

Recently a robotic device was released to sweep floors. The Roomba was a small robotic device that used programmed intelligence and sensors to understand the boundaries of a room. This device was followed by a second version that mopped floors as well. What was interesting about these robotic devices is that people quickly learned that they could be hacked and modified.

Prior to the Roomba, The makers of LEGOs released a robotic kit. The kit came with a motor, senors, additional building blocks, and a computer program that allowed you to control the devices you created. The kits and software have evolved, and today you can actually go one step farther than the software that comes with them. You can even use .NET to program the creations you create. This ability opens up simple robotics to everyone — even kids.

      
Figure 2: Lego Robotics

Most recently, I built a device that uses two servos from Phidgets, Inc. I added a camera on top of these. The servos allow the camera to be titled or turned. Most importantly, the servos can be controlled using a computer program. This has allowed me to use my computer to determine where the camera points.


Figure 3: Phidgets servos set to pan and tilt

As mentioned, I obtained the components from Phidgets, Inc. On their site at www.Phidgets.com, you have access to purchasing a variety of devices that range from servos for moving things to temperature gauges, touch sensors, slider controls, motion detectors, and more. All of these devices can be hooked together or used independently. More importantly, all of these devices can be controlled by a library that can be downloaded as well.

How hard is it to control a servo or other device?

With Phidgets, it is a matter of downloading the library from http://grouplab.cpsc.ucalgary.ca/software/Phidgets.NET/PhidgetSetup-alpha.msi. Once downloaded, you can install it by simply running the downloaded program. You can then add the Phidgets controls to Visual Studio .NET by adding the Grouplab.Phidgets.dll to the toolbox. The resulting tool set is shown in Figure 4.


Figure 4: The Phidgets tools in Visual Studio .NET

You can now create an application that uses these devices by dragging and dropping them into a form. I created a program to control a servo. To do this, I did the following:

Step 1: Create a Windows form application.

Step 2: Drag a Trackbar control onto the form. Set its maximum value to 180. This will allow the servo we are adding to be moved from 0 to 180 degrees)

Step 3: Drag a Servo control from the Phidgets tools and drop it onto your form. Verify that the AutoAttach property is set to true.

Step 4: Double click on the Trackbar control to create a Scroll event method. Make the modifications shown in listing 1 to the method.

Listing 1: The Trackbar1_Scroll method:

private void trackBar1_Scroll(object sender, EventArgs e){    servo1.Motors[0].Position = trackBar1.Value;}

Step 5: Compile and run the application.

If your servo is connect to the computer through a Phidgets controller board, then the AutoAttach property set in step 3 should cause the Servo control in your application to find it. Once attached, you should be able to control it by changing the position of its motor. You can see in Listing 1 that this is as simple as changing the position value of the motor with a value from 0 to 180.

If you had more than one servo attached to your computer through a controller board, then you would simply change the array index to address each motor. I hooked two servos together with a camera on top. The first servo controls the right and left movement while the second controls the up and down. I also added code to show the position of the servos in the title of my form. The resulting custom code added to a standard windows form is shown in Listing 2.

Listing 2: Controlling two servos

private void trackBar1_Scroll(object sender, EventArgs e){    servo1.Motors[0].Position = trackBar1.Value;    this.Text = "Phidgets " + trackBar1.Value.ToString()         + " | " + trackBar2.Value.ToString();}private void trackBar2_Scroll(object sender, EventArgs e){    servo1.Motors[1].Position = trackBar2.Value;    this.Text = "Phidgets " + trackBar1.Value.ToString()         + " | " + trackBar2.Value.ToString();}

If you’ve done any .Net programming at all, you should be thinking, “that is super simple”.

It is super simple.

In fact, you should be able to take other devices like the servo and do similar simple coding. The end result is that if you have a little .NET experience, you can be creating robotic type devices relatively fast with the technology that is available today.

Microsoft Robotics Studio

Microsoft has also entered the robotics space. Last month Microsoft released a Community Technical Preview (CTP) of Robotics Studio. This is a platform for creating and debugging robot applications. This platform will work with a number of robotic devices including The LEGO Mindstorms RCX and NXT kits, fischertechnik, and MobileRobots Pioneer P3 DX. You can download the CTP from here.

While the Microsoft Robotics Studio seems a little more complex than the Phidgets APIs, it is designed to work across a wider range of hardware. It also includes a runtime architecture that supports 8-bit, 16-bit, 32-bit, and even multi-core processors and devices.

The Microsoft Robotics Studio is simply an early preview of the software Microsoft is working to develop. The software should evolve to doing more and to supporting more hardware as it nears a final release. In a future article on Developer.com, some of the features of the Robotic Studio will be presented.

In Conclusion…

Software from companies like Phidgets and Microsoft is making it easier for you to automated devices and robots that can do anything your imagination can determine. With hardware readily available, it is only a matter of time before we see even better mass market uses of robotics than toys and sweepers.

# # #

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories