1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

LEGO MINDSTORMS - Building Robots Part 11 pdf

40 244 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 40
Dung lượng 1,22 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

360 Chapter 18 • Replicating Renowned DroidsYou can even remove the pivoting wheel and make R2-D2 capable of standing on two legs by simply placing two aligned wheels into each leg Figur

Trang 1

360 Chapter 18 • Replicating Renowned Droids

You can even remove the pivoting wheel and make R2-D2 capable of standing

on two legs by simply placing two aligned wheels into each leg (Figure 18.11).Thisway, the robot is no longer a differential drive and becomes a skid-steer drive.Touse this architecture, it’s very important you keep the COG (center of gravity) asclose as possible to the ground Its vertical right should be in the middle of the sup-port base, delimited by the four touching points of the wheels in order to reducethe tendency of the robot to overturn when starting or stopping A high reductionratio between the motors and the wheels helps, too

www.syngress.com

Figure 18.11A Double-Wheeled Leg

a

b

Trang 2

Replicating Renowned Droids • Chapter 18 361

Building a Johnny Five-Style Droid

Johnny Five (or Number Five) has a much less compact structure than R2-D2 Itsbody is slim and articulated at many points, and the whole is supported by twolarge tracks Replicating this in LEGO is quite a challenging task, especially becausethe RCX and the motors are rather large compared to the size of the tracks avail-able in the MINDSTORMS kit.Things get better if you scale the model up, butyou would need many extra parts and, above all, some larger tracks

Since we can’t have everything, we decided to be satisfied with just ducing some of the main features of Johnny Five: the triangular tracks, the rearpivoting wheel, a rotating head and two (decorative only) hands (Figure 18.12)

repro-www.syngress.com Figure 18.12Our Johnny Five-Style Droid

Trang 3

362 Chapter 18 • Replicating Renowned Droids

The body of Johnny Five has been built around a chassis with a triangular section Looking at the robot from its side, you’ll notice that three beams form aperfect right triangle with sides of length 6, 8, and 10 (Figure 18.13).The vertical

1 x 16 beam also serves as a support for the upper wheel of the tracks and the headmechanism Since the MINDSTORMS kit includes only four track wheels, wemade two more from a pair of pulleys with a bushing in the middle.The pivotingwheel is not actually necessary to support the robot, but it enhances its look

The gearing of the drive motors is rather simple: an 8t gear on the motorshaft engages a 24t gear connected to the drive axles (Remember that you alsoneed a 16t gear inside the track wheel to joint it to the axle.)

The third motor lies on a second layer above the first two, and it’s braced by adiagonal beam with a quite unconventional slope: this triangle has a base of 2studs, a height of 7 1/3 bricks that corresponds to 8.8 studs, and a diagonal of 9studs.The match is not perfect, but the error is less than three parts in a thousandand gives a solid bracing to the motors without disturbing the pivoting wheel(Figure 18.14)

www.syngress.com

Figure 18.13Johnny Five Side View

Trang 4

Replicating Renowned Droids • Chapter 18 363

Figure 18.15 shows the bottom of the robot.You’ll notice that we joined thefront axles together to make them more solid, relying on the fact that the trackwheels are free to rotate on them On the other side, the rear track wheels have16t gears inside As explained in the MINDSTORMS Constructopedia, this isthe way to securely join them to their axle

www.syngress.com Figure 18.14Johnny Five Rear View

Trang 5

364 Chapter 18 • Replicating Renowned Droids

The head mechanism is nearly identical to the one we designed for R2-D2:

A pulley-belt system rotates a worm gear, which engages a 24t A cam closes atouch sensor when the head is centered (Figure 18.16)

We got sentimental and rebuilt for Johnny Five the same head we designedtogether in 1998 for one of our first MINDSTORMS projects, called S3 (seeFigure 18.17)

NOTE

Refer to the earlier section on programming the R2-D2-style droid when programming the Johnny Five robot—the two models can be driven by the same software.

www.syngress.com

Figure 18.15Johnny Five Bottom View

Trang 6

Replicating Renowned Droids • Chapter 18 365

www.syngress.com Figure 18.16The Johnny Five Head Mechanism

Figure 18.17Close-Up of the Head

Trang 7

366 Chapter 18 • Replicating Renowned Droids

Variations on the Construction

