Archive for the ‘Lego Mindstorms’ Category

Making mistakes safely

Pop. Sizzle. Spark. The unmistakable smell of burning electrical parts. “Shoot shoot damnit!” I say, doing the best I can to keep my voice down and not swear while the DJ is on the mic. I unplug the ethernet jack but it’s too late. The cable tester, a handheld device that tells you what conductors in an ethernet cable are connected, was fried. LED number 4 had exploded from being connected to line voltage, mocking my attempts to deny what just happened.

In hindsight, it was obvious the line from the air studio through the ceiling to the control room hadn’t failed, but it was part of a system that wasn’t working. We try to be classier than playing YouTube on-air, but we give DJs the option of playing the audio output of the studio computer’s web browser. According to the computer’s meters, it was outputting audio, but according to the equipment it plugged in to in the control room, it was not. So the problem had to be between the computer’s digital audio jack and the equipment in the control room, connected mostly by ethernet cables. Right?

“It was a perfectly reasonable thing to do,” my friend consoled me. He was a fellow computer science major but with less experience with how the station was wired, and I was hoping to show him how the cable tester worked. Those ethernet lines were a mystery, and I was hoping to get a better look inside. (Which I suppose I got – that line was definitely connected!) But I later realized what had gone wrong was that, on a fundamental level, I was a computer scientist trying to solve an electrical engineer’s problem.

Computer scientists like the break big problems down into little problems. We like to understand those little problems as a series of things that happen in sequence: first this line then that one. When something goes wrong, the crudest form of “debugging” is to pepper the code with output commands. We got here and the value is this. Do this with enough granularity and you’ll pinpoint exactly where something isn’t as you expect it to be.

This is very much the methodology I brought to the nonworking web browser output. I found the earliest and latest places something could go wrong and then honed in. The problem is that while output statements in code are free, electrified wires tend to break things. This sort of danger is completely alien to a computer scientist, or at least those of my generation. Yes, it used to be you had to wait hours for your code to compile and if you weren’t careful you could overwrite the OS, but those days are over. The focus now is on trying anything, seeing if it works, and improving it in a tight feedback loop if it does not. Drill down and get data, instead of careful planning and reasoning. That’s not necessarily the best way to work, but it’s viable when you’re dealing with unfamiliar code that isn’t too complex.

In this light, two computer scientists connecting a tester meant for very low voltages to a live wire is a perfectly reasonable thing to do.

I guess this is the part where I lament that even closely-related disciplines have widely varying problem solving techniques, and how a field’s techniques arise from its content, and how you should find a field that thinks the way you do. But no. I think more subjects should work like computer science. Starting with math.

Math, as currently taught, shares key similarities with electrical wiring: there are rules you shouldn’t break, but no feedback until you break them, at which point you can’t recover. Yes, those rules are in place for very good reasons, but they’re not always obvious. The feedback loop takes even longer: instead of immediately frying something, an elementary student may do a whole page of problems wrong with the same error, and only get the grade back until after the class has moved on to new material. What can be done to make math more like programming?

Quite a lot, as it turns out. Seymour Papert’s Mindstorms (after which the Lego robotics kit is named) describes a system of geometry that is fundamentally computational. Students create programs that guide a “turtle” moving on the plane that leaves lines behind it. Forward 50. Right 90. Children can kinesthetically identify with the turtle; they can relate to moving in 2D space far better than abstract symbol manipulation. But more importantly it turns math into executable code: the turtle’s path can be seen immediately. Errors are no longer obscure and arbitrary but obvious and meaningful. With the fluidity of digital text and the real-time speed of computation, students quickly debug both their program and their understanding in a tight feedback loop.

As much as this would benefit math education, the meta aspects are even more intriguing. I remember educational games of the 1990s, which involved following chains of item exchanges. You’d find a magnet, which you’d use to retrieve a steel crankshaft, which would operate a piece of machinery, which would contribute to the plot. These sequences were often discovered by trial and error, and shared among classmates; the objective was to beat the game. As Papert observed 15 years prior, “the computer [is] programming the child.” But with the turtle, “the relationship is reversed: the child, even at preschool ages, is in control: the child programs the computer.” Instead of following a trail of breadcrumbs laid out by someone else, with the turtle the child is free to set  and follow his or her own agenda. No program (that is well-formed) is ever “wrong” but merely does something undesired.

