`
`
`
`,wW,§.Sm.w_....,
`
`
`
`
`
`
`
`
`
`
`
`..,.....,...W..,wmfkrxw,....em........._iiuz
`
`a»m« '
`
`VR‘14<7¢’wveyy
`- Mm.‘
`
`»
`
`§...:.u
`
`.a.:..
`
`u5
`
`wan.E31
`
`.3...amaan
`
`am‘
`
`§
`
`Q...
`
`,C
`
`an.
`
`fgma
`
`Gsiéfiigi am 3?
`
`.zw_,..,‘.tz,_y.
`
`
`
` 514
`
`Chapter 26 * Racing Against Time
`
`introduction
`
`This chapter opens the third section of the book, where we explore the world of
`MINDSTORMS robotics contests and challenges.The three chapters that make
`up this section are mainly based on our direct experience, accumulated while
`attending competitions organized by the Italian LEGO Users Group (ltLUG).We
`won’t be discussing the specific details of the contests we participated in, instead
`we’ll be providing you with a good starting point for more general considerations.
`The first section of this chapter is about robotic contests in general.We will
`explain what robotics contests are all about, from the definition of the rules up to
`the course of competition. For those of you interested in participating in LEGO
`robotics contests, we’ll give you some hints about how to find a LEGO Users
`Group not far from where you live.
`In the later sections of the chapter, we will introduce contests related to pure
`speed, as well as those demanding great amounts of mechanical. and programniing
`acumen.There are many different kinds of contests and challenges. Because of
`this, we grouped them into three categories: contests based on speed, contests
`based on strength, and contests based on ability. These categories are not absolute,
`because most of the competitions require a inix of these capabilities. For
`example, a line following contest is mainly about speed, but each robot is also
`required to run without departing too much from the line. Nevertheless, we tried
`to sort a few typical contests into the categories previously mentioned because in
`our opinion this helps in focusing on their key points.
`
`
`
`Hosting and Participating in Qontests
`A contest offers many opportunities to learn new concepts and build some eXpe—
`rience.We can identify at least four main phases of participating in a contest, each
`one requiring extensive usage of your know—how while contributing to your
`knowledge base. They are:
`
`1. Defining the rules Participating in this phase depends on whether you
`are the one who organizes the contest, or part of a group that does.
`Unless you’re deciding on your own, this will prove a very creative
`moment, where the group develops a list of rules, adjusting them until it
`feels they are meaningful and consistent.A set of rules always has a spe-
`cific purpose (whether declared or not), which has been chosen to test
`the ability of the competitors on a specific field.The “legislator” should
`take care to close any possible loopholes that might allow a contestant to
`
`
`
`
`
`515
`
`Racing Against Time ° Chapter 26
`
`
`
`escape the main difficulties of the contest, which requires that he/she
`imagine all the possible approaches to the problem.
`
`2. Studying the rules and deciding on a strategy From this moment
`on, you are in the competitive arena, and must find a strategy to beat
`your competitors. Don’t limit your choices to what the organizing com-
`mittee expects you to do. In our experience, most contests have been
`won by people who found a very original way to interpret the rules
`without violating them.
`L») Building the robot This phase will very likely present some surprises
`to you. Implementing your desired strategy, you’ll discover new con-
`straints and opportunities you hadn’t thought of while imagining your
`robot. As for programming, we strongly suggest you stay with simple but
`solid strategies. Only when you’re sure the basic behaviors work as
`expected, should you add in the more sophisticated components, making
`sure not to introduce bugs in the previous code.You can’t imagine how
`many matches you can win by simply not getting too fancy!
`4. Attending the contest This is the most exciting moment~—on the
`field, testing your ability against your competitors’! lt’s also the moment
`to learn: study the other robots and their strategies; observe the course of
`the matches, Don’t be frightened to ask for explanations and details,
`most of the builders are usually more than happy to describe their crea-
`tures.All that you learn will be useful for other contests, whether run on
`the same set of rules or not. One last suggestion: never throw in the
`towel before the end, anything can happen during the event.The
`strongest competitors aren’t always crowned winners.
`
`
`
`We imagine some of you are thinking right now: okay, very interesting, but
`where do I find a contest that isn’t light years from home? Remember, the
`Robotics Invention System is a’ tremendous success.With a bit of luck you may
`find an already organized LEGO Users Group in your area. Many exist in the
`’
`23
`US. Canada and Euro e, covering most re ions and maor metro olitan areas.
`Use the Internet to search for other MINDSTORMS fans.Tlie best resource
`is the LEGO Users Group Network (LUGNET), which lists dozens of local
`groups. Many of them also have their own Web site, which shouldn’t be difficult
`to find using any search engine. Once you’ve found a group, or some individual
`users, there’s no certainty that anyone’s going to leap up and organize a robotics
`contest fi'om time to time. But you, yes you, can be the one to get the ball rolling
`(or robots rather).
`
`
`
`
`
`516
`
`Chapter 26 ° Racing Against Time
`
`
`Last but not least, try to attend some remote challenges, contests that don’t
`require your presence in person. Usually all you send are some pictures of your
`robot, a copy of the software, and a short description of how it works. In code-
`only contests, this concept is pushed to the extreme limit: the organizing com-
`mittee distributes the plan of a standard robot, and all the competitors send their
`own code via e—mail.The design of the robot is usually simple and doesn’t
`require any special or rare parts, so that a large number of competitors can repli-
`cate the robot at home to debug and test the code.
`LUGNET is the best place to find information about contests of all sorts, as
`most local groups advertise the contests they organize there. Usually they refer
`you to aWeb site where you can find all the details about the time, place, and
`rules of the contest. Some user groups require a small admission fee for each
`robot, which funds the prize for the winner. Events are characterized by a very
`friendly atmosphere, and you’ll be welcomed even if you just go to watch.
`
`
`
`The first challenge vve’ll. describe here concerns pure speed. Don’t make the mis-
`take of thinking speed is purely trivial and poses few challenges in terms of
`robotics.\7Ve’ve been proven wrong on this score ourselves. Even a straight—out
`speed race promises surprises.
`
`Drag Racing
`A starting line, a finish line, the fastest robot to cover the distance wins. Described
`in these terms, the race sounds a bore. But stay tuned, and take a closer look at
`the implications of this definition.
`The speed of a vehicle is affected by a number of factors: motor power, gear
`ratio, mass, friction.‘ Using electric motors, the maximum power you can apply to
`your racecar depends on the kind and number of motors, and the current you
`supply them.There’s only one kind of motor in MINDSTORMS, which forces
`upon us a simple rule: use as many motors as allowed.
`As for their supply of energy, the rules should outline some restriction, like
`the adoption of the same kind of batteries for all the competitors (e.g., standard
`commercial alkaline batteries). Should this not be carefully stated, someone could
`take advantage of a custom battery setup——which is exactly What happened
`during our dragster race!
`
`
`
`
`
`
`
`Racing Against Time '- Chapter 26
`
`517
`
`
`
`‘»c>rri’i§-et.Eir9nr%4s%'ng.:e:gI*it_"
`.
`_
`’eCaus;é,NiMHiCé sf ‘
`
`~«ii.u;2r"V‘list-i1'1[nb<2.1E:m?‘5n‘A4t‘t"3lFi;‘-1fAn'1v(4.‘.k~:&::3»'v»I~:\~.9/E-i7“‘?.‘r:"F"
`
`
`
`
`
`
`
`
`
`
`
`
`As for the gear ratio and mass, which have a strong influence on the accele:ra—
`tion rate of your vehicle, here is a short list of tips:
`
`The shorter the gear, the shorter the time it takes to reach the maximum
`speed.The problem is that a short gear also has low top speed.You have
`to balance the two effects, and the optimal choice depends also on the
`length of the race: favor acceleration on short tracks, and maximum top
`speed on longer ones.
`
`Build our robot in a wa I that allows eas ’ re lacement of the Gears so
`3
`a
`»
`
`you can experiment with different ratios in a time—eff1cient manner.
`
`Keep the gearing pared down to the essentials
`stage adds some friction.There’s no need for a differential gear, since the
`dragster travels on a straight run.
`
`remember that each
`
`The diameter of the wheels has its role in the conversion ofpower to
`speed. If you substitute the wheels of your car with ones half the diam—
`eter in size, you get the same effect as if you had reduced the gear ratio
`by a factor of two.
`
`
`
`
`.‘-‘l:.4.‘>.:a.I.u.;...xL.‘...:.n.;..'«.a_~..i...;_.4.~..;.r..;.;.....;4....‘.._.‘=<i....l.t«.4‘Lv<‘.,,.
`
`
`
`
`
`
`
`
`518
`
`Chapter 26 - Racing Against Time
`
`
`
`H Acceleration is also influenced negatively by the mass you have to move:
`under the same power, the higher the mass, the lower the acceleration.
`This is due to inertia (see Chapter 5), which explains why it’s harder to
`get a car rolling than it is to push a child in a stroller. So a very impor-
`tant thing to do is to keep the mass at a minimum. Build a lightweight
`StT.'1lCt1lI‘€.
`
`Up to this point, the challenge is essentially electro«mechanical. No need for
`an RCX, a vehicle supplied by a battery box would perform the same, or even
`better (recall that the RCX has an inner current—limiting device, the battery box
`doesn’t).To create the necessity of at least a few lines of code, in our dragster race
`we introduced the rule that the dragsters had to stop a Very short distance after
`the finish line. As a result, we had three lines: start, finish, and braking limit. In
`our particular case, the run was Sm (about 5.5 yards) with a braking distance of
`20cm (less than 8 inches).
`The robots had been equipped with. a face—down light sensor to detect the
`finish line, and a portion of code, the same for all the robots, to time the run and
`register it in the datalog.
`Every competitor quickly discovered that braking inside the limit was not so
`easy. The fastest dragsters covered the distance in about 3 seconds, at a speed of 6
`km/h (3.6 mpl1).We initially tried to switch the motor ofi at the finish line, but
`this wasn’t enough.Then we reversed the motor to increase the braking effect,
`but it still wasn’t enough braking power. Nobody wanted to reduce the speed of
`their dragster just to keep up with the braking limit. Surprisingly, most competi-
`tors developed the same solution: start braking before the finish line. Timing the
`performance of our dragsters without any braking, we registered the time they
`needed to cover the distance.Then we wrote some code to reverse the motors a
`few moments before reaching the finish line, trimming this advance until the
`robot stopped exactly at the extreme limit.
`
`Combinng Speed with Precsion
`\When you move fiom races based on pure speed to those that require additional
`skills, your projects become more compleX.A.ll the considerations listed in the pre—
`vious section still apply—batteries, motors, gear ratio, n1ass——but you must also take
`new variables into account. Speed will actually become what makes your task more
`difficult: when you design a robot for yourself, you usually feel satisfied when it
`works; but when you have to build and program it to be as fast as possible, some
`techniques that worked at a slower pace prove unsuccessful at higher speeds.
`
`
`
`
`
`
`Racing Against Time ° Chapter 26
`
`
` .:-.z.'e—v.~.-«rm-1,.’~aa:a:‘“‘=<4Taz»a~g.vea‘"~"34'“~'“"""7"“'“““'“""‘
`
`
`
`Sometimes you reach a point where you cannot increase speed without com-
`promising the reliability of your robot. This is the time when a further improve-
`ment can come only from a pamcfigm slzyi‘, a change fi‘om one way of thinking to
`another.A good example of this was described in Chapter 14.You probably
`remember we initially approached line following using the same diflerential drive
`platform we used to navigate a room. lt worked, but when we tried to achieve
`better performance, we had to move to a different architecture: a steering drive.
`This principle can be summarized in a few words: don’t set your heart on a
`particular solution, try to look at the problem from different angles and keep
`your mind open to any idea——even those which initially seem strange or imprac-
`tical may lead to a winning configuration.
`
`Line Following
`
`Don’t worry, we wont start discussing line following again! jump back to
`Chapter 14 if you feel compelled to revise some of those concepts.We just
`couldn’t ignore line following in a chapter that talks about races against time,
`since it presents many interesting discussion points.
`if you are the one who decides the rules, don’t underestimate the importance
`of the details. State the number and kind of the allowed parts, motors, and sensors
`in particular. More importantly, be very precise regarding the nature of the path,
`informing competitors about the width of the line and the minimum radius of
`the turns——the latter having a strong influence on the structure of the robots.
`Very tight curves will favor differential drives, while a less winding run is surely
`the ideal terrain for steering drives.
`Line following contests are usually judged only by speed. Evaluating accuracy,
`though theoretically possible, is not a very practical option. However, if you want
`to try this option, you can use a paper pad and attach a pen to each robot so they
`draw a line as they move. At the end of each run, you measure the maximum dis-
`tance between the course of the robot and the main line, and apply greater
`penalties to greater distances.
`Line following allows for many interesting variations, including:
`
`Round trip When the line ends, the robots must return to the starting
`point.
`
` .mr'hl-m.-e:~a€E(-m».:.r.«».
`
`
`
`
`
`
`
`
`E Short interruptions in the line, specified by number and length
`For the robots, it’s like hanging in mid—air for a while!
`
`
`
`
`
`520
`
`Chapter 26 ° Racing Against Time
`
`
`
`
`
`Small obstacles to overcome The robots should detect these with
`bumpers, suspend line following, pass the obstacle, and resume line fol-
`lowing again.
`
`Obstacle removal Similar to the previous variation except that objects
`of a specific size and shape must be removed instead of climbed over.
`
`Specific robotic architecture Specifying that a particular type of
`architecture be incorporated into the robot design. For example, all the
`robots must use legs instead of Wheels.
`
`Wall Following
`Conceptually similar to line following, in this challenge, the competing robots
`must follow a wall instead of a line. The sofiware is actually very similar to what
`Works for line following, with only a few adjustments to reflect the difference in
`sensors.
`
`If you decide to organize a wall following competition, remember that the
`Walls used need not be real Walls.You can create temporary walls with Wood,
`cardboard, or any other material of your choice.'\X/all following can be as simple
`to set up as having the robot find its way around the perimeter of a large card-
`board box. For example, you can state in your rules that the robots must run
`around the MINDSTORIWS kit box; the fastest robot being the Winner. Most of
`the participants will likely own the box, which will help them in setting up and
`testing their robots. As vve’ve said before about line following, its important you
`put a lot of care in specifying the details, including:
`
`
`
`The height of the Walls, their color, and the material they are made of.
`
`'5 Wliether the robots are required to remain in constant Contact with the
`Wall, or if they can move apart from it for a while,
`
`I! The shape of the course, or at least What kind of angles the robots
`should expect.
`
`IE Whether or not the robots are allowed to “hook” the upper edge of
`the walls.
`
`Moving to the point of view of the participant, the hardware configuration
`required to follow Walls can be very similar to that shown in Chapter 19 with
`regard to maze solving (maze solving actually being a sophisticated variant of wall
`following). However, this is one of those cases where an increase in speed. brings
`
`
`
`
`
`
`
`:\'i=r|’IM'M1~fl.'‘til!rx1$tJ>:b»‘L*‘;-‘.‘«\.w_9.3’:VtI9aé\:-1?‘‘K~‘1l?o:3C*--v3v§4{;RZ@v51§%nC'E§§Tu3G2Jlyé:Wv'[''‘Z.
`
`Racing Against Time 0 Chapter 26
`
`new difficulties. Similar to what happens in high—speed line following, the critical
`factor here is the reaction time of the robot. In fact, any time it loses contact with
`the wall and needs to undertake a corrective action, that longer reaction time
`entails a stronger correction.
`As we mentioned in Chapter 14 when discussing how to optimize line fol-
`lowing, this is easier said than done.To recapitulate, the elements you have to
`consider include:
`
`The mechanical configuration of your robot Type of drive,
`number of motors, position of the sensors, gear ratio, and backlash
`within gears.
`E The firinware you installed on your RCX \7Ve explained that some
`alternative firmware offers faster code execution.
`E The algorithms used in the software Strategies adopted to keep the
`robot on course as much as possible.
`
`
`
`
`
` 3t7
`
`1§ 3E
`
`5 m
`
`
`
`
`
`
`i;.3..:.g.,,»‘._L\l».sA';A:VV.‘.11.l4'...l‘.‘-‘_~*.,...r,~Lu:.‘_-.v;:ts..‘.:c;amin.:¢A.--S4).l/\:.AV.:;.......~.;:i.‘.~.tux.rt.‘
`
`
`.a..~J‘.."n.:...u.i.a...t‘_,:‘_;-...4..ta.u;.i-a.i_n«.i.;.«.n;«.;\=:i.;;1;1,9;2.um..«_\.-ir;;~;..x:tt.;...z.;»;:x.ii;;.ta:....t;.:u.u.;tnan..n;:.._«...'.,..:wu).4q,..;'.w.m7.’r\.tA.$.l£...a:.:e4...iL.x..-3.g
`
`The mechanical configuration of your robot is something you have to exper-
`iment with.You can use the Maze Runner of Chapter 19 as a starting point, but
`the optimal solution also depends on the set of rules you’ll use to race with.A.s
`for the firmware options, this is an opportunity to study a new language and
`install a new system, though not everyone will want to do that just to attend a
`contest.
`As for the strategies, some of you may recall that in Chapter 12 we intro-
`duced hysteresis as a technique aimed at improving the efficiency of a system,
`because it reduces the number of corrections it has to make. It was definitely an
`interesting option for line following, but is it applicable to wall following, too?
`The answer depends on the configuration of your robot. If it relies on a touch
`sensor to “feel” the wall-like the Maze Runner of Chapter l9——hysteresis will
`be of no help, because all you can determine from the robot is whether it’s
`touching the wall or not.To take advantage of hysteresis, you need finer informa-
`tion~—you need to know the diszmice from the wall, so you can make your robot
`decide when and how much to correct the route.This implies that you have to
`replace the touch sensor with some more sophisticated device. For example, you
`could. arrange a bumper, or antenna, connected to a rotation sensor in such a way
`that the count of the sensor is proportional to the distance. Or, if the rules allow
`for custom sensors, you could successfully use one of the distance sensors
`described in Chapter 9.
`
`
`
`
`
`
`
`522
`
`Chapter 26 - Racing Against Time
`
`Other Races
`
`There are many other type of contests that require your robot to perform some
`action as quickly as possible. As we explained in the introduction, most of them
`require some additional ability rather then just speed. In Chapter 28, we will
`describe contests where speed is important, but this is usually in the background
`when compared to other factors, like the efflciency in finding and gathering
`objects. In the following list, we suggest a few ideas for competitions in which
`speed is the most important component:
`
`
`
`I Car racing Car racing is similar to drag racing, but the robotic cars rut
`on a circuit that is more complex than just a straight track.The circuit
`may be delimited with colored tape on the floor, or with side walls.
`Avoid reducing the contest to line or wall following; instead, design the
`circuit so that a robot that follows one of the sides takes a longer route
`than those that run inside the track. If the circuit is delimited with real
`walls, encourage the competitors to use sophisticated detection tech-
`niques, like proximity sensing, by applying a penalty for every collision
`with a wall.
`
`I Fast painting Each robot is equipped. with a felt—tip pen and is asked
`to paint a given area on a sheet of paper. The robot that covers the sur-
`face fastest wins. Consider basing the results of each competitor on a
`combination of the elapsed time with the comprehensiveness of the cov-
`erage.The panel could be provided with a robot designed to scan the
`sheet and evaluate the result!
`
`I Wall climbing Prepare a climbing wall equipped with special holds
`that a robot can seize (this could be as simple as a grid of horizontal
`bars); the fastest robot to reach the top wins.You can keep the conipeti—
`tion open to ideas, allowing any kind of technique to reach the top,
`including lifting mechanisms and the launching of ropes.
`
`E Monkey bars The Toronto Users Group (rtlToronto) is very active in
`organizing robotic contests.Their recent proposals include a monkey bar
`race.The competing robots are required to traverse a horizontal ladder,
`racing against another robot.The first one to reach the end, or the one
`who goes the furthest, wins (see AppendiXA for a link to the rtlToronto
`Web site).
`
`
`
`
`
`
`
`Racing Against Time - Chapter 26
`
`
`
`Summary
`This chapter introduced you to the world of contests that represent a great
`opportunity to expand your knowledge, stimulate your creativity, and compare
`your ideas with others’.
`Even races that seem the least “robotic” of all the possible types of competi~
`tions can spur you to find new solutions or improve old ones. During contests,
`the details are very important.Your robot should not only work, but work better
`than its competitors. For this reason, an apparently simple task like going straight
`and fast requires thoughtful planning of your project: batteries, motors, gear
`trains, Wheels, Weight of the vehicle. .. these elements are all crucial to success.
`The simple addition of a limited braking space can make drag racing much
`more interesting, forcing the competitors to devise efficient braking solutions.
`Similarly, when you move to contests that involve highly specialized abilities, like
`navigation, the problems become much more compleX.Tasks as simple as line fol-
`lowing and wall following require a tremendous effort when your purpose is to
`design, build, and program a robot tuned for optimal performance.This is a pro-
`cess which proceeds by trial and error, and which will test your skills, your expe-
`rience, your creativity and, most of all, your patience!
`‘We encourage you to participate in contests.They can really be a great expe-
`rience. Be humble enough to learn from your mistakes, or from more effective
`techniques rather than completely different approaches adopted by other robots.
`Take everything very seriously during preparation:Try different solutions, perfect
`the details, test your program thoroughly until you feel satisfied. But don’t take
`the final rankings too seriously—remember, it’s all in fun!