In introducing this robot, we explained that if you want to make your versionmore similar to the one from the movie, you have to increase its scale.You willneed some extra parts, but those are easy to find.The greatest problem comesfrom the tracks:You can’t use the ones from the MINDSTORMS kit for a largerJohnny Five, because they’re too small and will make it look ridiculous Stayingwith LEGO components you have two alternatives: the Cybermaster tracks andthe modular chain link tracks (see Chapter 9), both of which are a bit hard tofind.The latter represents a very flexible solution that allows you to adjust thelength of the track precisely to your needs, and it’s what we used for Cinque, thelarger Johnny Five-styled robot described on our site (Figure 18.18)

www.syngress.com

Figure 18.18Cinque, Our Replica of Johnny Five

Trang 8

Replicating Renowned Droids • Chapter 18 367

If you’re open to nonoriginal components, you can search toy shops forcheap toy tanks: some of them feature tracks that may be adapted to LEGO andmight fit your needs very well Usually, you cannot use the standard LEGO trackwheels Instead, you have to build suitable ones combining wheels in pairs with ahalf or whole bushing in the middle (Figure 18.19)

www.syngress.com

Figure 18.19Nonoriginal Tracks

Guiding Infrared Light

Cinque was not our first dual-RCX robot—we had already succeeded in co-coordinating two RCX units through IR messages However, after fin- ishing Cinque, we realized that the two RCXs couldn’t communicate because their IR devices didn’t “see” each other.

Facing the horrible scenario of starting everything over from scratch, we began looking for a solution to guide the IR light between the RCXs IR light, though not visible to the human eye, behaves just like visible light, so what worked with visible light would have worked with the IR, too Our first idea involved LEGO optic-fibres, the ones usually employed together with the FOS unit We tried to position them in front

Bricks & Chips…

Continued

Trang 9

368 Chapter 18 • Replicating Renowned Droids

Summary

If you decide to reproduce one of the famous robots that populate sci-fi movies,you will face difficulties similar to what we described in Chapter 17 about

making robotic animals: matching the form to the function

The process can be made a bit easier by choosing the proper scale for themodel Generally speaking, the bigger the size, the better the result, because thesize of your elements become less relevant when compared to the size of themodel, allowing you to make finer details Unfortunately, sizing up is not always

an option, because you must take into account your own part availability, and thesize of some special components, like wheels and tracks, that limit the maximumdimension you can aspire to

On the technical side, both the droids gave you the chance to see some of thetheoretical concepts of Part I put into practice For example, the vertical shape ofR2-D2 requires the thoughtful application of the ideas expressed in Chapter 5about balancing the robot to oppose the effects of inertia.The Johnny Five model

is the first robot of Part II to use the triangular structures described in Chapter 1

It is also the first one that uses tracks instead of wheels, implementing the steer drive scheme described in Chapter 8.To make its tracks outline a triangularshape, we had to build a third pair of track-wheels; this is a good example of thepowerful modularity of the LEGO system, which allows you to replicate thefunctionality of one part by using other basic elements

skid-This chapter also introduced you to a programming challenge we haven’t discussed yet: light following It has significant differences from line following,because you cannot rely on the constant readings that come from a black andwhite pad Instead, you have to scan the environment looking for the strongestlight source, and then follow that direction For line following, we suggested a

www.syngress.com

of the RCX bricks, but that didn’t work Then we experimented with a mirror, placing the robot in front of it—and found the IR messages could indeed successfully reach both the units We were close to the solution;

we simply needed a small mirror mounted on the robot But did it really have to be a mirror, we wondered, or would something easier work? Breathing sighs of relief, we finally discovered that a simple white reflecting surface was enough to assure a reliable communication You can see our reflector in Figure 18.18: two white tiles close to the top of the left track.

Trang 10

Replicating Renowned Droids • Chapter 18 369

calibration procedure be executed before running the robot along the line inorder to evaluate the maximum and minimum values the robot should expect Inthe case of light following, this kind of procedure is performed every time therobot wants to decide in which direction it should go

We invite you to visit some of the Web sites listed in Appendix A Most ofthem will be of great inspiration when it comes to making your own droids

www.syngress.com

Trang 12

Solving a Maze

Solutions in this chapter:

Finding the Way Out

Building a Maze Runner

Building a Maze Solver

Chapter 19

371

Trang 13

372 Chapter 19 • Solving a Maze

Introduction

Humankind has always been fascinated by labyrinths, and mythology is crowdedwith heroes busy finding their way out of mysterious buildings It was not

unusual for large European 18th- and 19th-century villas to have a hedge

labyrinth in their garden Indeed, mazes of different varieties are still common inthe amusement parks and games of our era

The ability to find your way through a maze is considered a good test ofintelligence and has been used with mice and other animals to measure theircapacities Now the time has come to test your robots, too!

Before building robots capable of solving a maze, you must understand what