Papert makes the argument, one I’m only too happy to agree with, that the programmer’s mindset of debugging and incremental improvement taught by the turtle are a superior way of learning and thinking in general. This mindset rewards sustained effort over initial brilliance, and provides children with confidence to overcome their failures and set things straight. Equally importantly, “in teaching the computer how to think, children embark on an exploration of how they themselves think … [which] turns the child into an epistemologist.” A more positive relationship with math leads to an embrace of knowledge in general.

But we can’t stay in Papert’s Mathland, “a place that is to math what France is to French.” We have to work in the real world, with unforgiving electrified cables and math too complex to be explored with turtles. Our best option is to come into this world as prepared as possible, and to recognize that when mistakes do happen, they may not be as terrible as we thought.

For the $40 cost of a new cable tester, I think this lesson is well worth it.

Lego my imagination!

I recently happened upon the Gendered Lego Advertising Remixer, which overlays the audio of a Lego commercial targeted for boys with the video of one targeted for girls (or vice versa). It’s meant to say something about gender roles or the advertising industry but Legos are not just any toy; they’re about building things. Legos make engineers, and I can say that firsthand. It may seem that the Remixer could be a springboard to discuss the underrepresentation of girls in STEM fields. I’m reluctant to blog on that touchy topic; for a full sociological treatment, see Margolis and Fisher (2003). Instead, I think the Remixer demonstrates problems with getting children interested in STEM regardless of gender. That is the bigger issue with how Legos are advertised today: they’re not about building things.

Lego’s signature construction mechanic is shown for only about two of an ad’s thirty seconds, as a time lapse. For the rest of the ad, the product might as well not be made of bricks at all. Lego does little to differentiate themselves from a makers of dollhouses, action figures, or other toys made of solid plastic. The models become static, and the building process has a definitive end.

When the models inevitably get dropped on the floor and pieces get lost, the kids want to make something different.  They want to extend and build on what they are given without fear of “messing it up.” Since when is it possible to mess up when playing? Lego constructions don’t need to follow the instructions any more than artists need to paint by numbers.  They’re a child’s rapid prototyping tool, not industrial building materials to follow a blueprint. The quality of a Lego construction isn’t based on how well it reproduces a Platonic form. In fact, it’s not based on the physical Legos themselves at all, but what the kids do with them.

Accordingly, the ads focus on the adventures to be had with Legos. Specifically, they focus on adventures involving the perfectly assembled unit and friends who have purchased companion products. The setting and plot are preordained by professional writers. The kids who buy the sets will lifelessly reenact shadows of the ads, with mouth noises and bedspreads standing in for the dramatic music and rugged backgrounds of the boy-targeted commercials, or the metropolitan feel of Lego Friends.

I spent many enjoyable hours as a child with my sister and a friend battling bipedal Martian spaceships against figures from the completely separate Bionicle series. We extended the limited system using imagination rather than technical performance. The plots went nowhere and everywhere, zigzagging and bouncing with no pre-planned structure. Like the brick creations themselves, our plots were a hodgepodge of disparate ideas, configurable and unique.

The Lego commercials suggest rather strongly that there is only one way to do it. One way to build, one way to play. This is an extremely detrimental idea to the development of young engineers. They may come to see the construction process as a chore, rather than as fun. It robs them of the chance to design their own buildings and stories. The toy that is uniquely able to liberate a child’s creativity has become prepackaged imagination. Madison Avenue is only not taking away opportunities to build something new, but the very idea of building something new.

Excited college students stand around autonomous Mindstorms robots trying to push each other out of the ring.

Thankfully, there’s another side to this story. Tufts has an organization called the Center for Engineering Education and Outreach. The CEEO is known for its large collection of Lego Mindstorms robotics. The robots include sensors and can be programmed in LabView. Although there is a standard robot that includes all the sensors and a drive train, Mindstorms is intended to be flexible. Users are expected and encouraged to modify the hardware and software to best complete a task. These users include both kids in the local community and Tufts students. Fast, agile construction and a fairly sophisticated array of sensors, motors, and software benefit all ages.

The point of Legos is that you can tinker with them: try this approach, see how well it works, and use that knowledge to make a better choice next time. These are exactly the skills that are valuable to an engineer. Yes, there’s four years of course work and plenty on-the-job training to get through, but that’s exactly why engineers need to be highly motivated. The world is pliable, customizable, and hackable. With care and competence, it can be molded into something new and better. Legos should be a child’s first foray into that world, and instill values that will propel him or her for a lifetime.

