`Chapter ‘[8 - Replicating Renowned Droids
`
`
`
`Introduction
`
`If you’re a fan of science fiction novels and movies like we are, it’s quite natural‘
`to try and reproduce some of their leading robotic characters. Obviously, you
`cannot hope to get even close to the complex behavior they Show in films.Tha1; 9
`would be an impossible task even with resources Well beyond those of the
`MINDSTORJVIS system, but even with a much more modest goal in mind, you,
`will discover this is not an easy tasl<.The difficulties come from trying to model a
`small scale robot after a large—sized one with
`complex shape; something not
`
`easy to reproduce using LEGO parts.
`In this chapter, we describe the clones of two veiy famous robots: R2—D2
`fiom George Lucas’ Star l/Vars saga, probably the most beloved android of all time,
`and Johnny Five/Number Five from John Badhanfs film Short ClI’CI/I2'f.W€ chal-
`lenged ourselves to build both of them using only MINDSTORMS parts, plus
`an optional third motor, with both of them designed for light following, a matter
`not yet explored in the book.As always, you’re invited to use our models as
`starting points for your own variations either in shape or functionality.
`
`if
`
`Building an R2-D2-Style Droid
`
`The “real” R2—D2 is essentially made of a cylindrical body culminating in a
`hemispherical head. Two rigid legs come out from its sides, ending with the
`wheels that provide motion to the robot. R2—D2 is a differential drive. The orig—
`inal character also features a front retractable wheel used only under certain con-
`ditions; in our model this is the third supporting point necessaiy for balance.
`Figure 18.1 shows our R2—D2.You’ll notice it’s more of a symbolic represen-
`tation than a realistic model! The RCX, mounted vertically, constitutes the main
`part of the body, while the head is mimicked by a compound structure of tubes.
`
`
`
`
`
`A
`
`Repiicating Renowned Droids - Chapter 13
`
`351
`
`Figure 18.1 Our R2—D2~Styie Droid
`
`The three motors are behind the RCX (Figures 18.2 and 18.3).Two of them,
`(at the bottom, connect to the Wheels with 21 1:3 ratio,whi1e the third rotates the
`head.As we explained at the begir111ing of the chapter, if you don’t have the third
`motor, you can build a fiXed—he;1d Version of the robot. It, too, will be able to
`follow light.
`
`
`
`
`
`Chapter 18 - Replicating Renowned Droids
`
`Figure 18.2 Front View (with RCX Removed)
`
`352
`
`Each of the drive motors mounts a 24t crown gear, which engages another
`(plain) 24t whose axle ends with an 8t gear. The latter engages a third 24t gear
`connected to the wheel (Figure 18.4).
`The legs are built mainly with plain bricks and 2 X 2 round bricks.They end
`in a 1 x 2 TECI-INIC brick attached to the horizontal beam that locks the upper
`part of the chassis and carries the RCX (see Figure 18.5).The front wheel is a
`simple caster, which is very important for the proper balance of the model.\X/hen
`a robot has a Vertical shape, like R2—D2 has, the position ofits mass is critical for
`its stability during changes of direction and speed. It’s not just a matter of keeping
`the COG inside the supporting base, but mainly of opposing the effect ofinertia,
`which could make your robot flip over (see Chapter 5).
`
`
`
`
`
`
`
`Figure 18.3 Rear View (with RCX Removed)
`
`Repiicating Renowned Droids - Chapter 18
`
`353
`
`
`
`Figure 18.5 Side View
`
`Chapter 18 - Replicating Renowned Droids
`
`354
`
`Looking at the bottom of the robot, you can see the beam that supports the
`pivoting Wheel (Figure 18.6).
`The head mounts a light sensor (Figure 18.7) that you’ll use to locate the
`light source, and gets rotated through a pulley—belt worm—24t gearing system
`(Figure l8.8).This is one of those cases Where pulleys and belts help in transmit-
`ting motion to a distant subsystem. A touch sensor detects the central position of
`the head through the tip ofa cam, With a system similar to the one described in
`Chapter 14 about the steering assembly of a car.
`
`
`
`
`
`
`
`I
`
`Figure 18.6 Bottom View
`
`Repiicating Renowned Droids - Chapter 18
`
`35
`
`
`
`Figure 18.8 The Head Mechanism
`
`356 Chapter 18 - Replicating Renowned Droids
`
`
`
`Programming the Droid
`
`This model of R2—D2 has been conceived as a light follower. The idea is that you
`
`drive it using a source of light, like a flashlight. Though similar to line following
`in some aspects, this task requires a different strategy. The main difference is that
`unlike line following, in which your robot gets consistent readings (that is, the
`light sensor always reads the same values for black or white), when the robot fol-
`
`lows a flashlight beam, the intensity of the driving light will change as the dis—
`tance fioni the source to the robot’s sensor varies.
`
`Thus, you have to differentiate the driving light source from all the other
`
`sources of direct or indirect light in the room.To achieve this, you must scan the
`environment, rotating the head of the robot (or the robot itself) to find the
`strongest Value.Then you will rotate the robot until it finds that intensity again
`(Figure 18.9).
`
`In our first variation in which the robot has a rotating head, the robot is
`stationary; it rotates the head some degrees left, then centers it again at the same
`time reading the light sensors and storing the maximum value into a Variable.The
`following NQC code fragment shows an implementation of the algorithm. It
`assumes that the light sensor is attached to input port 1 and the touch sensor to
`
`
`
`
`
`
`
`Chapter18
`
`35
`
`#define ROTATION__T'IME 50
`
`maxlight_left=O;
`
`OI1Fwd (OUT_B) ;
`
`Wait (ROTATION_TIME) ;
`OnRev(OUT_B) ;
`
`While (SENSOR_3:=O)
`{
`
`light=SENSOR_l;
`
`if (light>maxlight_left)
`{
`
`r
`max1ight_left=light-
`
`light source
`
`
`
`2) come back to
`highest reading
`
`1) locate
`
`strongest source
`
`head of the robot
`
`L Then you repeat exactly the same procedure for the right side, storing the
`m3Ximun1 reading into the /na,\‘lz'g/2f_r1'Lg/zr variable. Now you know VVl1lCl’1 side is
`thé strongest light source, left if l}I(l.X‘/(Lg/lf__/éjfi‘ > Irzax/1'g/zf_;*ig/zr or Vice Versa, and
`_ YOU make the robot turn in place, with its head still and centered, until it finds 21
`
`
`
`
`
` Chapter 18 - Replicating Renowned Droids
`
`similar value. It’s important that your test has some tolerance, as the light intcf
`might have changed a bit from the first moment you read it to the present t
`when you try and aim the robot at it.
`At this point, your robot goes straight for a while, then stops to look for c113
`maximum intensity again and correct its route.
`The variation in which the robot has a fixed head is not too different, just
`.
`change the search procedure to turn the robot in place instead ofits head.You »
`first turn the robot left for a few seconds, then you turn it right for a few second
`
`more while monitoring the readings as in the previous case. The NQC code
`that follows is very similar to the previous example, but uses the drive motors——
`.
`connected to output ports A and C——to make the robot turn. In this case the
`ROTATION_TIl\/LE constant should correspond to the time the robot requires '
`to turn in place at the desired angle:
`
`
`
`#define ROTATIONWTIME 200
`
`maxlight=O;
`
`OnFwd(OUT_A);
`
`OnRev(OUT_C);
`
`Wait(ROTATION~TIMI
`
`LU
`
`‘\
`
`kl
`
`OnRev(OUT_A);
`
`OnFwd(OU”_C);
`
`ClearTimer(l);
`
`while (Timer(1)<ROTATION_TIME)
`
`{
`
`} O
`
`1ight=SENSOR_l;
`
`if (light>maxlight)
`
`{
`
`maxlight=light;
`
`ff(OUT_A+OUT%C)i
`
`When you have determined the maximum reading, rotate the robot until it
`
`reads approximately the same value again.
`
`Acting on the ROT/lTION_TLME constant, you can make your robot
`
`explore all directions 360° around it, or limit its search to a narrower sector.
`
`
`
`
`
`
`
`your robot more toler
`down the Search process.
`In the
`
`adopt a different strategy:
`, one at the corresponding
`ral value is the highest one,
`angle of the route so the
`
`p it for line following you '
`faces down) just behind the pivoting wheel.
`Adding bumpers, on the contrary, is not an easyjob ifyou don’t Want to alter
`the esthetics of the model: R2—D2 ’
`is not Very suitable for cumbe
`By using rotation sensors, you can
`Chapter 4), an appro
`V
`Proximity detection '
`Having extra pieces can niake your R2—
`example, with some plates and l
`'
`18.10), a better approximation to its cylindrical body.
`Figure 18.10 A Section of a Possible Octagonal Body
`
`
`
`
`
` Chapter 18 - Replicating Renowned Droids
`
`.
`
`
`
`You can even remove the pivoting Wheel and make R2—D2 capable of stan
`on two legs by simply placing two aligned wheels into each leg (Figure 18.11).
`Way, the robot is no longer a differential drive and becomes a sl<id—steer drive. To
`use this architecture, it’s Very important you keep the COG (center of gravity) as .
`Close 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 reduce 1.
`the tendency of the robot to overturn when starting or stopping.A high reduction.
`ratio between the motors and the wheels helps, too.
`
`Figure 18.11 A Double-Wheeled Leg
`
`
`
`Replicating Renowned Droids ° Chapter 18
`
`361
`
`Building a lohrmy F§ve~Style Droid
`johnny Five (or Number Five) has a much less compact structure than R2—D2. Its
`body is slim and articulated at many points, and the Whole is supported by two
`large tracks. Replicating this in LEGO is quite a challenging task, especially because
`the 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, but
`you would need many extra parts and, above all, some larger tracks.
`Since We can’t have everything, we decided to be satisfied with just repro-
`ducing some of the main features ofjohnny Five: the triangular tracks, the rear
`pivoting Wheel, a rotating head and two (decorative only) hands (Figure 18.12)
`Figure 18.12 Our Johnny Five—Style Droid
`
`
`
`
`
`362
`
`Chapter 18 - Replicating Renowned Droids
`
`The body ofjohnny 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 a
`peifect right triangle with sides of length 6, 8, and 10 (Figure 18.1 3).The vertical
`1 x 16 beam also serves as a support for the upper wheel of the tracks and the 115;;
`ii
`mechanism. Since the MINDSTORMS kit includes only four track wheels, we
`made two more from a pair of pulleys with a bushing in the middle. The pivoting;
`wheel is not actually necessary to support the robot, but it enhances its look.
`
`A
`
`Figure 18.13 Johnny Five Side View
`
`The gearing of the drive motors is rather simple: an 8t gear on the motor
`shaft engages a 24t gear connected to the drive axles. (Remember that you also
`need a l6t 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 a
`diagonal beam with a quite unconventional slope: this triangle has a base of 2
`studs, a height of7 1/3 bricks that corresponds to 8.8 studs, and a diagonal of 9
`studs.The match is not perfect, but the error is less than three parts in a thousand
`and gives a solid bracing to the motors without disturbing the pivoting wheel
`
`(Figure 18.14).
`
`
`
`
`
`Figure 18.14 Johnny Five Rear View
`
`Repiicating Renowned Droids ° Chapter 18
`
`363
`
` 2
`
`
`
`,,__,Wm_.w,,.,,w,:,._.-.:,;.t».».h,IA-.:y._L...»{|-»»a~:,u..m:
`
`
`
`V.,,.;¢,,,t...a>.,.,.'ax .
`
`
`
`1
`
`Figure 18.15 shows the bottom of the 1'0bot.You’11 notice that Wejoined the
`front axles together to make them more solid, relying on the fact that the track
`e Whee]s are free to rotate on them. On the other side, the rear track Wheels have
`16t gears‘1'r1sid.e. As explained in the MINDSTORMS Constructopedia, this is
`the Way to securely join them to their axle.
`
`T
`
`L
`_
`
`
`
`
`
`
`364
`
`Chapter 18 - Replicating Renowned Droids
`
`
`
`Figure 18.15 Johnny Five Bottom View
`
`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 2-/lt. A cam closes a
`touch sensor when the head is centered (Figure 18.16).
`We got sentimental and rebuilt for johnny Five the same head we designed
`together in 1998 for one of our first MINDSTORIWS projects, called S3 (see
`Figure 18.17).
`
`5%
`
` OTE
`
`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.
`
`
`
`
`
`
`
`
`
`
`3".
`
`V?
`
`Figure 18.16 The Johnny Five Head Mechanism
`
`Replicating Renowned Droids ° Chapter 18
`
`365
`
`Figure 18.17 CIose—Up of the Head
`
`”§§E»?>3L«1§
`
`
`
` Chapter 18 ° Replicating Renowned Droids
`
`Variations on the Construction
`
`
`
`In introducing this robot, We explained that if you want to make your Version
`more similar to the one from the movie, you have to increase its s<:ale.You wfli
`need some extra parts, but those are easy to find.The greatest problem comes
`from the tracks:You can’t use the ones from the MINDSTORMS kit for a larg
`johnny Five, because they’re too small and will make it look ridiculous. Staying
`with LEGO components you have two alternatives: the Cyberniaster tracks and
`the n1odul9.r chain link tracks (see Chapter 9), both of which are 3 bit hard to
`find.The latter represents :1 very flexible solution that allows you to adjust the
`length of the track precisely to your needs, and it’s What We used for Cinque, the ‘
`larger johnny Five~styled robot described on our site (Figure 18.18).
`A
`
`V
`
`Figure 18.18 Cinque, Our Replica of Johnny Five
`
`
`
`
`
`£»AA).u.A4'n.;...,4.t...;t.u...t1m
`
`
`
`«ummwua.:t..q.:pklAnIo1A—.bl“:--_...t..t.m._‘
`
`
`Replicating Renowned Droids = Chapter 18
`
`357
`
`Ifyou’re open to nonoriginal components, you can search toy shops for
`cheap toy tanks: some of them feature tracks that may be adapted to LEGO and
`might fit your needs Very Well. Usually, you cannot use the standard LEGO track
`Wheels. Instead, you have to build suitable ones combining wheels in pairs with a
`half or whole bushing in the middle (Figure 18.19)
`
`Figure 18.19 Nonoriginal Tracks
`
`
`
`coupied wheeis
`with bed? bushing
`
`
`
`
`
`
`
`
`
`
`358
`
`Chapter 18 - Replicating Renowned Droids
`
`Summary
`
`lfyou 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 the
`model. Generally speaking, the bigger the size, the better the result, because the
`size of your elements become less relevant when compared to the size of the
`model, 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 the
`size of some special components, like wheels and tracks, that limit the maximum
`dimension you can aspire to.
`On the technical side, both the droids gave you the chance to see some of the
`theoretical concepts of Part I put into practice. For example, the vertical shape of
`R2—D2 requires the thoughtful application of the ideas expressed in Chapter 5
`about 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 skid-
`steer drive scheme described in Chapter 8.To make its tracks outline a triangular
`shape, We had to build a third pair of tracl<—vvheels; this is a good example of the
`powerful modularity of the LEGO system, which allows you to replicate the
`functionality of one part by using other basic elements.
`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 and
`white pad. Instead, you have to scan the environment looking for the strongest
`light source, and then follow that direction. For line following, we suggested a
`
`e
`
`i
`
`
`
`
`
`Replicating Renowned Droids ° Chapter 13
`
`369
`
`calibration procedure be executed before running the robot along the line in
`order to evaluate the Il’13XLl1"I1ll1’I1 and minimum values the robot should €XpeCt_ In
`the case of light following, this kind of procedure is performed every time the
`robot Wants to decide in which direction it should go.
`We invite you to Visit some of the Web sites listed in Appendix A. Most of
`them will be of great inspiration when it comes to making your own droids.
`
`l1JI
`31
`
`l