tag:blogger.com,1999:blog-356092372008-06-09T07:52:48.349-07:00Lego Defense IndustriesNo, I'm not an antisocial, misanthropic individual.
I just have a fascination with the physics of flinging small bits of plastic in a controlled fashion.aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-35609237.post-23495954186212902502008-06-06T17:19:00.000-07:002008-06-07T07:27:04.846-07:00Wheels turning again...Well lookie there. It's been one year exactly to the _day_ since my last post.<br /><br />I didn't plan that. Really. No, seriously.<br /><br />I finally tore everything apart about 3-4 months ago. The Lego Interceptor is no more. Figured I'd like to actually use the kit for something. So I sighed and reduced it to it's component bits. Thought I'd never actually rebuild it.<br /><br />But it's coming back. Sort of.<br /><br />At last night's <a href="http://www.bsdg.org/">BSDG </a>session, I wondered idly (out loud) about doing an NXT session at the next codecamp. You know, a little demo on the <a href="http://www.mindsqualls.net/">mindsqualls </a>api, something nifty for the robot to do. (probably involving computer vision/webcamish things). It was generally agreed upon that it'd be cool.<br /><br />And we talked about CI. And cruisecontrol.net. And ... and ... lightning struck <a href="http://www.chrisbrandsma.com/">Mr. Brandsma</a> and he had a vision...<br /><br />Well, no. Not really. But it could have been. What he actually said was "ooh! Oooh! Do a demo and hook your lego interceptor to the CI build and have it fire randomly at the audience when someone breaks the build!!" Kinda like <a href="http://www.codinghorror.com/blog/archives/000238.html">that orb/lavalamp thing</a>. Only more...interactive.<br /><br />Awesome idea. (and a real crowd pleaser. Assuming I can get it to fire M&M's or something...)<br /><br />And then I thought "wait a minute...I can read the rotation values of the motors...what if we did a little <a href="http://www.joelonsoftware.com/articles/fog0000000068.html">Mutt & Jeff </a>demo with two developers checking in code...have the robot in a central location...calibrate it to know where the two sit...and when someone breaks the code it announces it to the world and PELTS THE OFFENDER WITH JELLYBEANS!"<br /><br />This, I think, is brilliance beyond belief.<br /><br />Now if we can just build it...aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-36911731412977149212007-06-06T13:38:00.000-07:002007-06-06T14:18:46.906-07:00Whence do I point, Horatio?The squirrels...they run so inside my head.<br /><br />Gah.<br /><br />Ok, here's the situation. (err...<a href="http://www.lyricsdepot.com/dj-jazzy-jeff-and-the-fresh-prince/parents-just-dont-understand.html">apologies to Will Smith</a>) We're still at the last point. (see below) Trying to figure out where the !$$@#!# the interceptor is pointing at any given time.<br /><br />Then it came to me...if the camera is mounted ON the interceptor, we just "aim" by putting any moving object in the middle of the video and ker-pow! Simple, right?<br /><br />Of course not.<br /><br />There's a reason I didn't take this approach at the beginning. Because...if the camera is mounted on the interceptor, it's indeed easier to target...but it's a heckofa lot harder to detect a moving object. No simple segmentation of comparing background images to the current image because...<drum roll> the background is <span style="font-style: italic;">constantly changing!</span><br style="font-style: italic;"><br />Of course, there are ways to get around this. And given my lack of brainstorms on how to solve my other aiming problem, I've been researching just how hard it'd be to negate camera motion and extract moving objects from a moving camera stream. Because I'm just sure someone has done it..!<br /><br />In theory, it's pretty simple. (start by google "camera motion", "optical flow"). You just need to identify a series of good tracking points in the image (think: corners, contrast...what we call "video texture") Compare their location from one frame to the next, compare all your vectors, assume that those most common are due to camera motion, and you've got your first part.<br /><br />Then go back and look for motion vectors that didn't match. Those'd be your "moving object".<br /><br />See? Simple.<br /><br />Right.<br /><br />Beaucoup research has been done on this very thing. As a matter of fact, Intel even made available a c library called <a href="http://www.intel.com/technology/computing/opencv/index.htm">OpenCV</a> (subsequently opensourced) that has a bunch of useful libraries for accomplishing this very thing.<br /><br />Of course, it's not c#. So off we go to see if there's a wrapper/converted API for us poor auto-garbage-collection-addicted fools. And the gods did smile and indeed there are! Unfortunately, neither is under active development nor a complete conversion, but them's the breaks.<br /><br /><a href="http://code.google.com/p/opencvdotnet/">OpenCVDotNet </a>got me up and running quickly. Good samples, but a bit slim on documentation.<br /><br /><a href="http://www.cs.ru.ac.za/research/groups/SharperCV/">SharperCV </a>seems to be the more complete of the two, both from a documentation and an available function point of view.<br /><br />I really did like OpenCVDotNet, but in the end I'm looking to SharperCV. It seems to follow the OpenCV format closer, which makes it easier to translate the C-oriented tutorials and samples easier to c#.<br /><br />However, before I tear the current source to bits and begin a rebuild, I am going to see if I can get some general videos shot with current performance with a static camera in a light-controlled environment.<br /><br />All that said, I'm beginning to wonder how much longer I'm going to keep going on this particular direction. At this point, I've accomplished several of the original goals of the project.<br /><br /><span style="font-weight: bold;">Learn C#/use decoupled design/try agile practices</span><br />Self grade: B+<br />I've refactored the inner workings several times. I wrote more, and more elaborate, unit tests for this project than pretty much anything to this point. For my level of expertise, I'm pretty happy with the design as well. <br /><br />That's realizing I did ok for where I was at...the next project will be held to much higher standards.<br /><br /><br /><span style="font-weight: bold;">Provide a coding example I'm proud of</span><br />Self Grade: C<br />Some of the code is nice. commented. Well reasoned and logical.<br />And some is..well..spaghetti. Tightly coupled components. Parents requiring somewhat intimate knowledge of the children's inner workings. I did do my best to decouple, but I learned as I went. (that's the nice way to put it!)<br /><br /><span style="font-weight: bold;">Exercise programming problem solving muscles</span><br />Self grade: A<br />The muscles are sore. And I'm not benching a metaphorical 300lb programming stack. But I've certainly re-awakened some of those logical decomposition skills.<br /><br /><br /><span style="font-weight: bold;">Do Something Cool</span><br />Self Grade: A- : Well, at least >>I<< think it's pretty cool. However, I had visions of a very fast tracker with ominous voices tracking cubicle visitors. The NXT motors and my design just didn't seem to allow that. I'm sure a better design could have alleviated some of the problems. Hrmmm...the NXTShot sure looks to be more responsive. I may just have to do some "mechanical design analysis" for a Mark III version. ;^)<br /><br /><br />Next up, videos and pix of current performance...aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com6tag:blogger.com,1999:blog-35609237.post-89716916976666075552007-05-18T10:12:00.000-07:002007-10-11T22:00:04.647-07:00Picking up where we left off...When you last left your intrepid hero, things were looking up. The system was back up and functional. Das blinkinlights were doing their thing. Life seemed grand.<br /><br />And then reality.<br /><br />I hooked everything up, plugged it all in, and remounted the targeting laser. In a fit of brilliant insanity, I then fired up the control program and told the kids to build some lego towers to shoot down.<br /><br />They oblidged.<br /><br />And all heck broke loose.<br /><br />You see...when I hot-glued the targeting laser to the lego beam, it was kinda-sorta fudged on. "Gee, that looks pretty straight" sorta thing.<br /><br />Well, it wasn't. From 24" away, the interceptor was landing missles at least 2-3" off where the laser was pointing. Not good when the kids are so proud of themselves for actually getting the laser on the target and then the arrow has the GALL to land somewhere off yonder.<br /><br />I gave everybody and extra turn, and promised to "fix the robot".<br /><br />Then I scratched my head. However am I going to "calibrate" this laser?!! It's hotglued on fer pete's sake. Long story short, I tried a bunch of lego jigs, but nothing worked quite right. So I resigned myself to removing and re-gluing.<br /><br />Of course, this necessitated some sort of aligning jig. In a fit of inspiration (I have them often. Fits, that is. Inspiration more occasionally.) I envisioned some sort of calibration jig.<br /><br />Mounted the laser. Shined it on the brick. Hotglued everything in place.<br /><br />Ok, that's on the mechanical side. What about on the software side?<br /><br />I've been ruminating on how to keep a solid lock on the laser from the camera. Camera noise (spurious RGB values from the cheap webcam) have been somewhat of a problem. As well, the inherent nature of 160x120 video (never did solve that) has been an issue.<br /><br />So I did what any self-respecting engineer would do. I upped the minimum hardware requirements. ;^)<br /><br />I have an older DV camcorder that will only function as a camera, now. So I bought an <a href="http://www.newegg.com/Product/Product.asp?Item=N82E16815124014">inexpensive 1394 PC card</a> from newegg, paired it up with the sony dv camcorder, and now I get BEAUTIFUL CLEAR pictures! Better optics, less noise, AND I can turn off the auto-exposure/brightness in cam. Sweet.<br /><br />Of course, that's all fine and good...but we still have the "oblique laser" problem.<br /><br />If the target surface is at a nice 90 degrees to the laser, we get the standard bright red dot.<br /><br />HOWEVER...if the target is at an oblique angle...<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_giL3BvszLnY/Rk3wx_sHZxI/AAAAAAAAAhs/UmtFNScfOc8/s1600-h/heli_laser.bmp"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_giL3BvszLnY/Rk3wx_sHZxI/AAAAAAAAAhs/UmtFNScfOc8/s320/heli_laser.bmp" alt="" id="BLOGGER_PHOTO_ID_5065969897562400530" border="0" /></a><br /><br />The laser's beam is spread out in a "puddle", and it's overall less noticeable, and likely not the brightest spot.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_giL3BvszLnY/Rk3w9fsHZyI/AAAAAAAAAh0/401rBmyNTvU/s1600-h/heli_laser2.bmp"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_giL3BvszLnY/Rk3w9fsHZyI/AAAAAAAAAh0/401rBmyNTvU/s320/heli_laser2.bmp" alt="" id="BLOGGER_PHOTO_ID_5065970095130896162" border="0" /></a><br /><br />I had an epiphany today. (I promise, the point is coming soon!)<br /><br />I happened across "how stuff works" page on the <a href="http://science.howstuffworks.com/apache-helicopter2.htm">apache helicopter's hellfire missiles.</a> (mmm...missiles) And I was inspired by the targeting method. Apparently, the older hellfires were laser targeted where the missile would seek to whatever target was being painted by the laser. But not just any laser...<br /><br />A laser that pulsed to a pre-determined code. (that was downloaded to the missile prior to launch)<br /><br />"Ah-HA!" I thought. If I can somehow parse out the laser (maybe it's got unique HSV values?!!) and match what I think the target point is against some sort of pulse pattern...hmm...<br /><br />Thinking...thinking...aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com1tag:blogger.com,1999:blog-35609237.post-64529235500293506682007-04-13T07:57:00.000-07:002007-04-13T07:59:30.544-07:00The pricewars begin...Ok, now I understand how all those ebay-ers can sell NXT's for a "buy it now!" price of $220 and make money...<br /><br />Not only is CompUSA selling the NXT for $199, but now <a href="http://thenxtstep.blogspot.com/2007/04/nxt-retail-kit-for-18999us.html">Best Buy is doing it for $189 + $6 shipping.</a> (<a href="http://thenxtstep.blogspot.com/">thanks NXT Step</a>!)<br /><br />Woot!<br /><br />Those wild thoughts of buying a second and third set are getting correspondingly more tempting... =^)aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-67752941425803849602007-04-11T14:06:00.000-07:002007-04-11T15:41:54.638-07:00Trackin foolRefactoring to allow for testing is sooooo a good thing.<br /><br />I finally had the brainstorm. I'd been developing two separate projects for this. One is down-n-dirty, get 'er in. Test it out. Oops..that's ugly but it works.<br /><br />And one "nice, pristine, how it's supposed-to-be".<br /><br />I'll let you guess which one actually made progress. For a while.<br /><br />The pretty one was essentially used as a testing ground for nunit. And therefore has a nice bunch of unit tests.<br /><br />And then it happened in the "real" project. Ka-blam. Hit a wall. Why isn't this working?!! It should work. The logic is right. Those d!$#m gremlins are getting in between the parsing and compiling stages. I just know it.<br /><br />Deep breath. Back off. Put the mouse down. Take a walk.<br /><br />Then it hits me. I'm having so much trouble (partially) because I'm having to do so much crufty liberal insertion of system.diagnostic.debug.writeline.<br /><br />(true confessions, here)<br /><br />And it's a PITA to debug. Because...well...things are so tightly coupled I'm not quite sure WHERE to put in the debug statements and even when I do I'm making assumptions about other pieces working and that leads to...<br /><br />Well, we all know what happens when you assume.<br /><br />So in a fit of brilliantly obvious inspiration, I did two things.<br /><br />1.) I ported the unit tests over to the "really/working but somewhat crufty" implementation.<br /><br />2.) Did some decoupling. Specifically there were two pieces:<br /><ul><li>determine which way way I'm supposed to go based on where I am and the target is<br /></li><li>issue a command to move the robot ( myrobot.moveright() )</li><li>translate the moveright into actual motor directions (move motor b @ 70% power in the left direction)</li></ul><br />The third had already been isolated. But I was doing 1 and 2 in the same function. I pulled them apart. Now a parent function says "where should we go?" and the fxn returns a "left, down" or somesuch.<br /><br />NOW we're cookin. Unit tests were written for each of 4 quadrants, like so:<br /><br /><span style="color: rgb(0, 153, 0);font-family:courier new;" ><br />// $ = target point (where to move to)<br />//<br />// --------------------* < -100,100 (max rot values)<br />// | quad 1  |  quad 2 |<br />// |         |         |<br />// |         |         |<br />// ----------$----------<br />// | quad 3  | quad 4  |<br />// |         |         |<br />// |         |         |<br />// *--------------------<br />// ^(100,-75) min rot values</span><br /><br />And as the french say, "voilia!" (literally, "let us eat cheese!")<br /><br />In the end all was happy. Except tracking was much less precise than I'd like. Gear slop and imprecision in initial calibration were affecting things far more than I'd like.<br /><br />So...where are we at?<br /><br />The laser tracking worked best for precision...but it suffered from light refractions and went somewhat nuts in anything but a nice, lowlight environment. Oh, and if the beam was scattered or at an angle (think: shining a laser pointer on a table at a steep angle), things went wonky. Chasing butterflies.<br /><br />Dead reckoning isn't particularly precise...but it's kinda/sorta "in the neighborhood".<br /><br />Can I combine the two? Maybe limit the search radius for the laser pointer to within x pixels of the estimated dead reckoning solution? It's a thought.<br /><br />But regardless, it'll be <a href="http://www.itgroundhog.com/2007/04/its-integration-of-continuous-joy.html">integrated and tested</a>. =^)<br /><br /><span style="font-weight: bold;">In Mechanical news...</span><br /><br />The gearing has been reduced and reworked for both pan and tilt. Of course, this adds to the gearlash problem, but it was necessary for precision reasons.<br /><br />("Slow 'er down!" everyone said.)<br /><br />(Well, not everyone.)<br /><br />(Ok, maybe just me.)<br /><br />Anyway.<br /><br />But it's working. Back to "das blinkinlights" working.<br /><br />But now we've got<br /><ul><li>boundary checking (no more chasing butterflies and grinding gears)</li><li>Four shot rotary magazine</li><li>Smaller tilt cradle footprint (geez. I should be in marketing. No...no, actually. I shouldn't)</li><li>A cool "fah-WOOSH!" sound when the missile is fired. (put that in for the kids)</li></ul>Now it's time to put in code to track values returned from the sonar (ultrasonic) sensor. Fire when the target is within...oh...let's say 50cm.<br /><br />Ok. Go to it.aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com2tag:blogger.com,1999:blog-35609237.post-21784125548494641842007-04-04T08:32:00.000-07:002007-04-04T09:22:12.386-07:00Avast ye skirvy dogs, protect the staplers at all costs!...because...you know...that's about the highest aspiration I have for this once it's done.<br /><br />Oh, and it'll look cool. And I'll have the undying admiration of my coworkers. Some of them. A few. Ok, at least one.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.foxbox.nl/lego/index.asp?FRMid=39"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_giL3BvszLnY/RhPGIw0QCLI/AAAAAAAAAgo/8alPeVXXpHk/s200/foxbox_launcher.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5049597461057767602" /></a>In other news, a reader (from whence he came I know not..!) pointed me to a project he's working on.<br /><a href="http://www.foxbox.nl/lego/index.asp?FRMid=39">http://www.foxbox.nl/lego/index.asp?FRMid=39</a><br /><br />Check it out! Similar to JP Brown's Aegis, but with his own unique execution...and he's got pictures...LOTS of pictures, and even a few videos.<br /><br />Actually, check the site out even if you're not interested in this. This guy rivals <a href="http://www.philohome.com/mindstorms.htm">Philo</a> for the pure amount-of-stuff that he's built and documented. I particularly liked the automated battery tester.<br /><br />In general construction news...<br /><br />Given my own...umm...unique execution of the pan-n-tilt, I may have to crib some of these guys' executions. If nothing else, I'm thinking of rebuilding the firing mechanism with a conventional lego motor for compactness. <br /><br />Of course, then I lose the ability to control rotation via the built in rotation sensors...drat drat drat...everything's a tradeoff. Hmm. Maybe I'll just attempt to rebuild using the nxt motor and trying to move things more inboard...<br /><br />In other news, the dead reckoning method for moving stuff around is coming...well...it's coming...umm...yeah.<br /><br />After more than a bit of headscratching the boundary detection is working. That is, I can calibrate the "aim box" for the beast (max and min horizontal and vertical rotations) and if we start to point outside of those boundaries, the control code catches it and moves back inside.<br /><br />However, I had two setbacks when translating this to dead reckoning movement.<br /><br />1.) I've got a @#$!$ bug in the code. Currently whenever I tell it to "track to a point!" it's thinking that the point is somewhere between it's toes and left armpit. Ie, it moves left and down...left and down...always left and down. I've stared at the code till my eyes bugged out and the logic error is still eluding me. But I'll find and squash it. (eventually)<br /><br />2.) I..umm...err. (this is really embarrassing) I lost my control buttons. Yeah, these:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_giL3BvszLnY/RhPMIA0QCMI/AAAAAAAAAgw/Kna3M73l6NI/s1600-h/buttons.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_giL3BvszLnY/RhPMIA0QCMI/AAAAAAAAAgw/Kna3M73l6NI/s320/buttons.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5049604045242632386" /></a><br />I was playing with tab layout controls, and I think somewhere I grabbed and moved them. Somewhere. As a group.<br /><br />And now while Visual Studio thinks they're there (and all the handlers/etc are still present) they are naught to be found on the form.<br /><br />Of course my (ever bright, savvy, and non-developer) wife's perspective was: "You have backups, right? You keep versions don't you?"<br /><br />Argh! All that ranting and raving about idiots who code without source control comes crashing down upon my head...she must have actually been listening.<br /><br />Yes, I do have a previous version in <a href="http://subversion.tigris.org">subversion</a>. And it's only about 2-3 days old. But there's still quite a bit of difference 'tween the two.<br /><br />The painful lessons are the ones best learned. (and this could have been MUCH more painful!)<br /><br />Cheerio!<br />-aaronaaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-67742774806787313322007-04-03T19:02:00.000-07:002007-04-03T19:18:13.818-07:00Mindstorms NXT $199 @ CompUSA!<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_giL3BvszLnY/RhMKdg0QCKI/AAAAAAAAAgg/glB4S8wk1dc/s1600-h/nxt.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_giL3BvszLnY/RhMKdg0QCKI/AAAAAAAAAgg/glB4S8wk1dc/s200/nxt.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5049391109354031266" /></a><br />I just happened to be at my local CompUSA about 2 weeks ago looking for (oh the irony!) an inexpensive USB joystick to control the robot.<br /><br />Low and behold...in the same aisle, facing shelves on the bottom were [da dum!] <a href="http://www.compusa.com/products/product_info.asp?pfp=SEARCH&Ntt=nxt&N=0&Dx=mode+matchall&Nty=1&D=nxt&Ntk=All&product_code=339849&Pn=Mindstorms_NXT">Mindstorms NXT kits</a>. "Nifty enough", says I, "but what's that little sticker..."<br /><br />Holy hot hannah batman...$199! (the sticker said "new low price!")<br /><br />The link above is to the online store, which also reflects the $199 price. Alas, they are all sold out for delivery. However, my (local) store has some in...if you have local CompUSA you might just be as lucky!<br /><br />I've been itching for a second set already...mostly because I keep getting inspired by other folks' creations and want to give 'em a try without tearing apart my work-in-progress. Oh the agony, your name is Lego...<br /><br />And the joystick? Eh...didn't buy one...yet. I'll tackle <a href="http://msdn2.microsoft.com/en-us/library/ms810471.aspx">DirectInput</a> and the attendant control issues later.aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-49500602056997572952007-03-31T21:14:00.000-07:002007-03-31T21:37:43.178-07:00Two steps forward, one step back...<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_giL3BvszLnY/Rg81YzZk5hI/AAAAAAAAAgQ/uZE106BZdDA/s1600-h/100_2333.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_giL3BvszLnY/Rg81YzZk5hI/AAAAAAAAAgQ/uZE106BZdDA/s200/100_2333.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5048312407536231954" /></a>It's late. My eyes are tired. By brain is tired.<br /><br />But it's working again.<br /><br />The first step to a "dead reckoning" method of tracking was to get readings on the tachometers in the NXT's motors. Ie "number of degrees turned".<br /><br />Then I had to do something useful. So I decided to use the laser as a guide to defining a "box" for targeting. Target the upper right & lower left, use those "coordinates" as scales for translating screen coordinates to rotation coordinates. (so to speak)<br /><br />And to make sure I was getting things working properly, I decided to implement some boundary stuff. Ie, if we moved beyond the bounds, stop the movement (say, out of the top of the frame) and nudge things back in.<br /><br />I did this also (partially) because I've had the robot chase butterflies and grind gears. Totally. Reading the tachs in the motors I decided would help keep things from moving too wildly.<br /><br />Now I'm finding (of course) new issues. Like I'm getting what seems to be coordinate drift. I'm guessing it has to do with gear lash in the targeting. No biggie.<br /><br />An even larger issue (though) is this...I thought I'd try targeting the corners of the "video window". And..hoooooboy.<br /><br />The video motion detection needs some serious optimization. When it's off, my pentium M 1.6ghz chugs along at around 12%cpu. Connect to the camera and things go wonky. <br /><br />(wonky. That's a technical term)<br /><br />Anyway. UI becomes unresponsive. Click on a button and...wait...for...a...reaction...oops! There goes therobotandit'sturningALLTHEWAYAROUNDOHCRAP!!!<br /><br />(because even though I release the button the "button is up you can stop now" message is still waiting behind the video processing queue and...)<br /><br />Nevermind. I'm tired. I shouldn't be writing.<br /><br />However, here's the new build. With dropped "low slung" stance and nifty grafted on laser.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_giL3BvszLnY/Rg80xjZk5gI/AAAAAAAAAgI/fYkP0WXMflI/s1600-h/100_2335.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_giL3BvszLnY/Rg80xjZk5gI/AAAAAAAAAgI/fYkP0WXMflI/s400/100_2335.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5048311733226366466" /></a><br /><br /><br /><br />Closeup of the laser:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_giL3BvszLnY/Rg822DZk5iI/AAAAAAAAAgY/v8sMLIAfZeE/s1600-h/100_2336.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_giL3BvszLnY/Rg822DZk5iI/AAAAAAAAAgY/v8sMLIAfZeE/s320/100_2336.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5048314009559033378" /></a><br /><br />(Yes, that's hot glue. Shhhh....)aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com5tag:blogger.com,1999:blog-35609237.post-68946920853054025822007-03-28T08:54:00.000-07:002007-03-28T09:55:31.300-07:00NXT + webcam + PC = not quite there yet....but we're getting closer!<br /><br />Last night I took a couple of hours and finished up my "Complete redesign from the ground up."<br /><br />Looks quite a bit different from the first video. A few "minor" changes:<br /><ul><li>Integrated a 4 shot rotary magazine. (borrowed the idea from <a href="http://jpbrown.i8.com/aegis.html">JP Brown</a> though it took me forever to figure out how to mount the cyberslam missiles!) </li><li>Improved the base stability. </li><li>Reworked the turntable mechanism at LEAST 3 times. First time used a conventional 40 tooth gearwheel. (too much slop) Second and third used the NXT turntable. (Had the dickens of a time trying to figure out how to mount and drive it...finally ran across some examples and was able to get some traction)</li></ul><br /><br /><embed style="width:400px; height:326px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-3506174681522922308&hl=en" quality="best" bgcolor="#ffffff" scale="noScale" salign="TL" FlashVars="playerMode=embedded"> </embed><br /><br />Pretty cool, eh?<br /><br />And then I hook it into the motion tracking system...<br /><br />And it doesn't work.<br /><br />Moves too quick. Not enough precision. Left/right can possibly be used as is, but direct driving the up/down movement is just tooooooo fast. Additionally, when only applying 10-15% power to the motor to rotate up/down (the idea being to do it sllloooowwwwllly) not enough juice gets to the motor to move it! (especially if the batteries aren't brand-spanking-new.)<br /><br />Amazing, isn't it, how you can never anticipate the areas that'll really getcha? I hadn't a clue that the pan/tilt would be such a challenge.<br /><br />Nor did I figure that simply setting the webcam's res up from 160x120 to 320x240 would drive a software refactoring/revision/redesign.<br /><br />BUT....it's a good thing. The new base is MUCH more stable. The new pan mechanism is rock solid compared to the last.<br /><br />And the software redesign I used to start writing unit tests for the tracking modules I'd written. Which forced me to rethink some of the design. Which is a good thing.<br /><br />So...back to the drawing board! And maybe with this rev I can get it a leeeetle more compact. That was another thing...this version is just monster-lovin huge. Wiiide. (though I must admit that it makes it look a bit more imposing. )aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.comtag:blogger.com,1999:blog-35609237.post-50838162181168338362007-03-23T14:16:00.000-07:002007-03-23T14:57:16.699-07:00Cardinal sins (etc etc)According to Joel, <a href="http://www.joelonsoftware.com/articles/fog0000000069.html">one should never toss it all out to start from scratch.</a><br /><br />Weeeeelllll....I am. But not on the software side. On the hardware side I tore apart the whole thing, deciding I needed a complete redesign.<br /><br />(All things considered, it does have fewer moving parts than mozilla.)<br /><br />After getting a very ugly windows app up and running, I realized (belatedly) it was time to refactor. And those unit tests I'd been meaning to write?<br /><br />(laughs nervously.)<br /><br />Weeellll...<br /><br />You get the picture. I've got a morass of self written stuff, some other folks' code, and some hacked up versions of both all in the big happy windows forms pot. It's time to come clean. Cleave truth from fiction. Air out the dirty socks and all that. "Do It Right".<br /><br />Well, at least "right-er". <span style="font-weight: bold;">Before </span>I've got so much spaghetti I'm an honorary Soprano. Oh, and get rid of those nasty arraylists in favor of generics. (after casting my object for the n^40th time, I realized why everyone was so excited...) Because leaving them in...you know...casts a bad light on the family.<br /><br />First step: New app in VS2005. copy over my developed modules & those modified. Add to source control. (done)<br />Second step: Writing those unit tests. (in progress). So far the "target tracking" object is now officially unit-ed.<br />Third step: Separate out the logic from <a href="http://www.codeproject.com/cs/media/Motion_Detection.asp">Andrew Kirillov's motion recognition code</a> and try and make it work with <a href="http://www.codeproject.com/cs/media/directxcapture.asp">this super noofty-cool .net makes-it-easy directshow wrapper doohicky</a>.<br /><br />Why? Because I still can't figure out (and he couldn't either) how to change the resolution for the incoming video stream easily...and this library makes it a breeze.<br /><br />(I feel absolutely no compunction about not digging into the nasty-icky-commie (heh) directshow/c++ internals. No thank you.)<br /><br />What else...oh yes. Need to add in some new logic to the robot targeting guts to see how pairing dead-reckoning with the laser targeting works.<br /><br />The laser's really cool...but it isn't 100% accurate. I'd say it's about 60-70% accurate depending on the quality of input (my old Intel camera is pretty noisy), the light level, and the environment. A nice dark-ish neutral wall with the lights off and we've got about 95% accurate tracking (or more).<br /><br />I've got these 3 cool little lasers I came across (pretty similar to the $1 pointer I found). I actually had a wild thought of doing the "Predator 3-dot" thing as the targeting mechanism.<br /><br />Think: , find the brightest point, look around for 2 more. It'd help cut down on spurious input...hmm...future feature maybe. And, well, not everyone will want to duct-tape 3 laser pointers together.<br /><br />So we'll try the dead reckoning + laser pointer approach. If nothing else, the laser pointer will help calibrating the dead-reckoning. (ie, point it at the four corners of the camera's viewable area, store the rotation values in the NXT motors controlling pan and tilt)<br /><br />Hmm...come to think of it, if I have those values stored, I can also avoid the dreaded "we're pointing at the ceiling!" syndrome when the bot would start chasing butterflies (ie flutteringly bad input) past the camera's boundaries.aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-19436296667282434832007-03-19T18:15:00.000-07:002007-03-19T19:15:04.170-07:00Houston, we have das blinkin lights!Oh boy..I am, like SO totally stoked. <br /><br />(you can tell when I begin to let slip 80's idiom with wild abandon)<br /><br />(<a href="http://en.wikipedia.org/wiki/Big_hair#20th_century">more wild than 80's hair</a>, even.)<br /><br />(totally)<br /><br />Anyway. Where was I? Oh yeah. Stoked. Totally, dude.<br /><br />(I'll stop now.)<br /><br />Closing in on actually having the robot track a live object. I parsed out the source of <a href="http://www.codeproject.com/cs/media/Motion_Detection.asp">Andrew Kirillov's most excellent motion tracking library</a>, enhanced (aka: hacked up something awful) it in order to:<br /><br />1.) track a laser pointer with more accuracy<br />2.) calculate a returned object's center of mass<br /><br />I'm not only stretching my coding skills (unsafe code? Oh...that means you can mess up pointers with wild abandon!) but also dusting dimly remembered image processing theory from back when I did QA on video codecs.<br /><br />But it's fun.<br /><br />Alas, all is not without stinkyness. Even after parsing the image capture code from here to eternity, I haven't been able to figure out how to change the @$!$#@$ default input resolution on the #!@$!# old Intel USB cam. It'll do 640x480 @ 15fps or even 320x240 @ 30fps. But does it default to that? Nooooooooo....I get scaled up 160x120! (yeah baby! We're talking Gen-u-ine Indeo 3 quality here! Cinepack here I come!)<br /><br />In a fit of insanity (what WILL this do to performance?!!) I hooked up my miniDV camcorder (via firewire) Not only did the goodness of the MS capture generics work just fine...it captured BEAUTIFULLY!<br /><br />Here's a quick shot:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_giL3BvszLnY/Rf84MV85mzI/AAAAAAAAAf8/Cp_xz10z0pg/s1600-h/NXTTest.PNG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_giL3BvszLnY/Rf84MV85mzI/AAAAAAAAAf8/Cp_xz10z0pg/s400/NXTTest.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5043811892380408626" /></a><br /><br />An interesting bit on the laser tracker. You'd think (ha!) that all you'd need to do was grab the "brightest" dot in the image and that'd (of course) be the pointer.<br /><br />Not necessarily. I wound up having to do some special sauce to track "hotspots" and filter them out. (see that bright brass hinge in the picture above? No? Well if you squint rrREEEeally hard...that bit was especially troublesome) Early results look very promising, but we still need more tuning.<br /><br />Objects were equally in need of tweaking. The library has a pre-configured tracker that returns objects, a rectangle around them, AND a tracking number.<br /><br />SUPER handy. Except it's managed code. (I'm thinking). Regardless, it's slow. Well, slower than the "optimized" tracker that returned a pixelated-but-closer object tracked boundary. I somehow managed to hack in a bit of code to feed that pixelated image (well, a black and white version) into the object tracker for blob numbering, use the resulting blobish goodness to figure out a <a href="http://en.wikipedia.org/wiki/Center_of_mass">center of mass</a>, and still keep things running pretty well. (cpu isn't smoking yet)<br /><br />While it's not "aim for the whites of their eyes!" it'll be somewhat more accurate than aiming for the center of a returned rectangle. (or so I'm hoping)<br /><br />Lessee...what's next..<br /><br />Develop a class to track an object's last n positions, average velocity and position to estimate what it thinks the next position of the pointer/object should be...and see if the returned tracked coordinates are close.<br /><br />(In case the laser does take a jump, it'll help the robot track more steadily).<br /><br />Ie, we'll figure out where we think the object is supposed to be, and if it isn't, we'll just "fake it" for a few frames, see if it returns, and keep on.<br /><br />The laser tracks reasonably steadily, but the object "center of mass"...not so much. Now that I have the callback code in, that's possible.<br /><br />Oh yeah, did I mention I had to relearn the whole delegate-message-passing-in-a-threadsafe-way two-step? Good news is it took considerably less time this time. About an hour vs. several days. That helped put things into perspective.<br /><br />Overall I'm very pleased at how it's coming along. Good, solid accomplishment-reinforcement cycle. Keeps me wanting to push, learning more.<br /><br />So I wonder how the dog would react to being an "object"...?aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.comtag:blogger.com,1999:blog-35609237.post-87414361410531757502007-03-12T10:53:00.000-07:002007-03-12T11:09:57.733-07:00Cube Area Missle Defense: Prototype 1Here Caleb demonstrates the first prototype of the "base unit" + fire control.<br /><br />I apologize for the crappy video + wonky editing + low res. It was a spur-of-the-moment capture with the family digital (still) camera's movie mode...<br /><br /><embed style="width:400px; height:326px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=8760739133167945319&hl=en" quality="best" bgcolor="#ffffff" scale="noScale" salign="TL" FlashVars="playerMode=embedded"> </embed><br /><br />It's being controlled via a custom windows form app written in C# and using the most excellent <a href="http://www.mindsqualls.net/">Mindsqualls .net api for NXT</a>.<br /><br />$1 laser pointer grafted on from a local dollar store.<br />Missile is a <a href="http://www.peeron.com/inv/parts/32133c01">Technic Competition Arrow</a> and launcher. (I bought a bunch from <a href="http://www.bricklink.com/"></a>.<a href="http://www.bricklink.com/">BrickLink</a> a while back.)<br /><br />The control at this point is via bluetooth, so it's wireless.<br /><br />Next steps:<br /><ol><li>add a webcam control to the windows form app</li><li>refactor the physical manifestation (ie the robot) for less gear lash.</li><li>abstract out control functions for movement so I can plug in (arbitrarily) programmatic, keyboard, joystick, "forms buttons", or mouse control.</li><li>calibration routines to map the camera's field of view to arms range of motion</li><li>code to move the "aiming point" to a designated spot.</li><li>plug in <a href="http://www.codeproject.com/cs/media/Motion_Detection.asp">motion detection</a></li><li>point at the center of mass of a detected movement</li><li>experiment with the ultrasonic sensor to see how accurately it'll detect distance...maybe figure out some simple ballistics. (alternately, only fire at an object if it's within a given distance.)</li><li>refactor the base with multi-shot capabilities.</li></ol>aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com3tag:blogger.com,1999:blog-35609237.post-14634628934630400042007-01-04T08:39:00.000-08:002007-01-04T08:45:47.678-08:00Christmas slowdowns.....aren't just for UPS!<br /><br />Atch. We decided to call it quits until the new year (which this, now, is). As my wise partner-in-crime put it:<br /><br />"We had agreed at the start that this shouldn't devolve into yet another obligation. The intention was as an opportunity for growth, development - and a measure of diversion."<br /><br />Yup. And we're both buried. So it's on hold for now.<br /><br />That doesn't mean the idea factory has been idle. I've been musing for a while how to get video to the PC for processing. <a href="http://www.geeks.com/details.asp?invtid=203C-50MW-N">This looks like just the ticket.</a>aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-85104344739434217012006-11-15T07:46:00.000-08:002006-11-15T07:48:44.922-08:00The ultimate sentry gun...coming soon to a DMZ near youWell now<span style="color: rgb(51, 0, 51);"> </span><span style="color: rgb(51, 0, 51);" ><a href="http://www.thesentrygun.com">Aaron Rasmussen</a> can rest in peace. Someone has finally built a "real" sentry gun.</span><br /><br />Apparently <a href="http://www.newlaunches.com/archives/samsung_develops_machine_gun_sentry_robot_costs_200k.php">Samsung has developed an actual autonomous sentry gun</a> that tracks and recognizes humans. The device is intended for deployment in the DMZ between N and S Korea. Included in the article is a nifty video that's both funny and yet very...disturbing.<br /><br />However, the following line pretty much sums it up, methinks:<br /><br /><blockquote><span nd="3" name="intelliTxt" id="intelliTxt">It has a sophisticated pattern recognition which can detect the difference between humans and trees, and a 5.5mm machine-gun.</span><br /> <span nd="3" name="intelliTxt" id="intelliTxt"></span></blockquote> <span nd="3" name="intelliTxt" id="intelliTxt">Oh boy. It can tell the difference between trees and humans. <br /><br />And it has a gun. <br /><br /><br />("Mr. Oak, put down your branches. You have 20 seconds to comply...")</span>aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-1163451960197134952006-11-13T13:06:00.000-08:002006-11-13T13:05:48.294-08:00Analysis paralysis and other fun design choicesGiven we haven't picked out a cool acronym as a name, I can't say we've made HUGE progress. But we're getting there.<br /><br />We're meeting once a week and have decided to use this as a "demo project" to work through project issues as well as being a boost to coding skills. And of course, that means we're dealing with the dreaded "R" word. Requirements. Gotta do em'.<br /><br />So we tried to hash out what the "overarching architecture"<br />should look like. Got lost in philosophical rabbit<br />trails. Wondered where intelligence/data/processing should happen. <br /><br />And then, after poking about some of <a href="http://gettingreal.37signals.com/toc.php">37signals manifesto</a>, I came up for air and wondered...do we REALLY need comprehensive<a href="http://www.joelonsoftware.com/items/2005/08/17.html"> BDUF requirements</a>?<br /><br />So we rethought a few things. Today's meeting looked like this:<br /><br /><span style="font-weight: bold;"></span><br /><br /><span style="font-weight: bold;">Guiding design principles</span><br /><br /><ul><li>encapsulation</li><li>loose coupling</li><li>build for extensibility...but keep things reasonable</li></ul>(ed: isn't it great when you re-discover...oh yeah, that's why we do oo...)<br /><br /><br /><br /><span style="font-weight: bold;">Ways to go forward (breaking analysis paralysis)</span><br /><br /><ul><li>What's the smallest useful bit I can impliment? (think: <a href="http://www.cheapskatemonthly.com//member_tools_rdrpdemo_rdrpdemo1.asp">credit<br />card payoff - doing the small ones first</a>/ <a href="http://inst.eecs.berkeley.edu/%7Emaratb/readings/NoSilverBullet.html">Brooks observations on incremental development</a> = small successes keeps<br />the morale flywheel going)</li></ul><br /><br /><br /><span style="font-weight: bold;">Requirements</span><br /><br /><ul><li>What is the minimal requirements set needed to get the minimal functionality going?</li><li>Use "guiding design principles" where possible, use hard-and-fast<br />requirements where necessary. (of course, "necessary" is always up for<br />debate..)<br /><br /></li><li>Think "growing" software vs. "building"...so build in extensibility. Think "encapsulation/objects"...</li><li>Maybe a useful thought would be "how much encapsulation is<br />reasonably necessary to re-use this module in another app?"...that<br />might help with removing unnecessary dependancy on other modules too...</li></ul><br /><br /><br /><span style="font-weight: bold;">AR's (action required) </span><br /><br />(sorry...old Intel-ism. I've just always thought AI should be artificial intelligence..)<br /><br /><br /><br />A:<br /><br /><ul><li>build a basic robot with 2 axis of motion. (maybe 3rd axis would be ultrasonic sensor?)</li><li>Build a basic test-harness to move the robot through motion.</li></ul><br />W:<br /><br /><ul><li>Begin experimenting with his USB cam and the motion sensing API<br />at http://www.codeproject.com/cs/media/Motion_Detection.asp (check out<br />his other articles for the image manipulation algo's used in the motion<br />sensing kit..)</li></ul><br />Both A and W<br /><br /><ul><li>Remember that this is supposed to be FUN. If it starts being a CHORE and stops being FUN we need to re-eval... =^))</li></ul>aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-1162147239280166962006-10-29T08:16:00.000-08:002006-11-13T13:01:04.231-08:00Houston, the NXT has landed..So I couldn't wait. I was soooo close to having gathered enough $$ for the new Mindstorms that it was too much to resist.<br /><br />I <a href="http://search.ebay.com/search/search.dll?query=lego+nxt&MfcISAPICommand=GetResult&amp;amp;amp;amp;amp;amp;amp;ht=1&ebaytag1=ebayreg&srchdesc=n&maxRecordsReturned=300&maxRecordsPerPage=50&SortProperty=MetaEndSort">ebay'ed</a>. I'd looked a while back and seen once-used or even new kits for around $180-$200 and sure enough, I kept tabs on things for a week and found one for $199 (Buy it now) + $20 shipping. Hey, I can use that extra $30 to buy the webcam or something...<br /><br />(I freely admit that I'm crossing my fingers that it didn't just fall of the back of a truck...but given how many I saw for that price range from different folks there'd have to be an epidemic of lego filtching going on..)<br /><br />So it arrived, sealed and band-spanking new. The base of the tri-bot went together in less than the promised 30 minutes. Shortly thereafter I added a light sensor and managed to make a "follow the light" robot with only the brick's primative 5 program steps. The kids got a kick making it drive straight with our <a href="http://www.maglite.com/D_Cell_LED.asp">"Home Defense Certified"</a> mag light.<br /><br />(turn left. Wait for light. Drive straight while the light's on. loop)<br /><br />A few days later, I added all the other pieces to make the <a href="http://video.google.com/videoplay?docid=4538448288675480962&q=nxt+tribot">fully-functional tribot</a>. (not my videos, but thank you to the poster!) Cool beans, with the exception that I'm not particularly impressed with the accuracy/reliability of the ultrasonic distance sensor. Yes, I know that it has to do with sound waves bouncing higglety-pigglety everywhere. And I'm impressed that they included the tech at all. Then again, this is LEGO... (whom in my very biased opinion can do no wrong. Well, except for that ridiculous bionacle stuff..) and my expectations were that it'd pick out a fly at 20 meters.<br /><br />[sigh] Such dissapointment.<br /><br />It is a testament to Lego's excellent directions that my almost 5-year-old son and I put together <a href="http://video.google.com/videoplay?docid=-4793439686800990662&q=nxt+spike">spike </a>in about 1 hour...with him doing about 50% of the assembly by himself. It was fascinating watching him turn the L-girders around in his hands, figuring out which side the pins were supposed to go in. While I did have to give lots of hints at first ("look at the picture...look again...that's almost there, hold it up and try again") by the time we were done, I just piled the parts in front of him and let him figure it out. And he did! Yeah, I'm sure I'm projecting on my kid a little but as a Lego Dad, I was bursting with pride!<br /><br />Interestingly enough, fitting her personality my 6 year old daughter was content to simply collect and match pieces and combine them in interesting ways. ("Instructions? No thanks dad...")<br /><br />Even the 3 year old got into the act. Though we quickly found that the <a href="http://www.peeron.com/inv/parts/3673">tiny technic pins</a> were just a mite too small for his fingers to manage.<br /><br />We showed off <a href="http://video.google.com/videoplay?docid=-4793439686800990662&q=nxt+spike">Spike (the scorpion)</a> to mom and some family. Everyone was mightily impressed by the tail stinger - it really does move quick!<br /><br />I've enjoyed doing the projects with the kids (err, kid). Good way to familiarize with the new studdless building, get an idea of how things fit together and "lego best practices". Of course, there's no substitute for simply playing around, so the set will continue to commute with me.<br /><br />Oh yeah, when it first came I was rather dissapointed (as were many, apparently) at the fact the box wasn't a particulary good storage tool. Apparently, the educational version of the set includes a nice organizational component. (It's also $30 more than the standard set's $250 price tag from what I've seen...so I won't compain too loud.)<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/4552/1256/1600/100_1623.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/4552/1256/320/100_1623.jpg" alt="" border="0" /></a>All that said, I wasn't going to tote the set into work in it's box, so I had to have myself a little think. The upshot was that I snagged an old softside briefcase I had paired it with an inexpensive plastic organizer, and "poof"! Instant stealth mindstorms transport mechanism.<br /><br />No, it doesn't fit the brick, but it does fit everything else quite nicely. And hey, for $2.99 from BigLots, I ain't gonna quibble.<br /><br />So that's about it for now.<br /><br />Oh wait - one more thing. While doing some poking about for this article, I happened across <a href="http://www.nxtasy.org/">NXTasy.com</a>. Check out the challenges in their forums. The first one is up and ends Dec 1st of this year. Summary: Using (only) lego, how far can you toss the blue ball? Current furthest is over 200" (17ft) by one entrant. Hmm....maybe this would be a good warm up for the cube anti-intruder defense? Ping pong balls could be a good auto-loaded assault ammo..aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0tag:blogger.com,1999:blog-35609237.post-1160151126877726312006-10-06T09:05:00.000-07:002006-11-13T13:01:04.015-08:00Mmm...small bits of acrylonitrile butadiene styrene...Or <a href="http://en.wikipedia.org/wiki/Acrylonitrile_butadiene_styrene">ABS</a>. The plastic of which Lego bricks are made.<br /><br />I started my fascination with Lego probably close to 25 years ago. That would make me...8 at the time? Maybe younger, but I was a Lego fanatic by 8 to be sure.<br /><br />Hours upon hours upon hours were spent with the toys creating Star Wars replicas, houses, horses, spaceships, cars, cats, moonbuggies, planes, <a href="http://en.wikipedia.org/wiki/Mitochondria">mitochondria</a>...<br /><br />And then, at about age 15 or 16, it stopped. Computers (an ancient XT clone), adventure games, and voracious reading overcame the time I spent with the small, perfectly formed bricks.<br /><br />Until now.<br /><br />Long story short, I have kids (3,5,6), pulled the old legos out of storage and rediscovered the magic. As I watch them make space ship after space ship after car after house I remember fondly my own hours. A 9lb batch of mixed regular/technic courtesy ebay + my own bits and pieces + a couple general brick batches and creativity has been flourishing.<br /><br />Well, that and suppressed profanity as I step on the inevitable 1x2 bricks hidden in the carpet.<br /><br />Why Lego Defense Industries?<br /><br />When I rediscovered my old stash, I gave my kids the "regular" ones, and took my beloved <a href="http://www.peeron.com/inv/sets/8055-1">8055 set</a> with me to work. While diddling around with gears and pinions entertained for a season, I longed for a goal. A Big Hairy Engineering Goal. And slowly...with visitors chatting, the next challenge revealed itself.<br /><br />How to fling an M&M 15 feet in a nice arc to land in the cube across a wall and one aisle away. I cackled evily as I imagined a barrage of chocolate death raining down from above like so much multicolored melt-in-your-mouth-not-in-your-hands hail. (actually, the target was a very congenial co-worker. Aka, someone who wouldn't chase me down and beat me with a mousepad were I successful.)<br /><br />(Anyway.)<br /><br />Many catapult ideas were built, scrapped, reworked.<br /><br />"This will never do", I thought to myself. I ripped through the history of "thingies which fling stuff at something else, generally a largish amount of space away, with the intent to cause mayhem".<br /><br />Looking for inspiration, naturally.<br /><br />Of course, these folks generally weren't necessarily concerned with efficient confectionary delivery, ("pound cake" had a whole 'nother connotation) but the principles were otherwise very similar.<br /><br />One thing led to another and I decided to see if I could create an auto-loading mechanism with to increase frequency of pelting. <br /><br />(alas, unsuccessful. Mercifully for my officemates.)<br /><br />I continued wandering down the blue, red, green and yellow brick road. I began collecting sites that dealt with all sorts of lego flinging machines. Those that shot rubber bands. Popped ping pong balls. Launched gen-u-ine lego missiles. Goodness only knows what else.<br /><br />And then, it all came together. An unholy synthesis misanthropic intentions. A physical engineering challenge as well as an excuse to exercise <a href="http://msdn.microsoft.com/coding4fun/lego/default.aspx">Microsoft's .NET interface for mindstorms</a>, increase my coding skills, and execute a design and solution with real world parameters.<br /><br />An algamation of:<br /><br /><a href="http://jpbrown.i8.com/aegis.html">JP Brown's Serious Lego Aegis.</a><br /><br /><a href="http://www.formatc.somee.com/roborocket.asp">Daniel Rojas's lego rocket launcher</a><br /><br />and <a href="http://www.mocpages.com/moc.php/22386">Sebastian Dick's "Ultimate Lego Chaingun"</a> .<br /><br />(with inspiration from <a href="http://www.thesentrygun.com/">The Quintessential Sentry Gun</a>.)<br /><br />The progject's success will be determined by the ability of the device to track, shoot at, and hit one of these cool indoor <a href="http://www.crazyfruitbat.com/product.php?productid=129&amp;cat=0&bestseller">mini-helicopters</a> when monitored airspace is invaded.<br /><br />Well, that and my own childish glee at seeing a small chaingun spinning up with an ominous hum, wakening and stretching while noseing blindly towards unwary office invaders...<br /><br />("Please Exit The Office. You have 20 seconds to comply...")<br /><br />I get tingles just thinking about it. And fits of childish, diabolical, gleeful chortling.<br /><br />Progress will be posted here.<br /><br />Assuming my officemate doesn't have me comitted first.<br /><br />First hurdle...how to do the vision tracking? I'm using c#, so I'm not sure if I can leverage the <a href="http://homepage.ntlworld.com/lawrie.griffiths/vision.html">lejos vision system</a>, or if I'll have to write my own.<br /><br />Did I mention that I'm using this as a good <a href="http://www.itgroundhog.com/2006/10/wanted-developer-sensei.html">motivating point to sharpen my rusty-to-nonexistant coding skills</a>?<br /><br />Stay tuned.aaronhttp://www.blogger.com/profile/17810303501299623878noreply@blogger.com0