Memory: Computer Science presentations & FIRST

About a month ago, one of my engineering introductory elective teachers invited the class to the final project presentations of a 100 level computer science class. They had studied robot behavior and independently functioning systems. Their projects involved getting robots do do things like show moral distress, map and navigate an unknown building, find a hoop and throw a ping-pong ball, fly autonomously (on its own), and in a neat psychology experiment, test subject’s perceptions of robot competence by intentionally failing (sometimes). In short, a quite an undertaking for college students.

I came partly because I was bored, partly because I was interested in the projects, and partly because I was interested what a higher level comp sci course was like, since I was considering minoring in it. What was expected of me?

Apparently, not something that works. The moral distress robot backed away from the color-coded tower of empty soda cans, regardless of whether it was to knock them down with or without protesting. (“I don’t like soda, but I’m drinking it for a school project.”) The navigating robot presentation was a bit rough around the edges, and it took it a while to get going. The ball shooter didn’t round the corner the way it should have, and then missed the shot. The tour bot, which was programmed with a success case, a failure case, and an ambiguous case, spoke in a hard to hear voice, without using the screen (I expected the failure to flash TOUR OVER instead of mumble it). The group even admitted that the “random” parings of subjects to success/failure/ambiguous showed trends. So randomize again, I thought. The four bladed helicopter showed its hardware hackishness by twitching and then sending a piece of a motor across the lawn. It was cold and dark. I went home.

It’s quite something, I realized, to put together a robot that worked. In the introductory class, I had used Lego Mindstorms. These guys were working with, for the most part, a cart that carried around a laptop. Granted, it’s more a software thing, so I guess it’s more fair to say we used LabVIEW and they used, presumably, C++. But still. Building robots is hard work. And when you’re doing custom hardware alongside that, it’s even harder.

And so I realized it’s quite incredible what consumer technology can do. You can keep dozens of doorstoppers on a device as thin as a pencil. You can read The New York Times, and then plan your driving route, on the same device at the kitchen table. You can talk to people on the other side of the planet on a device that fits in your pocket, which costs a fraction of what a far less capable device costed 20 years ago. Welcome to the future. It’s 2011. (That’s pronounced twenty-eleven, thank you very much.)

And everyone who built those insanely cools gadgets did it from scratch. Did it with technologies that didn’t exist a few years ago. And they work, (almost) flawlessly. This is the bar to reach.

And so it’s also quite incredible, looking back at the collegiate failures (or were they just ambiguous?), that in high school I was part of a team that made a functioning robot from scratch. As in, starting with choosing what parts of the task were most important, then selecting mechanical components to accomplish those subtasks, building those components in a garage with other high schoolers, putting them all together (worrying about size, weight, center of gravity, so on), programming the resulting robot, and driving it to victory during competition. And all but the competition happened in a space of six weeks.

Welcome the FIRST robotics, an incredible program for high schoolers to learn so much more than robots. It’s about teamwork, planning, dedication, and “coopertition”. It’s got all the character building of conventional sports, but instead of learning how to move balls around, you’re learning something useful, like how to program or drill or use AutoCAD. Freshmen engineers at Tufts have to take a course on AutoCAD! I went through it, but it was easier because I already thought in terms of fabrication. (I personally did not learn the program in FIRST.) But still, I didn’t have to wonder why the correct precision on a drawing is so important. If it says 1.0″, measure with a ruler and cut with a bandsaw. If it says 1.000″, measure with a caliper and cut with a lathe or mill. If it says 1.000000000″, like the error I had to spot on the exam, God help you.

I walked in not understanding the joke of “Team Resistance: going against the current,” and walked out quite familiar with Ohm’s law – from school. But from my FIRST team, I got a hands-on education that would have otherwise been completely unavailable to me. 

I spent time getting my hands dirty in a machine shop. I walked in not knowing anything beyond flathead vs. Phillips screwdrivers, and I walked out knowing how to use calipers, drill presses, center drills, files, mills, lathes (turning, facing, boring, cutting screw threads), and basically any other process or tool that cuts aluminum.

And tomorrow, it starts over once again – my fifth FIRST – when they unveil the new game. I’ll be helping not one but two teams, making the transition when I fly back to college.

Boy am I excited.