Задани на лабораторные работы. ПРК / Professional Microsoft Robotics Developer Studio
.pdf
www.it-ebooks.info
Chapter 13: Using MRDS with Robotics Hardware
In order to run MRDS, the onboard PC on the robot must have .NET V2.0 installed. You don’t run Visual Studio on this PC (unless, of course, it is a laptop, in which case you can run whatever you like). Instead, you develop the services on a desktop PC and download them to the robot’s PC.
In addition, it is not necessary to install the full version of MRDS on the robot because a utility called DssDeploy can be used to package up a set of services. (DssDeploy is discussed in Chapter 3 for desktop PCs, and again in Chapter 16 in relation to installing a package on a PDA or embedded PC.) It automatically determines the dependencies and includes the necessary components to make a run-time version of MRDS. This saves memory, which is often at a premium on an embedded PC or PDA.
The procedure you use to deploy your services to the robot varies according to the type of PC that you are using on the robot and the communications hardware that it has installed. Common approaches include using USB flash drives, connecting via WiFi, and even downloading via a serial port, although this should be avoided because it is extremely slow.
Buying Your First Robot
The type of robot you choose to work with depends on several factors, including the intended purpose and your level of expertise with hardware. (It is assumed that you are competent with software!) As previously stated, this is an introductory book and it does not cover industrial robots, but the principles that apply to educational robots also apply to industrial robots. For example, KUKA is a major manufacturer of industrial arms, and they have developed MRDS services and a set of tutorials, available from www.kuka.com.en.products/software/educational_framework.
Several robots have been selected for use in the examples in this book and are outlined briefly below. They cover a range of different types and prices, although the objective has been to keep them within a price range that a student or hobbyist can afford. If you are a teacher, then it is important to keep the price down because you need multiple robots in the classroom (as well as PCs).
Information on prices is deliberately vague because prices are constantly changing.
Conversely, if you are a researcher, then you might have access to some very expensive robots (such as the MobileRobots Pioneer 3DX) and devices (such as a SICK Laser Range Finder) that are supported by MRDS. The principles in this book translate to research robots as well, and MRDS has already been used successfully to control a Segway with a robotic arm balanced on top, a car for the DARPA Urban Challenge, an unmanned underwater vehicle, and even a huggable robot. For the latest examples, see the Microsoft Robotics Developer Studio Community web page at http://msdn2.microsoft.com/ en-au/robotics/aa731519.aspx.
It is clearly not possible to cover every available model of robot. This is especially true for home-brewed robots. Questions are often posted to the Microsoft Robotics Developer Studio Discussion Forum at http://forums.microsoft.com/msdn/default.aspx?forumgroupid=383&siteid=1 from new users who are hoping to build their own robots. Some of these people have unrealistic expectations about what their robots will do (probably because of what they have seen in science-fiction movies) and how easy it will be to build and program them.
573
www.it-ebooks.info
Part IV: Robotics Hardware
General Recommendations
If you have no experience with robots, then it would be best for you to select a robot kit or even a pre-assembled robot as your first choice. With that in mind, here are some general recommendations:
MRDS uses Windows platform code only. A common type of question is “How do I program my brand xxx robot with an onboard model xxx PIC microcontroller using MRDS?” The answer is, you don’t! MRDS does not generate code for anything other than Windows platforms. (Actually, it generates .NET code, which is platform-independent, but that basically limits MRDS to the various flavors of Windows.)
If your robot has some sort of onboard CPU and you want to program it directly, then you should investigate the options available from the manufacturer. Many robots, including the LEGO Mindstorms NXT, Parallax Boe-Bot, RoboticsConnection Stinger, and so on, have programming tools available for them that enable you to run programs directly on the robot.
In some cases, these are GUI tools similar to VPL. In other cases, they might use C-like languages or BASIC.
Use a wireless connection between your PC and your robot. This eliminates the need to attach the robot to the PC via a serial cable, which severely limits the robot’s freedom to move around. Many of the robots on the market have a Bluetooth module, although it is sometimes an optional extra. This requires Bluetooth hardware to be installed in your PC; otherwise, you have to purchase a USB-to-Bluetooth device. For testing robots within a typical office or laboratory environment, Bluetooth provides adequate range and is usually reliable.
An alternative to Bluetooth that is becoming popular is ZigBee radio (see the official website at www.zigbee.org/en/index.asp). It has similar capabilities to Bluetooth and the communications modules cost about the same.
If you can, get a robot with a WiFi (wireless Ethernet) interface. More expensive robots, especially research robots, often use what is called serial Ethernet whereby the serial port on the robot is connected to an Ethernet interface. Packets are sent to and from the robot exactly as though the PC were connected via a COM port and a serial cable — the WiFi connection is transparent to the robot.
Robots Discussed in This Book
In selecting robots for this book, several factors were taken into consideration. The purpose of the book is not to teach robotics, but rather to demonstrate how to use Microsoft Robotics Developer Studio to control robotics hardware. Therefore, the robots were chosen for their educational value. They are not industrial robots. However, they do cover several categories of robots, including mobile robots (both autonomous and tethered) and articulated robotic arms. As stated previously in this chapter, humanoid and legged robots have deliberately been omitted. Much of what you learn from a robotic arm is applicable to legged robots because they both rely on joints.
574
www.it-ebooks.info
Chapter 13: Using MRDS with Robotics Hardware
A good starting point for information about other robots is the MRDS Community Page, which contains the latest list. It can be accessed from the Community tab on the MRDS home page or using the following URL: http://msdn2.microsoft.com/en-au/robotics/aa731519.aspx.
You should also check the vendor’s website for the latest information and software for your robot. Most robot vendors have discussion forums or support pages, including Frequently Asked Questions (FAQs) or Knowledge Bases.
The last chapter in this book (Chapter 17) explains how to set up new robot hardware, but it is recommended that you first gain some experience with one of the robots listed here. The two robots in Chapter 17, the Integrator from Picblok and the Hemisson from K-Team, are not mentioned below because they don’t have the same level of support as the other robots.
Note that the robots are listed in order of complexity for new users, so if you are a novice you might like to start with the first robot and work your way through the list. Over a period of time, you might want to buy more than one of these robots. Each of them has its own advantages and disadvantages, and they will all teach you different lessons about robotics.
LEGO Mindstorms NXT
The primary advantage of the LEGO Mindstorms NXT kit is that it doesn’t require any tools or special skills. Everyone knows how to assemble LEGO, right?
The LEGO Mindstorms NXT kit, which is the successor to the RCX, is a great robot to get started with. It sells for different prices around the world, but in the United States it retails for around $250. It is easy to build and has built-in Bluetooth. You can also design your own robots and even switch from using wheels to legs. You are limited only by your imagination and how many LEGO blocks you own. See http://mindstorms.lego.com/Products/Default.aspx.
The basic intelligence is provided by a pre-built “brick,” and Bluetooth is built right into the brick. LEGO offers a wide variety of sensors for the NXT, and there are third parties that sell NXT sensors. A disadvantage of the LEGO NXT brick is that it can only handle four sensors and three motors. The motors have internal encoders to measure rotations, but the maximum resolution is 360 ticks per rotation.
The LEGO NXT Tribot (which can be used in the simulator and is supported by MRDS) requires about an hour to assemble. However, the LEGO Mindstorms NXT kit can also be used to build other robots. There is an active online LEGO NXT community. Due to its popularity, the LEGO NXT Tribot is covered in Chapter 14. Figure 13-3 shows a LEGO NXT Tribot loaded up with a range of sensors.
575
www.it-ebooks.info
Part IV: Robotics Hardware
Figure 13-3
In October 2007, Microsoft released updated services for the LEGO NXT that provide additional features and support third-party sensors such as the HiTechnic Compass. Make sure that you download and install these services, or preferably install the MRDS V1.5 Refresh.
Parallax Boe-Bot
Parallax also makes a robot called the Boe-Bot that is available in kit form specifically for MRDS, which includes a Bluetooth module and a USB-to-serial device, for about $210 (U.S.). The Boe-Bot uses a BASIC Stamp for its onboard intelligence — the same processor used in the Scribbler discussed below. See www
.parallax.com/ProductInfo/Robotics/BoeBotRobotInformation/tabid/411/Default.aspx.
If you are considering buying a Boe-Bot, make sure you order the kit specifically for MRDS, which is shown in Figure 13-4. You can see an assembled Boe-Bot in Chapter 14.
576
www.it-ebooks.info
Chapter 13: Using MRDS with Robotics Hardware
Figure 13-4
The Boe-Bot is a slightly more complicated robot to build than the LEGO NXT, but it is cheaper. The instruction book that comes with the Boe-Bot is quite easy to understand. The most difficult task is adjusting the servo motors for the wheels so that they don’t turn when you set the speed to zero. If you are an experienced programmer, though, you might find that it is too low-level. This is because the intended audience is students age 13 and older.
A primary advantage of the Boe-Bot, at least in an educational setting, is that it has a small breadboard on the Board of Education (BOE) circuit board. A set of electronic components, included in the kit, can be used to build sensors directly on the robot. These components include LEDs for displaying program status, a piezoelectric speaker for making sounds, and the necessary parts for simple infrared detectors. If you have a background in electronics, you can design and implement your own sensors or other output circuits without soldering.
Additional sensors are also available from Parallax, including sonar and a line-follower kit. These are not supported under MRDS, so you would have to write your own services.
The Boe-Bot uses a BASIC Stamp for its onboard intelligence. The BASIC Stamp Editor is a languagesensitive editor that understands and compiles PBASIC code. It also takes care of downloading to the Boe-Bot, making it a trivial task. Extensive documentation is provided and PBASIC is fairly easy to learn.
577
www.it-ebooks.info
Part IV: Robotics Hardware
In any case, you shouldn’t need to use PBASIC because you can simply load the monitor program into the Boe-Bot and then control it remotely using MRDS on your PC via Bluetooth.
Although the Boe-Bot is supported in MRDS V1.5, the support is patchy. Some of the code is supplied with MRDS; the rest you have to download from Parallax. Therefore, the authors provide improved versions of the Parallax services for the Boe-Bot with this book in Chapter 14. The updated services enable you to flash LEDs and sound the buzzer. They also implement the DriveDistance and RotateDegrees operations, which are missing from the MRDS services. Lastly, they also include Compact Framework (CF) versions of the services. Chapter 16 provides instructions on how to drive your Boe-Bot using a PDA with built-in Bluetooth, such as the Dell Axim X50v.
Lynx 6 Robotic Arm
If you are interested in articulated arms, the Lynx 6 is a reasonably priced (about US$390) and fully functional arm, which is shown in Figure 13-5. Lynxmotion also has more robust, and expensive, arms available. See www.lynxmotion.com/Category.aspx?CategoryID=25 for more information.
Figure 13-5
Don’t be misled by the picture of a Coke can in Figure 13-5. The arm is nowhere near strong enough to lift a full can. It is just there to show you the relative size of the arm.
The Lynxmotion L6 is a five DOF (Degrees of Freedom) articulated arm with a gripper. The axes include the Base (rotate), Shoulder, Elbow, and Wrist (Rotate and Tilt). There is also an L5 model, which is cheaper because it doesn’t include the Wrist Rotate, but the L6 is a better choice.
Because dealing with joints in articulated arms is so different from the wheels on a differential drive robot, it is something that you would do only if you had a particular interest in or reason for using an arm. These differences are one of the reasons why the L6 is covered separately in this book in Chapter 15.
There is some very complicated mathematics involved in moving an arm, called inverse kinematics. The software supplied with this book takes care of this, but there is more to it than calculating the necessary joint angles to move the end effector to a specified pose. You also need to consider the speed and torque limitations of the robot. Otherwise, you can damage your robot by inappropriate movements.
578
www.it-ebooks.info
Chapter 13: Using MRDS with Robotics Hardware
The L6 comes as a kit that you have to assemble yourself. It is a more involved task than the Boe-Bot and takes much longer to put together and test. It is not a job for inexperienced users. The parts are made out of lexan (a very tough plastic) and have very tight tolerances, making them hard to fit together.
There is software supplied with the L6 called LynxTerm that can be used to control the servos. This is a good way to test the robot prior to using MRDS. Another much more sophisticated program called RIOS is also included.
All of the assembly guides for the L6 are online, so you have to download or print them. You should read the guides before purchasing the L6 because the construction is fairly involved and you need some tools that are not included in the kit. If you have no experience in building kits, then this is probably not a good robot to
start with.
RoboticsConnection Stinger CE
The final robot, shown in Figure 13-6, is the Stinger CE from RoboticsConnection, which costs around US$525. It is an autonomous robot that uses the eBox-2300 running Windows CE (hence the “CE” in the name of the robot). You can get more information at www.roboticsconnection.com/pc-78-3- stinger-windowsce-kit.aspx.
Figure 13-6
RoboticsConnection originally released a robot called the Traxster (because it uses tracks or treads) that was supported under MRDS V1.0. It uses the Serializer controller board. The Serializer is the core component of a new robot called the Stinger. See www.roboticsconnection.com/c-3-robot-kits
.aspx for more information. The Stinger is the successor to the Traxster.
579
www.it-ebooks.info
Part IV: Robotics Hardware
Communication is via a serial port. The eBox attaches to the top of the Stinger and then connects to the Serializer using a serial cable, thereby making the robot autonomous. However, there are alternatives with a variety of communication modules available for the Serializer, including Bluetooth, ZigBee, and WiFi.
For example, you can purchase a standard Stinger robot with a Bluetooth module. It can then be driven in the same way as the LEGO NXT or the Boe-Bot. This enables you to become familiar with the Stinger and the Serializer board without the additional complexity and cost of the eBox-2300.
The eBox-2300 is the same PC104 computer that is used on the Sumo robots based on the iRobot Create. Some of the instructional material on the Stinger is also applicable to the Sumo robots because they use the same onboard PC. However, the Stinger has to be built from a kit, whereas the Create comes already built. This gives you a lot more flexibility regarding how you arrange the sensors, and which sensors you put on the robot, but at the cost of your time and labor.
Unless you have some prior experience with building kits, this should probably not be your first robot. The Stinger itself is easy enough to build. It comes with a great set of instructions in a multimedia PDF file that includes 3D animations and synthesized voice instructions. However, setting up Windows CE and developing code for it is more complex than programming for Windows XP or Vista. This makes the overall task more difficult.
The Stinger instructions require Adobe Acrobat version 8.1 or later and a sound card in your PC. The actual PDF file is around 21MB and must be downloaded from the RoboticsConnection website.
Support for the Stinger under MRDS V1.5 is available from the RoboticsConnection website. Chapter 16 discusses how to use the Stinger CE with MRDS and run services directly on the robot. An optional WiFi card is also available for the eBox, although it is not necessary because the eBox can run on its own.
Other Robots Supported under MRDS
The following is a very brief summary of some other robots that are available and suitable for use with MRDS without a significant amount of additional programming.
Because bipedal, or humanoid, robots tend to be much more expensive than wheeled robots, no recommendations are made here. The only humanoid robot supported by MRDS V1.5 is the Kondo KHR-1. Humanoid robots rely on joints in a similar way to robotic arms, so using a robotic arm is a good starting point.
Similarly, quadruped robots (usually robotic dogs) have also been ignored. There have been competitions for these types of robots in the past, but the robots are expensive, and until Microsoft ran
a competition using the RobuDog simulation from Robosoft (www.robosoft.fr/eng/index.php), they were not supported under MRDS. The RoboCup RoboSoccer Four Legged League (www.robocup.org) has used the Sony AIBO in the past, but since 2008 the league has been renamed the Standard Platform League and will be based on a new humanoid robot called the Aldebaran Nao from Aldebaran Robotics. Refer to www.aldebaran-robotics.com/eng/index.php for more information.
The list of robots supported by MRDS is constantly changing, especially as third parties develop their own services. This type of information becomes obsolete very quickly. The following list is in order of increasing price.
580
www.it-ebooks.info
Chapter 13: Using MRDS with Robotics Hardware
Parallax Scribbler
If you are simply interested in learning about robotics and have no prior experience, then a prebuilt robot is probably the best starting point. For example, the Scribbler robot from Parallax (www.parallax
.com/ProductInfo/Robotics/ScribblerRobotInformation/tabid/455/Default.aspx) is relatively cheap (around US$80) and comes preassembled and ready to use out of the box. It is more like a toy — it is very basic and cannot be expanded. You need to buy a Bluetooth device to attach to the robot so that you can operate it without using a serial cable. The Sena Serial-to-Bluetooth device (see Chapter 16) is suitable for this.
MRDS services for the Scribbler were originally developed by Ben Axelrod for the Institute of Personal Robotics Education (IPRE) while he was a graduate student at Georgia Tech. Services for MRDS V1.5 are available from the IPRE resources page: www.ipre.org/resources.html. Note that you have to update the firmware inside the Scribbler to use the IPRE services.
IPRE has developed a hardware “dongle,” called a Fluke, that has an onboard color camera, IR range sensing, internal voltage sensing, an extra-bright LED, and Bluetooth. These became available for purchase in early 2008 and cost about US$80. It plugs into the Scribbler’s serial port and can reprogram the Scribbler’s firmware by downloading code over Bluetooth. This is an attractive alternative to buying a serial-to-Bluetooth device. The Fluke is shown attached to a Scribbler in Figure 13-7, courtesy of Tucker Balch at Georgia Tech.
Figure 13-7
This device is interesting for two reasons. First, the inclusion of a camera shows the importance that educators place on vision for robots. Second, it is likely that small robots combining the functionality of the Scribbler and the Fluke will become available, which raises the bar for entry-level robots.
Note that IPRE provides educational materials for teaching robotics, but the Myro (My Robotics) software is based on Python and it does not use MRDS. This will change over time.
iRobot Create
Another alternative is the iRobot Create (www.irobot.com/sp.cfm?pageid=305), which is basically a Roomba vacuum-cleaning robot without the vacuum cleaner, redesigned specifically for educational purposes. It is relatively cheap, at about US$130, and it comes preassembled. You will also need to buy a Bluetooth device. Unfortunately, at the time of writing the Create is not available for sale outside of the U.S.A. and Canada.
581
www.it-ebooks.info
Part IV: Robotics Hardware
The Create is discussed in Chapter 9 in relation to the sumo competition that Microsoft ran in 2007. Figure 13-8 shows one of the robots used in the sumo competition with an eBox-2300 and a Logitech webcam mounted on top. A simulated iCreate is also used in Chapter 12 for line following and sumo.
Figure 13-8
The iRobot Roomba and Create robots have a microcontroller that can be controlled directly via a serial port. You can attach a Serial-to-Bluetooth device to the serial port on the robot and control it. The firmware is already installed and the serial protocol is clearly documented. The RooTooth (www.roombadevtools.com) is a popular device for Bluetooth connections.
Surveyor SRV-1
If you are interested in computer vision, then you might want to consider the Surveyor SRV-1 for about US$465 (www.surveyor.com).
This robot was undergoing a major revision at the time of writing, with the onboard computer
being upgraded to a much faster Blackfin processor. Figure 13-9 shows the original SRV-1 (left) and the upgraded SRV-1b (right). Its main advantages are that it is preassembled; includes a camera; and offers a choice of Bluetooth, ZigBee, or WiFi. There is software for computer vision available from RoboRealm that supports the SRV-1 and works with MRDS (www.roborealm.com/help/MSRS.php).
Figure 13-9
582