“solving a maze” means In other words, we must understand what knowledgeand skills are necessary to find the way out If you ask anybody to solve a simplemaze drawn on a sheet of paper, he or she will probably do it very quickly But if

you ask someone to describe the procedure they used, you will likely receive some

very generic explanations.This happens because human beings tend to ignore thedetails of what they do:They employ the knowledge and experience accumulatedthroughout their life—especially during their childhood—without realizing thatsuch a simple action actually hides a multitude of operations If somebody were

to stop you on the street to ask for directions, would you explain to them what

“turn” and “left” means? Surely not However, in regards to robotics, there’s nobackground knowledge you can take for granted.We explained in Chapter 14that even an apparently easy task like moving around the inside of a room, ordetecting obstacles, requires a thoughtful analysis of the environment and of itsinteractions with your robot

This is also the kind of analysis necessary to implement maze solving: you need

a strategy, and it has to be detailed enough to be translated into program tions for your robot For this reason, we will begin exploring some theories aboutmaze solving, which will lay the foundations for the projects that follow

instruc-On the hardware side, the robots that you will come across in this chapterdon’t require many more parts than what you find in your MINDSTORMS box

We built the Maze Runner robot entirely from MINDSTORMS parts, while theMaze Solver robot used some additional elements unnecessary for the success ofthe first project As well as teaching some concepts about maze solving, thischapter will also strengthen your skills about working with touch and light sen-sors, consolidating ideas that appeared in Chapter 4

www.syngress.com

Trang 14

Finding the Way Out

Even a simple maze, the kind you can solve in a few seconds with a pencil if yousee it printed on a sheet of paper, assumes a completely different perspectivewhen you are inside it If you don’t have any external reference point, and are notallowed to take note of your moves, well, be prepared to spend a few hours!

How can external references or note-taking help you in finding your way out

of the maze? Because they help you understand where you are.To introduce thisconcept, we invite you to perform an experiment:You need a friend who will playthe role of the robot inside the maze, while you simulate the sensors that returninformation about the environment around him.Your friend must find the exitfrom the maze of Figure 19.1 without actually seeing the picture, only by usingyour verbal feedback He can only use four commands inside the maze to directhimself: forward, back, right, and left.You track his position in the maze with apencil, and if his command is acceptable—that is, if the desired direction doesn’tcome up against a wall—you move the pencil to the specified adjacent square,answering “OK”; otherwise, you keep the pencil stationary and answer “wall.”

Will your friend be able to exit the maze under these conditions? Probablyyes, but only after a long time, and with an effort that seems enormous whencompared to the simplicity of the maze In the second phase of the experiment,provide your friend with a squared sheet and a pencil, so he is able to log hismovements.When you answer “OK,” he will move his pencil to the adjacentsquare, too, and when you answer “wall” he will remain in the same square, but

Solving a Maze • Chapter 19 373

Figure 19.1The Test Maze

Trang 15

374 Chapter 19 • Solving a Maze

will mark the specified side of his square with a line which represents the wall.Now things will go much more smoothly for your friend: Looking at his map, hecan avoid visiting the same location more than once, sparing himself many colli-sions and exploring all possible routes until he finds the way out

Some of you may have noticed that the aids mentioned pertain to the twobasic categories described in Chapter 13 regarding knowing your position: abso-lute and relative positioning In fact, the use of external reference points represent

an application of absolute positioning—you use landmarks to locate yourself—while note-taking has many similarities with relative positioning:You deduceyour new location knowing the direction and the distance you covered from theprevious location

Finding one’s way in a labyrinth is, in fact, a special case of navigation andrequires similar abilities, with the addition of some memory to remember whichbranches have already been visited In our previous experiment, the memory wassymbolized by the sheet of paper where your friend logged his moves

Thus, generally speaking, to solve a labyrinth, your robot should be equippedwith a navigation system and a map in its memory.There are some notable excep-tions, like labyrinths that simply require slavish application of a rule to lead you tothe exit, which could be handled by robots with less demanding equipment.The strategies we are going explain work with flat mazes—not just the ones

you can draw on a piece of paper, but any labyrinths that can be represented on a

piece of paper For example, hedge and crystal labyrinths usually belong to thiscategory, provided that they don’t contain any bridges or tunnels

Using the Left Side—Right Side Strategy

This technique solves an incredibly large class of mazes, its rule being quitesimple to remember and apply It states that, when applicable, if you follow theleft wall and turn left whenever possible, you will find the exit Easy, isn’t it?You’re not guaranteed to cover the shortest distance, but you’re guaranteed tofind the way out Actually you can just as easily keep to the right side, the twomethods being complementary and leading to the exit along different paths.Weinvite you to test the rule on the simple maze of Figure 19.1 Imagine physicallyentering the maze and then trying to follow the left wall—eventually, you arrive

at the exit Now try again, this time following the right wall Again you reach theexit, but from a different route (Figure 19.2)

To be more precise, if you follow the right wall, you use the same route youwould if you followed the left wall from the exit to the entrance

www.syngress.com

Trang 16

Solving a Maze • Chapter 19 375

This strategy has a great advantage in that you need not know anything aboutyour position and orientation.The only abilities required are that your robot canfollow a wall and that it can recognize the exit when it’s there

At this point, the crucial question is:When can you apply this rule? There areessentially two cases in which you can do this:

1 When the maze is flat, and has both the entrance and exit placed alongits perimeter (as in Figure 19.2)

2 When the maze is flat, and the entrance and exit are points arbitrarilychosen anywhere in the maze, where the latter doesn’t contain anyloops.That is, it doesn’t contain multiple paths that connect any twopoints (Figure 19.3)

The rule covers many practical cases It doesn’t work when the entrance and

exit are not along the perimeter and the maze contains loops, as in Figure 19.4.

Notice that the route covered following the left wall brings you back to theentrance without reaching the exit point

www.syngress.com Figure 19.2Following the Right and Left Walls

Trang 17

376 Chapter 19 • Solving a Maze

Applying Other Strategies

When you cannot apply the rule previously stated, you rely on two strategies:

1 Executing random turns

2 Tracking your routeThe first one says that whenever you find yourself at an intersection, youdecide which way to go at random.Though this method is guaranteed to find

www.syngress.com

Figure 19.3The Exit Is Inside a Maze with No Loops

Figure 19.4The Exit Is Inside a Maze with Loops

Trang 18

Solving a Maze • Chapter 19 377

the solution sooner or later, that “later” can be a very, very long time if the mazeincludes more than a handful of intersections!

The second approach solves the more general case of mazes with more than afew intersections, but requires two valuable ingredients: a position control systemand a memory.You must be able to recognize each intersection and mark thebranches already explored so as not to explore them again.The right side rulecan still be useful as a basic rule, but when you find yourself in a place you’vealready been, you must be able to backtrack to the first intersection with unvis-ited branches and take one of those

We imagine you already see the difficulties in this:You must provide yourrobot with an affordable navigational aid and with an inner map to represent themaze so you can mark the visited corridors Don’t worry, this time we won’t testyour patience with trigonometric functions and dead reckoning If you read on,you’ll see that we suggest a Maze Solver that doesn’t require anything but thebasic MINDSTORMS equipment and some programming skill

But let’s start with something simpler.The first robot of this chapter, theMaze Runner, has been designed to apply the left side rule inside a maze

Building a Maze Runner

The first robot of this chapter applies the left-side rule and follows the left wall ofthe maze toward the exit It has no intelligence, only an ability to follow a wall

Constructing the Maze Runner

To construct the Maze Runner, we used a differential drive configuration and acouple of touch sensors.The whole robot may be replicated with parts solelycontained in the MINDSTORMS set (Figure 19.5)

It works on a very simple principle: one side sensor “feels” the wall, so therobot can always remain in touch with it, turning left when necessary.This coversthe case of straight walls and of left turns, but the robot will also have to face sit-uations where it hits a wall in front of it and must turn right For this reason, weequipped it with a second sensor, that detects front collisions In Figure 19.6, yousee the robot without the RCX, and can distinguish the two touch sensors, bothkept closed by the pressure of a rubber band

The left side bumper, the one with the horizontal wheel at its end, isdesigned to touch the wall, while the other detects the closed corners thatrequire a right turn

www.syngress.com

Trang 19

378 Chapter 19 • Solving a Maze

www.syngress.com

Figure 19.5The Maze Runner

Figure 19.6Top View (RCX Removed)

Trang 20

Solving a Maze • Chapter 19 379

For the differential drive, we used one of the simplest configurations shown

in this book: A single stage geartrain made out of a 40t attached to the wheel and

an 8t connected to the motor shaft (Figure 19.7)

Our robot is very low to the ground because we placed the motors below thebeams that support the wheels, but in this kind of task we don’t need a lot ofground clearance and this solution keeps the assembly nicely compact (Figure 19.8)

www.syngress.com Figure 19.7Left Side View (Drive Wheel Removed)

Figure 19.8Rear View

Ngày đăng: 10/08/2014, 04:22

TỪ KHÓA LIÊN QUAN