Futuristic Office Design


♪ [music] ♪ chris: welcome tonasa edge. franklin: an inside andoutside look. blair: ...at all things nasa. chris: you okay?franklin: what's up? blair: yeah sorry,i just need coffee, i went to thatmarvel movie marathon, where you literally sit inthe theater and watch everythingfrom...chris: oh leading up to

the avengers!blair: yeah and there's like 400 hours of footageand popcorn. i'm sorry. chris: well get ittogether because we have a jammed packed show. franklin, we're going tobe talking about advanced exploration systems, or aes. franklin: yeah, and one of thosetechnologies is 3d printing that is actually up on the international spacestation. blair.

franklin: let'spull it together. chris: later in the show you'regoing to be talking with deanne bell with thefutureengineers.org. blair: yes. i am! blair: going to be talkingwith deanne bell. chris: and in the meantime, ihad the chance to sit down with jason crusan whois the head of aes, and he's going to tell us allabout the cool technologies coming out of hisoffice. let's check it out.

chris: so jason, i understandthat you're the q of nasa. jason: well that's aninteresting reference in itself, but it's a nice analogy if youthink about q getting ready for bond to go off and do whatevermission he was being charged to do. our group ismuch like that. we're designing all the systemsto send our crews off to explore deep space. chris: now withinyour portfolio, or your technologies, whatare you trying to develop?

jason: so a couple fundamentalthings: you need to be able to get into space, you need tobe able to live in space, and be productivewhen you're there. so we're building a lot ofstuff that allows you to live in space. we are developingsome of the next generation habitation systems.where's the home? how are peoplegoing to live in that? life support systems for it;how you're going to handle logistics, andmanagement of that.

overall, being ableto live in space. chris: now i guess, let's saywhen we go to mars one day, we have the firsthumans on mars, the first thing that comes tomy mind has to be space suits. jason: absolutely. sowe're also advancing the new space suit technologies. and space suits we see what yousee on the space station today. they go out, theyrepair something, they fix something,they come back in.

on a trip, to say mars, you'repotentially going to go out, fix things along theway, long duration there. and then when youget to the surface, you wanna go outside.chris: right. now one of the cool labs wehave here at nasa johnson space center is the portable lifesupport system ventilation laboratory, and that's wherethey're working on the space suits of the next generation.jason: correct, yeah. so the suit ismade up of two parts.

the actual garment that youwear and then the backpack; the portable lifesupport system. the life supportsystem, the one we have, has been very reliable.however, it's getting pretty old at this point and there's a lotof new technologies that we actually want to incorporateinto the backpack of the future. for assemblingthe space station, or what we did on the shuttle,you're working in zero gravity, or near zero gravity, so theweight of the suit didn't matter

as much, the mass of the suit. but when you get to the surface,even though there's really reduced gravity on mars, you'restill going to have to carry around that weight, so you'regoing to need a lighter weight suit and also one that youcan use more frequently, and also one that putsup with the environment; the dust, the rocks andall those kinds of things. when we did the shortduration eva's during apollo, we only did a very few number ofthem and we were on the surface

of the moon for avery short time. mars, we're going to bethere for a long time. chris: mobility willprobably be an issue, you said weight is an issue.the flexibility of actually working in that environmentwould be a key factor. jason: correct, yeah. so a lot of thestation assembly, they optimized the suit toworking on the space station. so your work zones and such,you're not picking up things off

the ground, you're not usinghand tools and those kinds of things. instead you'returning bolts and all that, so you have a different type of work that you'regoing to be doing. chris: now is theresomething with that backpack, is there something you wantto miniaturize it and make it assmall as possible. but on the flipside,you want as much oxygen, the astronauts to breathe; tostay out there for extended

periods of time on the surface. jason: yeah, so you have thishard challenge of wanting to be out there as long as you canbe out there and making it as lightweight as possible. which is what most people couldrelate to if anybody has ever traveled, you don't want to becarrying around a big heavy bag allthe time either. chris: that'sright, that's true. now, what are some othercool technologies going on?

jason: one of the problemswe have is managing all the logistics. if you'regoing to be gone on a trip and you pack your car, and you need to figure out whereeverything is going to be in, say your motor home, overthe course of a couple years, how are you going tofind all that stuff? so what we're going to dois use next generation rfid, or what we'd callradio frequency id tags, and what those allow you to dois wirelessly track an inventory

where everything isinside of your vehicle. chris: that actually makes sensebecause if you take a look at something like iss where youprobably have thousands and thousands of pieces ofequipment on the station. and how do you keeptrack of all of that? jason: yes, and onthe space station, we don't sometimes.there are a number of items that we've lost onthe space station and we have topotentially fly a new one up.

on the space station, youhave the additive benefit of the crews changing every six monthsso imagine if you were living in your house for six months, youput everything where you wanted it to go, somebody else comesup six months later and moves it all on you, and thenyou come back again, and nobody knowswhere everything went. so everything will have theequivalent of almost like a high-tech sticker thatactually tracks every piece, and you'll havedifferent types of readers,

so you'll have readersthat are in between modules, so you can track when somethingmoves from one module to another, and you'll have otherreaders that may be hand held so you can scan your storagebags and figure which bag it is exactly in.we're even looking at how do you make one ofthose scanners and put it on one of ourflying robots on spheres. so we're actually going to testa mobile rfid reader where you actually attach it to the robotand let the robot figure out the

inventory. it cango out and manage an inventory where everything is. the crew doesn't actually haveto do that kind of mundane task, the robot canactually go off and do that, and in fact our space technologymission director colleagues are starting the development on thatrobot that will follow on after spheres, and itsname is astrobee. chris: one of the cooltechnologies that i know we've been watching closely is theadditive manufacturing or 3d

printer. we haveone on the station now. how's that coming along? jason: so, we're talking aboutall these parts and pieces that you want, and you try to predicteverything that would ever go wrong, well we're going tonot think of some things. so one of the advantagesof additive manufacturing, if we don't have a part, we canjust order it up and have folks here on the grounddesign it digitally, email the file out, and thenprint out the part in orbit.

chris: and how long is thatprocess in terms of making a tool, of making apiece of technology? jason: so, on station, we'vealready printed over 20 some parts. and in factyou can print out several parts per day, whenever youwant, just on a single printer. franklin: this is franklin. blair: hey franklin,what's the code for q's lab? franklin: you know,i'm not quite sure, but try this. itusually works for me.

blair: alright.franklin: up, up. blair: not really directions.franklin: down, down. blair: got it.franklin: left, right. left, right. b, a.select, start. computer voice:mission complete! blair: oh! thanks,great. awesome. franklin: chris, thatwas a great segment. and that piece on rfid's, i wishi had that kind of technology in my house so i could keepup with my phone and keys.

chris: i'd like to keep it onall the toys that my son has! i mean, he's losingtoys all the time. franklin: yeah,they're under your feet. chris: that's true.hey blair, you alright? franklin: blair? chris: did he watchthe movies last night? franklin: he must have leftthe theater and came right to the set. chris: i'll tellyou what, you know,

let's continue on. i mean,i don't know what his deal is, but another cool piece oftechnology at the end of jason's piece was talkingabout the 3d printer. and you had a chance to sitdown with niki werkheiser. franklin: yeah, niki was tellingme about the technology that is up on the iss, and how thismight be using the future of space exploration, goingto mars. chris: hey, let's check it out. franklin: today, we're at theadditive manufacturing lab at

the marshallspace flight center, and i'm talking with the 3dprinting in space project manager, niki werkheiser. howyou doing niki? niki: hi, i'mdoing well, thanks. franklin: additivemanufacturing. what is it? niki: so additive manufacturingis actually the kind of formal term for 3d printing.traditional manufacturing is subtractive. you have a material and you take awayfrom it.

additive is any process whereyou actually build the part that you're trying tocreate, layer by layer, so it's additiveinstead of subtractive. franklin: 3d printing has beenaround for a long long time. so why is it right now we'retalking about doing 3d printing in space? niki: so 3dprinting, you're correct, has been on the groundfor quite some time, but as you probablyknow, in space travel,

we depend on flying every singlething from the ground to the space station, for example,that we might ever need. so our supply chain, from theinception of the human space program, has reallybeen quite limited. when we really start to thinkabout exploring further out destinations, like marsor asteroids or the moon, that supply chain modelreally isn't feasible. we have to think about how wewould respond in real time, in a sustainable,affordable way,

if parts get lost or broken. if we're doingscience for example, just like in alab on the ground, we have disposablehardware, sample containers, and syringes, things likethat right now we're completely dependent upon launching fromthe ground to the space station. so being able tocreate what you need, when you need it, on these typesof missions is really a critical enabler to sustainable,affordable exploration missions.

franklin: well, i've seen3d printing work here on the ground, but to get it in spacewhat are the technology hurdles that you have to get over tomake sure it works the same way in space as itdoes here on earth? niki: right, so those wereactually our exact questions. as a matter of fact, it was backin 1999 that ken cooper here at marshall space flight center,flew the first 3d printer in on a parabolic flight to see howit'd react to microgravity. since then thecompany made in space,

which we have a small businessinnovation research award with and actually built the 3dprinter that we've launched to the space station now, has flownover 500 parabolas on those flights through nasa'sflight opportunity program. so from that, we'vegotten some really good data. we've been able tosee, in microgravity, the basic response when you'relaying the layers and performing additivemanufacturing. however, you only get the 20to 30 second spurts

of microgravity onthose flights. so the bottom-line is that thespace station is actually the only platform we have in theentire universe where we can test this process out and printa complete part in microgravity. and that's why the firstprinter that we just launched; it is the first 3d printer everin space and we launched it on space x4recently, that's why it's called a technologydemonstration. franklin: now on the table rightover here we have a replica of

what is flying onthe iss right now. exactly how doesthis 3d printer work? niki: so this firstprinter that we're flying, we're actually operating in themicrogravity science glove box, and that is because since thishad never been done in space before, we did not haveall the data for things like flammability andoff-gassing of the heated, extruded material thatwe're printing with. since then, we've collected allthat ground data and found that

actually theresults are promising. the next printer willactually operate outside of msg. we'll have a next generationthat's based off of what we learnedoff this printer. we've alreadylearned a great deal. when you're designingsomething for a space flight, you actually need moreautomation than you have on the ground. astronaut timeis very valuable and limited, so you want to beable to automate.

you also want to be able tocontrol it remotely from the ground asmuch as possible. so you'll note for example, thatwe have two large windows in the printer and we'll have camerasaimed at those windows during the printing process, and we'llbe able to see in detail as the layers are being deposited,how that process is unfolding. what's reallyexciting about this is, we can actually email our 3dprint files directly to the 3d printer from the groundto the space station.

so it sounds veryscience fiction but it's not. it's going to bescience fact very soon. franklin: what material is beingused in the production of the parts that are goingto be made on the iss? niki: for our first printer,the technology demonstration, we're actuallyusing abs plastic, which is the sameplastic, if you see here, this is a littlepiece of the filament. this is the same plasticthat legos are made out of,

for example. thefilament we use is just like this and to be quite honest it looks almost just likeyour weed-eater spool. we're actually looking at thenext generation printer as well for even more materials,stronger plastics for example. franklin: we'retalking about plastics, but when we getdown to the point, we're talking abouttools that break. what is the future for usingmetals in space

and building thosetypes of tools? niki: right, so at nasa, weactually have what we call the in space manufacturinginitiative, and that initiative actuallyis composed of a road map or a vision of all the integratedsuite of capabilities that we'll really ultimately needfor exploration missions, that we want to teston the space station. we also want to dothings, as you mentioned, like printing withmetals in space,

printing electronics as well. we actually, last year nasareleased a small business, an innovation and researchproposal for a recycler on how to take that 3d printedpart and turn it back into usable feedstock. franklin: niki, what arethe goals of this technology demonstration on the iss? niki: so, for thetechnology demonstration, it really has two phases,and the very first phase is

specifically just toanswer the question, "does the additive manufacturingor 3d printing process work in microgravity the same way itdoes on the ground?" so for the first phase, we'll actually beprinting a lot of parts that may not look superexciting to the laymen, but are very exciting to us. we'll have coupons, so we'llhave things that look like this. this is a tensile specimen.we'll be doing things like compression, flexure,and torque.

for those parts, we'll bewatching from the ground as the parts are printed,through the cameras live, so we'll be able to tell a lotof information and data we'll be able tosee immediately. however, toreally determine that, we'll be flyingthose very first parts, those coupons, we'll be flyingthose back to the ground and we have printed those same partson the flight unit before we launched it. so we'll bedoing some detailed

engineering analysis and testingto compare those parts. once we've established that the3d printing process does work the same in microgravityas it does on the ground, we have a second phase, and howi like to think of that is the first phase really focuses onthe printer and the printing process, and the second phase,we actually turn our attention more to the partsthat we're printing. so utilization parts, we havea broad range and we're developing autilization catalog.

you can have thingslike sample containers, small hand tools, replacementparts for exercise equipment or medical tools. there'sjust a plethora of different areas andcategories we're looking into. but the thing there is to learnhow to design these parts and build them in microgravityand to create a sort of certification process.we've never actually made the parts we needed in space. we've launched everything fromthe ground so we have a very

well known process for how wehandle things like safety and flight requirements, so it'skind of fun to start thinking of how we would certify a part thatwe actually built on the space station. so thoseare things that we'll be working on inthe second phase of the technologydemonstration. one example, you know wehad a payload on orbit, and you have to changefilters out as a requirement, every so often. it was timefor the filter exchange,

and the filter cap was missing.it's a real simple little part. we were able to 3d print that onthe ground in about 45 minutes. of course we didn't have the3d printer on board when this happened, so they actually hadto wait 6 months for the next supply ship before theycould use that facility. even though that wasn't alife-threatening example, it's one that has very real andmeaningful implications to this science and to the dailyoperations on the space station. franklin: what's going to happenin the next generation

of 3d printing inspace? niki: yes, so we're alreadyworking that and everything that we learned from thistechnology demonstration, including what we've alreadylearned from the design and the operations, gettingit ready for flight, will feed into thenext generation printer. the really exciting thing aboutthe next generation is that it's going to be acommercial printer. it's called the additivemanufacturing facility and it's

being developed by the companymade in space and they're out in silicon valley, so it won't bejust nasa or the government that has access to 3dprinting parts in space. it will be available foruse by industry and academia; small businesses, largebusinesses that are interested in making something in space. so i think it's very exciting tothink about opening that door, and opening the door to thespace station and able to manufacture parts inspace to more

people than just directly nasa. blair: thistechnology is awesome. and i got to tell you guys; inlight of all the technology that we've seen in the show today,i've got something special that i've worked up with the helpof our good friend j.a.r.v.i.s. we're going totalk to deanne bell. hi deanne. thanksfor being on the show. deanne: okay well we'rerolling and we're good to go! blair: let's get started witha very important foundational

question. what exactlyis the future engineers program? deanne: right, so futureengineers is a program that was started to really inspire thenext generation of innovators and explorers. it'sa website; you go to futureengineers.organd there's all kinds of education resourcesand our website challenges students to create 3dmodeled inventions for space. the program is an americansociety of mechanical engineers foundation program in technicalpartnership with nasa and it's

really exciting. ourfirst challenge launched with the first zero gravity 3dprinter that went to space, and you know that's not thefirst and only challenge. we have many more challenges inthe pipe and we're constantly developing new challenges andnew curriculum to really connect the excitement of spaceexploration and space research with the excitement of creatinga 3d model and turning your idea into a 3d modeled reality. blair: recently you announcedthe winner for your first

future engineers challenge. what did that firstchallenge involve? deanne: the first challenge, wechallenged students to create a space tool for astronautsand we had so many different submissions from all corners ofthe country and ultimately we chose 10 semifinalists in each age group. we had two age groups: under 13and over 13 that are enrolled in a k-12 school and our winner inthe juniors age group is named sydney vernon and shedesigned a space planter

to grow a seedling in space. our winner of our teen division,his name is robert hillon based in enterprise, alabama and hedesigned something called the mpmt. it's the multi-purposeprecision maintenance tool, and he basically took agajillion different tools and put it all into one tobe 3d printed on station. and the excitement is,that one actually is getting 3dprinted on station. blair: what's nextfor future engineers?

deanne: there is so muchexcitement going on with the future engineers program. we are growing; we are alwaysin the process of developing new challenges. thisprogram wasn't just one challenge with that firstprinter that went up. we're really focused on amulti-year endeavor of getting students, creatingtheir inventions, and 3d modelingthem in the computer. every challenge that futureengineers issues in partnership

with nasa is going to becentered around research that's going on at nasa, so it's areally great opportunity to pair all of the excitement and allthe different areas of nasa research with k-12 programs to connect it with students inthe classrooms. blair: how can studentswith future engineers get involved with theavengers initiative? uh... future challenges...it's future challenges. how can they getinvolved in future challenges?

deanne: right, so you canget involved just by going to futureengineers.org.the site's more than just a place to registerand submit a model. there's all kinds ofcool, fun goodies to explore. there's videos about how toget started in 3d modeling, how to learn about3d modeling concepts. there's also all kindsof space science videos. there's different animatedscience lessons that you can learn about microgravity, abouthow rockets resupply the iss.

there's all kinds of contentthere to explore so i strongly encourage students to go there,to just dive into the site and look at all the resourcesthat we've curated for them. blair: thanks deanne, andthanks future engineers. deanne: thank you! blair: what'd you guys think? franklin: dude, that mightvery well have been the best interviewyou've ever done. blair: franklin, ireally appreciate that.

thanks so much! chris: as good asan asgardian god. blair: thor! that's awesome! [r2-d2 beeps] blair: r2! willow: you are great.blair: willow! chris: blair! blair!blair! blair! [r2-d2 beeps]franklin: blair. blair! chris: hey! what's up? blair: a outside lookat all things nasa!

franklin: we lost a wholeday because you were asleep. next time, just see one film. blair: one film?franklin: one film. chris: he does thisto us all the time. franklin: all the time. we haveto shoot tomorrow morning. 9am. dude, next time,bring your a game. chris: get some sleep. chris: and by theway, you blew it with the avengersquestion.

blair: avengers question... itwasn't a dream... it was real!

Futuristic Motorbike Design


>> tomas reimers: cool. so hi, everyone. my name's tomas. i'm a tf and this is armaghan behlum: armi. nice to see you guys. tomas reimers: cool. so we're going to be talkingabout leap motion today. so leap motion is areally cool product that

lets you interact with acomputer in a different way. so the whole idea behindleap motion is that you can use your hands tointeract with the computer. so right here i have something set up. i'll talk about it in a bit. but the basic version is you cansee that i have my hands in front of my computer and when i move them,you get the analog on the computer and you can analyze this. you can make gestures.

you can use your hands tointeract with the computer in new and interesting way. >> well, i actually firstwant to pass off to armi to show you some cool demos of whatsome people have done with this. and then we'll talk about howyou actually code with this. armaghan behlum: yeah. hello. so as we saw, littledata here, but let's see what some people have done with this.

so let me just open up this example. and then, so, for example, you can seemy hand analog there, but now this time some people using unity havedecided to put a little more skin and stuff around the hand. so i can, let's go with this one,sure, have my hands interacting. and you can probably imagine acouple of other cool useful things that you can do with this. so this is at least one example. and then let's jump out of this.

>> and then another cool oneis, let's go with this one. plasmo ball. again, we wouldn't necessarilyexpect this level of complexity from a final project for cs50. this is just to show yousome of the, give you guys a little inspiration for whatyou guys can do with leap motion. so for example here's a coolphysics example, which there we go. has both of my hands so now youhave this little plasma ball. and the ball is reacting to the physicsof me moving my hand around the ball.

now this is all though using unity,using kind of tools and frameworks that we haven't taughtyou guys in class, but as you can see some prettycool run throughs with that. >> but one thing that you guys can dostarting off right now with leap motion is work in javascript. leap motion has a javascript api thatyou guys can use and we highly, highly recommend that you guys buildyour projects using that. so with that, let mepass it back off to tomas to talk about leapmotion and javascript.

or do you want to showthem the visualizer first? >> armaghan behlum: oh yes. yes. let's talk more about that visualizer. >> tomas reimers: so on a most basiclevel, when you first get to leap motion you're going to have this box. here, want me to take control? >> armaghan behlum: yeah, go for it. >> tomas reimers: so when youfirst get to leap motion

it has a device whichlooks something like this. you plug it into your computer,install the necessary drivers, and then it will basically be set up. so the easiest way to sortof deal with leap motion is open up this program it installscalled the leap motion visualizer. and the visualizer is literallywhat i'm showing here. it allows you to see theskeletal outline of your hands. and what the leap motionis interpreting them as. so the leap motion uses the camerato sort of look at your hands

and then it tries to guess what thebasic skeletal composition that you see on the screen is. and that's what it shows you. armaghan behlum: everysingle little point and thing that you see there isdata that's available to you guys as well to use. so you see that it'scapturing that tomas has five fingers, each ofthose different fingers are also available for you as datapoints to use in whatever application

that you might want. if you want to see ifsomebody's doing a thumbs up you can see if their fingersare curled and whether they're thumb finger is pointingupwards, or where their wrist or palm isand that type of stuff. so you can see some gestures itunderstands better than others. remember, that it is looking at yourhand from at a camera from the bottom, so when you have your hands likethis it understands them fully, but once you start to try and do athumbs up, sometimes it reads it,

sometimes it can guess, but honestlythe camera just can't see the thumb. so it's not reallysure what's happening. just some limitations to keep in mindwhen you're developing with this. >> anyway, so going back to this. the visualizer actuallyhas a lot of useful tools. so the leap motion isprogrammed in such a way that they don't expect you tointeract with that image data. they don't reallyexpect you to understand what's happening behind the scenes.

what they do is exposea bunch of apis for you such that you caninteract with this data directly without understandingwhat's going on under the hood. >> so if we hit h here in the visualizeryou'll see a lot of options. the important one here thoughis if you hit o and then hit h, you'll see that itlets you draw gestures. so a gesture, you'll seeit draws an arrow across. a gesture is one of the ways which leapmotion sort of lets you get at the data without having to process it.

so rather than me needing to figureout, oh, the hand was moving, even if i have point access, theapi will sort of just tell me, hey, they made this gesture. so you can make basic arrow gestures. you can make circle gestures. you can make tapping gestures. and you can make key press gestures. yeah. and that kind of stuff.

so now that we've sort ofseen what leap motion can do, you can see it can read awhole bunch of gestures. i think i'm going topass it back to armi and he's going to talk about howyou get at these with javascript, how you even begin a project with this. and then we'll talk about somecool places you can go with that. sounds good. so yeah, the very first thing wewill want you to do of course, is after you get the leap motion is togo to leapmotion.com, set up, install

the drivers and stuff. after doing that you can gomake sure that it's connected. if you see in your little tray theleap motion icon and it's green, then you know you're all set. and of course check out exactly whattomas just showed you with the gestures and doing the screen taps, andkey taps, and that type of stuff. >> after that though we,once again, like i said, we have access to all of thesethings in javascript as well. the ideal set up thatwe would recommend you

guys is to go into yourvhost directory, local host, public in your cs50 appliance. and when you go there what you'llsee is a index dot html file. now that index dothtml file or index dot php file, whichever isfine, what you can then do is go to your main operating system. and if you go to the ip addressthat's listed in the bottom right corner of your appliance right here,as you can see, then what happens is you go to the page that'sreferenced by that index dot html file.

so all the code that you might put inthere gets sent and is usable here. >> tomas reimers: so it's alsoimportant just for reference that if you guys actually knowhow to set up a server yourself, or you want to put this on the worldwideweb, you're welcome to do whatever. remember that these arejust javascript files and all the leap processingis done on the client. so it doesn't really matterwhere your server lives so long as the computeryou're viewing the website on has leap motion installed.

armaghan behlum: absolutely. like tomas said, yeah,whatever works for you guys. this is just one of our recommendations. now to start using leapmotion what you would do is you would import thejavascript file from leap motion. and then from there whatyou can do is, right now i just have this paragraphtag set up with an id of text. things that we would recommendare setting controller options for leap motion with theenable gestures to be true.

so by default thosegestures that we showed you guys, the circle, and thekey tap, and the swipes, those aren't shown toyou guys by default. but we highly recommend using thoseso you're not reinventing the wheel. enable those to true, passing thosecontroller options to leap dot loop and you're all set to go. because then you just havedefined a anonymous function that will take in aframe from leap motion and that frame has all theinformation that you're going to need.

>> tomas reimers: so just torecap, you have one object. you have this functioncalled leap dot loop. and you call it with two arguments. you call it with one,the controller options. and there are a lot ofoptions you can put in there. the one we're going toemphasize is enable gestures. and if you set it equal to true thenyou can get access at this gestures that we showed you in the visualizer. >> and then the second argument is afunction, it's kind of like a call back

which will be called everytime every frame of leap, so every time leap registers thatyour hand move, it has a new frame. and it calls this function with oneargument, which is the frame object. and that frame object describesthe frame as leap sees it. armaghan behlum: exactly. so this contains all the usefulbits and pieces of information that we were talking about earlier. checking frame dot gesturesis a array of gestures that the leap motion caught yourhands doing in the last frame.

so for example, what we'redoing here is we're checking, hey, leap, in that last frame didyou catch any gestures that i did? and if so what we decide to dois iterate through those gestures and try and get some usefulinformation from them. each gesture has a uniqueid associated with it. they have types. you can look at which fingerswere involved in the gestures by checking out this pointable stuff. so if when you go through theleap motion javascript api stuff,

when they mention pointables,they're talking about these fingers. and then hands are, of course,the entire hand object. >> what else? you can check how longthe motion went on for and, yeah, all those useful things. so what i'm doing right nowhere is i logged the frame, and then i update my html to displayall of these bits of information from the frame. so let's check that out.

>> so here it is. here's the index dot html file. and as you just saw when i just movedmy hand leap caught a circle motion. so you can see me doing a circle overhere, updates with circle information. doing swipes, catches swipes. let's try a screen tab. there we go. screen tap and a key tap. so key taps also, by theway, are when you hit down.

so you can imaginemaybe playing a piano. >> and then screen taps arewhen you hit the screen. so you can imagine maybe you actuallyhave a touch screen in front of you and you're hitting the touchscreen in front of you. and then we can grab oneof these objects in here. so remember i said that i waspassing the frame into console log. and so we can check out all thebits and pieces of information that are available inthat frame as well to use. >> like i said earlier,pointables are the fingers.

at that moment we didn't have ourhands in front of the leap motion so it registered zero,but this is how you would start to find out maybehow many fingers are the screen. and that type of information. tomas reimers: and rememberingthis is just an object. so everything can be accessedsort of like a struct in c. you have the objectname dot the property name. and then within that you havearrays and you have other objects, but remember it's just an object.

there's nothing specialbecause we're using leap. cool. should we check out a coupleof javascript examples? >> tomas reimers: soquickly remember that we said that leap can actuallyrun on any website. leapjs is just served to a client. and so along as the client hasleap motion attached it will work. so leap motion has awebsite where people can share their examplesof things they've made.

so we're just going to gothrough a couple of them to see what's possible beforediving into more specifics about how it's possible. so armaghan behlum: let's see. tomas reimers: now it should be working. armaghan behlum: so nowbefore we saw an example using unity that rendered our handswith pretty impressive graphic skins, but now you can see you can do thesame thing inside a web browser.

this is all inside chromejust using javascript. and then the other nicething is if you want to know how they did this,the examples on javascript also include code options thatyou can check out and then see how this person was grabbinghands and codes and such. >> so that's all you can findat developer.leapmotion.com. you can go and check out javascriptexamples that they have there. so yeah. here are these, oops sorry.

let's try that again. oh. i have two right hands. >> tomas reimers: so and again,remember sometimes leap messes up. just give it a second. it's not perfect, but it's pretty good. armaghan behlum: oneother recommendation also is to not do it in direct sunlight. so the way leap motionworks is, actually

if i show the camera thisas well, infrared light. so it sends those out and thenreads them when they come back. so if you're trying todo it direct sunlight, for example, it's probablynot going to work, or it's going to requiresome calibration to do so. >> also another recommendation is toclear the space behind the leap and in front of leap. think of it as workinginside of a dome that's surrounding this leap motion object.

if there's stuff rightbehind it as well, that's also going to interferewith how the leap motion's trying to recognize your handand that type of stuff. >> so, for example, i think in thiscase it's my laptop actually that's kind of making the leap motion. yeah, there we go. so if i clear out my laptop frombehind it the hand show up pretty well. there's that. so what else did we show them.

tomas reimers: i thinknow would be the time to sort of dive into and let's justmake a demo totally from scratch. it's going to be really simple. basically what we're goingto try to do is make it so that when you swipe your hand, thebackground's going to start out as red, and when you swipe your hand, thebackground's going to turn green. ok? really simple. and it's basically justgoing to go through a lot

of the concepts behindleap so that we can get into this ideology of how leap worksand how we can build stuff with that. and then from there we'llprobably just show you the api docs and where youcan read more about this. and then we'll call it day. so do you want to code ordo you want me to code? well, i guess we can worktogether on this and try >> tomas reimers: so we'lldo some pair coding. armaghan behlum: there we go.

that's exactly what iwanted to check out. so for example in here, let's see. while we are iteratingthrough the gestures already, tomas reimers: want to makejust a completely new file? armaghan behlum: completely new file? yeah, sure. >> tomas reimers: yeah. >> armaghan behlum: so let's do that. >> tomas reimers: so we're goingto make a completely file.

we'll call it hand dot html. that's cool with me. so remember you do an html tag,then within that you have a head. that head has a title within it. so tab the other way. there you go. title, we'll call it leap example. yep. >> armaghan behlum: oops.

title. >> tomas reimers: yep. >> armaghan behlum: there we are. >> tomas reimers: andthen let's make a body. >> armaghan behlum: wait, let'salso make sure to import. tomas reimers: oh, of course. my bad. so always make sure you have the leapscript so that's a script given to you by leap motion which basicallyallows the web browser to connect

to the device on the user's computer. and then in this we alsoneed a body and let's just make the body say hi sothat we can show students how to connect to this newweb page that they made. armaghan behlum: sure. so let's just put another-- >> tomas reimers: hi, hello world. so a very basic example. really just a demo.

>> armaghan behlum: and then in here wecan go to, we called it hand dot html, right? and oh! so i wonder what's wrongwith this right now. let's add read permissionsto hand dot html. tomas reimers: do you wantto do it in the big terminal so that we can just show it on the-- >> armaghan behlum: yeah, that makes sense. all right.

so i just added thepermissions, but if we were to check out thepermissions before we would have seen that actually handdot html didn't have read permissions and therefore we couldn't render it. but now if we do so, we see ourlittle hello world right there. >> tomas reimers: so let's actually,as he was writing, hello world, i thought about a waywe could change this. let's make it say hello world, andthen when you wave, it says goodbye. right?

so hello, goodbye. >> armaghan behlum: sure. >> tomas reimers: that sounds pretty good. >> armaghan behlum: thatsounds good to me, too. >> tomas reimers: so if we'regoing to do that let's just think through the web page a little bit. we're going to need some scriptwhich basically registers that you waved and to a leap,a wave and a swipe, same thing. so we're going to need a script thatbasically registers for that swipe.

and another thing we'regoing to need is we're going to need someactual content to change. >> so as you remember, jqueryallows you to change content. so one thing we might want to includein this is the jquery library. and then to be able to select whatwe're actually going to change content, that's going to need an idor a class, or something that we can use to select it. so we'll just give it aquick id of change text. and then do you want to grab jquery?

armaghan behlum: so what's the firstthing on our to do list then now? tomas reimers: let's grab jquery? armaghan behlum: let'sgrab jquery, ok, cool. in that case, i'm goingto have to actually-- where would be thebest place to do that? >> tomas reimers: jquery, so if yougoogle jquery, hit jquery, the first armaghan behlum: very first one. tomas reimers: or download. it's fine.

hit download v1 and v2 on the left. so we're describing jquery fromonline like you've probably done. scroll down. up, up. >> armaghan behlum: oh, right here now? tomas reimers: or that. so jquery has a hosted versionwhich means that you don't actually need to download it,but you're more than welcome to download itand host it yourself.

armaghan behlum: cool. so now we have jquery. now what's next on our to do list. tomas reimers: awesome. so next what we needdo is we actually need to give p hello world an idso we can change it, right? so let's give an idea of,i don't know, change text? armaghan behlum: let's justdo it this way, i guess. tomas reimers: changetext, cool.

and now let's just refresh the page. make sure everything works. so back in the browser. always a good reminder thatwhen you're building a website, probably refresh every time you makeany somewhat significant change just because sometimes youaccidentally drop a tag, or you accidentally delete something,and then you break something small, but then when you make a bigger changeyou're like, why did this big change seemingly break the unrelated thing.

so it's always good to sort ofgo and do those sanity checks. >> anyway so now let's doone last sanity check, which is let's try to changetext without leap motion, without anything, juston the page load it'll change hello world togoodbye using jquery. so if you remember jquery exposesthis dollar sign function, which we can pass css selector to,namely hashtag change text, which selects the element withan id of change text. and then we're goingto call the method html

on the object it returns with theargument of a string goodbye, which will change the itemshtml to say goodbye. awesome. that seems pretty cool. and now when we refreshthe page we're going to see it instantly changes to goodbye, right? because it doesn't wait for anything. sort of as soon as that scriptruns it changes it to goodbye. >> so now let's wrap that in a function.

right. so we're going to wantto make a function. we'll call it goodbye. so function goodbye isgoing to take no arguments and it's not reallygoing to return anything. and it's just going todo that in javascript. excellent. so our function goodbye nowchanges the text to goodbye, right? so this gives us a wayto basically change

that text to goodbye wheneverwe called that function. so this is pretty cool. >> armaghan behlum: well, wecan also just make sure that now since we're not calling thefunction, if we refresh the page, notice it's not goingto change the text. >> tomas reimers: excellent. so now we're going to startto get into that leap stuff that we were talking about. so armi, do you want totake it from here or?

>> armaghan behlum: yeah. sure. i'm probably going to needto double check things, but for example rememberwe said we wanted to make sure in optionswe set enable gestures tomas reimers: good catch. armaghan behlum: to be true. and then we were recommendingthat you guys would run leap dot loop, whichas we said earlier,

has two options, a json object thatis the options for how you want to configure the leap motion towork, and then a function that's going to catch a frame as a callbackfunction like tomas was saying. and then edit what you wantto do with that function. >> so we pass in theoption and now we define a function that will take in a frame. and now we have to definewhat that function does. it's also for the sake of thefuture, do that to make sure. tomas reimers: excellent.

so now we have thisleap dot loop function call which basically says watch leapwith these options and every time something changes, call thisfunction frame with all of the data that you are aware of in frame. sounds pretty good. so now quick sanity check,which i always recommend, is in that just putconsole dot log frame. and then in chrome open itup and look at your console and play around with leap to see theframes being logged because that will

get you an idea of whatdata you have access to. and as always if you get confused,look up the api reference. and we'll include the linkfor that at the end of this. >> armaghan behlum: so werefresh the page and then we go and open up the console again. and now we notice that we'rehaving frames passed in, these little objects we saw earlier. these are our framesshowing up in the console. >> so now that we've grabbed theframes, as you might remember earlier

from the example that we had,if we check frame dot gestures we get the list of gestures thatthe frame most recently caught. we can check the length of that arrayto see if leap caught any gestures. so if that array isgreater than zero then we know that we have some stuff to do. >> so let's wrap that up in an if conditionand now in here what we know is we have seen a gesture, let's act on it. so now that we're in here wehave a gesture to check out. tomas reimers: well, the firstthing is it's not just one gesture,

it could be as many gestures. >> armaghan behlum: very true. tomas reimers: so perclassic c style here we'll probably want to use a for loop. armaghan behlum: here we are then. we decided to iteratethrough the gestures. and let's see. i plus, plus. and now if we maybe madejust a var gesture equals

frame dot gesturesbracket i, now we have gesture itself, which is just onesingle instance of a gesture object for us to work withinside of this for loop. tomas reimers: let's sanitycheck here again and just console dot log gesture to see what we get. >> armaghan behlum:console dot log gesture. okie dokie. and refresh one more time. >> tomas reimers: and let'stry making a gesture.

you'll see that a bunchof, when he swipes, you get a bunch of gestures in theconsole and if he tries to do a circle, it's just-- >> armaghan behlum: circlesare just really nice. >> tomas reimers: now there's a weird thinghere, which is he's doing one circle, but this is logging 80 gestures, right? that's a lot of gestures. so the first sort of thing torealize, and this can be confusing, is that a gestureisn't just logged once.

>> on every frame, right,so if i'm doing a circle leap will detect thisis a change, from this is a change, from this is a change. and it will log each one of those. but in each one of those,it's going to say, oh, there's a gesture currently in progress. so let me just say, hey, there's agesture and it's currently in progress. so what we don't want todo is say, oh, on every one of those gestures youwant to change text.

what we want to do is when that gesturestops, and we can check for that, then we want to change text. armaghan behlum: mhmm. so like tomas isexplaining these gestures might appear through multipleframes, but for example, when we were havingthat circle, we can see that the id for that onesingle circle that we might have been trying to completewas the same id throughout. and in fact, you can alsocheck out the status.

updated. >> and then this is probably thelast circle that, oh, well, ok. so sometimes it shows you astatus of stopping a gesture and it also shows you a statusof starting a new gesture when it recognizes for sure thatyou've started a new gesture. for example in this case. armaghan behlum: so yeah. and then, let's see. you can also noticethough we were making

a circle and gesturehas a field called type that tells us what kindof gesture that is. so that might be useful for usyou try and do what we're doing. tomas reimers: sotransitioning back to js, the first thing that occurs to mealso, just reading through this code is there's a small optimization,which is we actually don't need this if condition, right? because if frame dot gestures dotlength is zero, that for loop's not going to run anyway.

so we may as well just goahead and get rid of that. again, while you're writing codeit's important to go back and sort of refactor as you realize that youcould have done something better, or that there is another way to do that. so now we're just going to clean thisup quickly and also clean up your code. that's a big deal. >> armaghan behlum: goodstyle is very appreciated. >> tomas reimers: you canalways tell when someone has code where there used to be an ifcondition and then they removed it,

but they didn't uncomment it. it's very obvious andit kind of looks ugly. armaghan behlum: so what'snext on our to do list? tomas reimers: so now as we were saying,i guess the first thing we want to do is make sure that that gesture'sactually a swipe, right? >> tomas reimers: so if we're saying thatour goodbye is kind of like a swipe, we'll go with it's a swipe, thefirst thing we need to say is, hey, is the gesture type a swipe, right? not a circle or a top,but is it a swipe?

so the way we can do thatis we can say gesture dot type equal equal swipe as a string. >> armaghan behlum: [inaudible] gesturedot type equals equals swipe. there we are. >> tomas reimers: andthen the last question we want to see is gesture dotstate equal equal stop, right? so that's when thegesture's been stopped. i actually think for swipe, iknow this off the top of my head, but you're welcome tolook it up, when you

swipe every time it registers ituntil you stop is a start gesture. and then the last one'sjust a stop gesture. so there will only be one stopgesture, which is great for us. so what we can do is say if gesture dottype equal equal swipe and gesture dot status equal equalstop, then let's sanity check here console dot log gesture. >> so we'll go back here. we'll refresh the page. and now the only time something shouldbe console dot logged is when we swipe.

and we try to swipe and we see nothing. so this is actually a big issue. we're not seeing what we expected to. and debugging can be a big part of this. so the first thing we're goingto say is, ok, let's console dot log it if gesture dottype equal equal swipe. armaghan behlum: yeah, let's do that. tomas reimers: so we'regoing to go back to this. we'll refresh.

we'll swipe. and we're going to see a bunch of them. ok. so clearly the problem waswith our gesture dot status. so if we open up one of these we'lllook in the objects and we'll see, well, it's a stop, but, oh,it's called state, not status. so if we head back toour code we can say if gesture dot type equal equal swipeand gesture dot state equal equal stop, then we'll console dot log it.

and so refresh. we swipe. and we'll see that onevery swipe, we're only getting one, which is theend, which is great, right? that's what we want. >> armaghan behlum: yep. and we can also notice that the ids foreach of these gestures are separate. so as tomas was saying because we'recatching this one stop state that exists at the end of a swipe, we'regetting individual separate gestures

from leap motion. great. >> tomas reimers: let's go ahead andjust do the final thing, which is, >> armaghan behlum: goodbye. >> tomas reimers: awesome. and now let's check out our website. one >> armaghan behlum: second. we did, yeah, we did call it goodbye.

>> tomas reimers: no, goodbyeis a real function. let's do that. >> tomas reimers: and when wewave goodbye, it says goodbye. >> armaghan behlum: we have victory. >> tomas reimers: so pretty exciting stuff. hopefully you can build somethingelse, but you get the idea of, right? you can detect gestures. you can call functions. and from that that really gives yousome very fundamental building blocks

to say, oh, maybe when they swipe up,because you can also detect things like direction. i want them to do something. or when they swipe right, iwant them to do something. and we can start to getcreative with how exactly we're going to improve our websiteusing these swipe gestures or circle gestures, or tap gestures,either key taps or screen taps. and then other than that you'remore than welcome to play with the actual data,but if you want to do

that we would suggest you go to the docsbecause they're actually really good. so headed to the docs now. or do you want to talk about that? also one other tidbit of advice,do try and think of this in 3d. so actually let's pull up those gesturesone more time console dot log gesture and we do that. come back in and now let's try acouple of these, couple of those. >> if we go in and check outthese gestures as well as you can see thatthey're dimensionality

is in three directions, actually. so don't just limityourself to a 2d screen even though you mightbe on a 2d website. you can try and think how a usermight interact with the website in 3d. tomas reimers: in a 3d space. and yeah. so you get directions, velocities,all these cool bits of information. >> tomas reimers: and if you're notfamiliar with that, it goes x, y, and then z is this last dimension.

just something which you probably arefamiliar with if you've dealt with 3d coordinate planes before. if you haven't, it's the same as a 2done except there's a third dimension. we call it z. and everything, sort of likedirection, which is where it's going, position-- i think it might evenexpose acceleration, i'm not sure. >> armaghan behlum: yeah, i believe. it definitely has speed. i'm actually not 100%sure about acceleration.

>> tomas reimers: it may be an optionyou can pass on to something. so position and speed are exposedin these sort of three coordinates. so x, y, z or delta x, delta y, delta z. so now headed to the documentationit's developer.leapmotion.com and then you can click documentation. again, leap motion has all thesewonderful apis, one for javascript, one for c sharp and unity, one forc++, one for java, one for python, and one for objective c. i personallywould push you towards javascript or if you want to learn anew language, try python.

both of those languages i've worked withbefore and they're really easy to learn and you already know javascript, whichmakes it a really good contender. >> one word of cautionwhen you enter the docs. make sure you're on docs v2.0. because if you're onversion one, it won't work. also for the example gallery. we spent a good 30 minutestrying the debug our leap before we realized thatv1 doesn't work with v2. so just make sure you're on version two.

and then i'll let himshow your the docs. so here's the api overview and thensome bits and pieces of the information that we've already told you. nice little floatinghands above a leap motion. and a reminder to thinkabout space in 3d. one of the first objects to think aboutwith leap motion are hands, of course. we saw those recognizedby the visualizer. and then you might haveseen that it recognized part of the wrist and thearm associated with it.

tomas reimers: if you wantto pull up the visualizer. armaghan behlum: yeah,let's do that again. tomas reimers: you can see, alwaysjust a good reminder to sort of see, the visualizer tries to showall the data that leap sees. so you'll see that we havethese sort of four points by the wrist and then the actual wrist. and you also have this ball at the palm. all of these are pointsrecognize recognized by the leap. >> armaghan behlum: exactly.

and so with that hand objecteach frame has a hand array as well where you can also getthe left and the right hands. you can get whichdirection the hands are facing with the normaldirection of the palm, or as they call it the palm normal. what else do we have? we also, oops. let's try and scroll down this way. the arms, the fingers arerepresented by the finger

class, which is a pointable object. so like we were saying, we saw thatarray of pointables for each hand. those are the littlefingers to think about. so this is a good overview to gothrough to try and understand. tomas reimers: [inaudible]hand anatomy up there. armaghan behlum: yeah, exactly. there's a lot of raw data that theleap motion takes in interprets well for you, so it's a greatidea to go through here and try and figure out how leap hasalready figured things out for you

and so what information youhave available from there. and then from there i would recommendgoing into this left section over here, which goes, well actually no, those areactually just more api stuff about-- >> tomas reimers: the api reference at thebottom is usually a good place to go. you guys probably saw this whenwe did the google maps pset. but the reference reallyjust goes through all of the functions and parametersavailable in the object to you. for example, this is whati was looking for before. when we have a hand wecan go and figure out

how leap recommendsto us to find a hand. like i said earlier,we have a hands array. find out if we have hands andthen try and grab a single hand to interact with in that way. so that's what werecommend for you guys. the gestures and stuff as well. this api documentation is going tobe a fantastic tool for you guys. do you have any other recommendations? >> tomas reimers: i don't.

i think that's good for now. >> armaghan behlum: yeah,i think so as well. feel free to email us and getin touch about leap motion if you're having maybe any issuesor need any recommendations. and we can try and figure stuffout with you guys as well. thank you. >> tomas reimers: great.

Futuristic Magazine Design


and over the past decade of watchedamerican troops operate on the front lines of war in iraq and afghanistanboth of the us marine or later as a journalist during that time two things have struckme first american to develop the low tolerance for seeing their soldiersreturned home and coffins and second soldiers are surrounded by anoverwhelming amount of new technology it's now part of their everyday livesthese two trends are shifting the way the us fighting force the pentagon is currently building anarmy of what it calls unmanned systems

is sir fastest growing army developmentand there's momentum to create machines with more autonomous capabilities robotswhich can take certain decisions themselves but with this new era ofwarfare look like and do the legal and political structures exist to deal withit these are big big meta meta changes thatare happening at war that we've gotta wrap our heads around so i see this is avery major threat to respect for human rights but it's more going to look likewhen it's robot versus robot who wins that war and and how can you even tell this is the largest gathering ofrobotics companies in the world it's

organized by auvsi the association ofunmanned vehicle systems international so these are successfully used inoperation reactors hundreds of private corporations and university researchersare here to show off their latest cutting-edge inventions and so there'sthings that we can actually pick up with the gripper use them to defuse a bomband then we'll come back they're all either selling their products forsoliciting funds for their projects and most of them are targeting a singlecustomer with deep pockets the us military this is an annual conference with therobotics industry in washington dc the

years ago this is a pretty smallgathering this year they'll be over seven thousand attendees it's anenormous business here now it covers everything be surprised whatyou can find everything from unmanned boats ships submarines to armed dronehelicopters and just air portion of the robotics or unmanned industries thisyear will be worth seven billion dollars in 2009 the us defense departmentearmark 18 billion dollars over five years for the development of unmannedsystems this boom in military robotics comes off the back of the so-calledglobal war on terror the wars in iraq and afghanistan along with lethal actionin pakistan libya have created a

political strategic space for unmannedrobotics systems it's not a situation where you're inthese big information operations of fights you're dealing with with veryexplosive very spontaneous events so you need something that's watching all thetime and something that's very adaptable to be able to move it from one locationto another very very quickly the us air force is presently training moreunmanned systems operators than its training man fighter plane and manbomber plane pilots put together but that actually makes perfect sensebecause they're actually buying more unmanned systems then they're buying manfighter planes or man bomber planes the

number of drones in use by the usmilitary has searched from a handful of 2001 to over 7,000 today and the numberof ground robots shot from 0 to 12,000 when you start to take a look the amount of robot research funded bythe us military is astonishing fault lines put in more than 100 requests andfollow-ups to the pentagon military contractors private robotics companiesand university research labs beginning access to see how these tax dollars areput into use is it easy we could actually get a response is almost alwaysa firm no after several months of chasing only a handful agreed to allowus to build our deck was one of them

it sits on a base just outside detroitmichigan just want to try it out drive careful that's it an army researchfacility from world war two it used to build tanks that now muchother work is dedicated to robotic technology we're looking at here at ourdeck is unstructured environment so robots that can move out of out of rodthe area of very strict programming so one of the ways of doing that is throughteleoperation so we have no it's not the classic robot it somebody actuallycontrolling something is that a remote control car because doing through tv setall the robots here are collaborations between tardec and private companies oruniversity labs for both companies like

i robot in bedford massachusetts this isthe home of the packbot one of the first ground base robots the us militaryadopted after 911 thousands are being used in iraq andafghanistan to diffuse improvised explosive devices or ieds the old way ofdoing business was to ask individual our sons our daughters our brothers oursisters to mount up one of those heavy cumbersome hot bomb suits and literallythe waddle health to go face-to-face with an iep today we do that a distanceand we do it virtually the robot much much better way to do business so thisthing about this was like it weighs about 25 pounds or so and just what themilitary warning

robot that you could throw the overallwall or something and look it writes itself and now you can see over the ballwith the camera with video game-like controllers soldiers can guide reconrobots like this one to see over walls or defuse bombs these ground-basedrobots at a buffer between the soldiers that use them in a potential threatwhether it's a bomb or human enemy but technology designed to save lives can beeasily modified to kill the step between putting a laser beam on someone'sforehead it's not a technologically to thenputting a bullet in their forehead it's actually a legal political questionwe feel strongly and ethically that

there has to be a man in the loop if youlook at the history of you have any military technology it typically startsin reconnaissance then becomes frustrated that you see bad happeningbut can't deal with them and involves two strike really the technology willhappen it's how we're going to deal with thattechnology well the idea of arming ground robotsstill seems taboo in the air it's a line that has long been crossed at a utah army testing facility themilitary has invited members of the media to a display of its unmannedaerial systems

i'm gonna showcase an entire package foryou here today in a way that i think it's not really resonate with you onceyou see what's inside behind that hard it's the largest drone demonstration theus defense department has ever allowed to be filmed as the drones fly overheadjournalist watch the mock operation from inside a hangar from 7,000 meters in theair to graeagle plus its target may die on that struggle it's estimated that thepentagon will invest nearly 37 billion dollars toward drone development through2020 advancing unmanned systems more than piloted aircraft and i think it'sfundamentally change water i think it's fundamentally change weoperate they eventually is going to

fundamentally change the way we live inthe united states and now we have a technology that allows you to carry outacts of force without having to think about some of the consequences thepolitical consequences of sending sons or daughters into harm's way so in mymind the barriers to war in our society they were already being lowered now wehave a technology that literally takes those barriers to the ground 1700 whichmake it such an attractive tool for the us but drones are some of the mostcontroversial weapons in the american arsenal particularly in their use for targetedkillings a phrase first term under the

bush administration so-called war onterror to use lethal force against specific individuals it means killingpeople often outside official war zones the program has been ramped up under theobama administration in places where they would be very serious geopoliticalramifications and the gratification of american lives being placed on theground even those dangerous situations the drone appears like a silver bullet pakistan has borne the brunt of thesilver bullet and it's all secret the cia not the military runs the pakistanidrone program the cia is not required to offer any information about itsoperations how it flexes targets who's

in charge and how many people are killedand the obama administration will not officially discuss the cia drone programnot even to confirm or deny its existence if they can't even say theword where's the accountability how could we even know how well thisprogram is working even if you want to put inside the questions about whetherwe should be using drones as instruments of war there's just so littletransparency and so much opacity when it comes to this program where it belongsto the cia that some people now think if it belonged to the military you could atleast get more insight into how it works and then debate about whether it shouldbe run this way

reportedly civilians and privatecontractors control the cia drones pushing a button from their officesthousands of miles away in langley virginia at the time this film was madethere have been 308 drone strikes reported in pakistan since 2004 256 ofthose under president obama that figure could be far higher over 200 strikes hitthe region of 10 standalone roughly one attack every four days conservativeestimates but the total number of deaths around 2900 of those over 750 werecivilians including a hundred seventy five children and at least 1,100 peoplehave been injured the cia and the obama administration and extended thesestrikes to yemen and somalia and

according to recent us diplomatic cablesreleased by wikileaks the united states building secret drone bases in placeslike ethiopia in the seychelles an indication that washington was toincrease surveillance and strikes in the region at least a dozen strikes havebeen carried out in yemen one of which in late-september killed anwar al-awlakian american morning mob with alleged ties to al-qaeda the willingness totarget and kill a us citizen provides just one example of how this secret waroften operates beyond recognize legal boundaries if a intelligence operationcarries out an air strike that goes arrived it accidentally kill civiliansthat violates the rules of engagement

there's not a court-martial process isthat up there is in my view at the end of the no accountability for what isgoing on now philip austin's been six years studying the legality of the usdrone program for the united nations human rights council the congressionalcommittees have as far as anyone knows never exercised oversight in anyspecific way in relation to these killings he says that the american governmentsjustification for the strikes self-defense a response to 911 even now10 years later as a manipulation of the internationallaws governing conflict now in terms of

international law that represents afundamental breakdown in what are called the rules on the use of force it wouldenable the united states to use force against any target any country any timefollowing 911 congress passed a resolution called the authorization foruse of military force or aumf it allows the us president to use military forceanywhere against people believed to be responsible for 911 and when the obamaadministration has been asked what authorities do you possess to go youknow into yemen to go into somalia even you know outside afghanistan intopakistan for the purposes of attacking people that you say are aligned withal-qaeda they use the aumf i think the

u.s. is certainly risking setting itselfup for a significant global backlash against its extension of powerextraterritorial e but the bigger problem across his other states sayingwell this is the norm you do it why shouldn't we do it the un human rightscouncil has taken no action to further investigate the legality of the us droneprogram whether us continues to expand the program 45 other nations are workingon their own drones many being sold on the open market and the rush to turn outrobotic military systems who buys these technologies and how they are used asminimal international oversight in short the law is not keeping up withthe pace of development you know

technology doesn't stop and that's ithink one thing that people need to realize is that is acceleratingever-faster not just in the number that were using it but how advanced is weaccelerated pace of development is such that it is inevitable that we arecreating machines that are going to be able to do things we cannot currentlyconceive of them doing i think it's the united states wereserious part of this major program to if you want to create a word to robot eyesit's war making functions would be to build in various safeguards designed toensure respect for the laws of war there has been a mad dash for advancement withvery little consideration for how that

advancement will play out against humansociety and reject king is a futurist who studies the potential dangers thattechnological advances in robotics and artificial intelligence complaint withinthe united states you have the military and then you have you know privatebusiness and you have universities so all these different groups are doingtheir own research and their own creations at different paces andeventually there will be more of a coming together of these differentaspects of the programming and the creations and we will cross the line in a university lab at virginia techprofessor dennis hogging the students

work on a robotic soccer team the realthing is if you want to use these robots outside a lot and you life doing yourwork then without all the skills needed to playing soccer and what happened soactually it's a really good controlled a competition but i can develop all thetechnologies needed for robust to be used in real life virginia tech's funding comes from avariety of sources these robots are part of a project sponsored by the nationalscience foundation but they also take on projects financed by the us military soas a research lab the technology we do do we want the society to be using ourtechnology of course many of our

robotics projects most of them not allof them are two really to help the society but here they recognize thetechnologies ultimate use is unpredictable time to time as a group wesit down and discuss about these kind of problems mainly it's very sensitiveespecially for we work on military funded projects that those kind ofthings but many times we don't have any control once it leaves our hand howeverthat's true for any technologies nescience besides robotics as well it'shard to put a timeline on how fast robots and artificial intelligence willdevelop but almost everyone we spoke to seem to believe that in just a fewdecades the robots that will exist in

our world will be unrecognizable bytoday's standards i think the probability is virtually one certainty that machine's will be as intelligent aspeople that we will have intelligent robots robots will be vic was so thenthe consensus of people in the industry is somewhere around 2025 20-30 you knowand even if you would say that's optimistic so maybe it's 2050 you knowmaybe some of us won't be around to see it perhaps but it's not that far in thefuture it's not a thousand years inside 500 years it's certainly not never

when people say machines will never beas smart as people never is a very long time the robots that we create could ofcourse eventually will become much smarter than we are and because they'resmarter than us we won't be able to conceive of how smart they are and we'llhave no control over that and i don't think our brains are really equipped toaccept the enormity of what that means because we do find ourselves intelligentnow science fiction stories always made predictions about conflict betweenmachines and people the way to avoid that is for humans to always be at leastas intelligent as their machines while

we may not know exactly if for windrobots will become as intelligent as humans technology at auvsi the talk ofautonomy like military robots taking more decisions by themselves is growingtechniques you know work on the next generation of autonomy maybe before it'sreally needed to show where it can go generates talking about unfair advantageand i'm in full agreement with him we want unfair advantage we want lots ofunfair advantage why shouldn't we and unmanned systems and especiallyweaponized unmanned systems clearly provide a huge advantage so how far will robot autonomy go itwill robot ever be allowed to make the

ultimate decision to take a human lifeofficially the us military claims there will always be a man in the loop thathuman will always make the decision to kill but there are signs that this maynot always be the case in 2006 the army funded a major study to find out iflethal autonomous robots could be programmed to act ethically on thebattlefield there's a long and rich history of warcrimes in every war we try and train our soldiers and soldiers are instructed inthis but we are human beings and there is emotions there's anger fearfrustration we don't have to put those in autonomous systems we can engineerout the emotions that get in the way ron

arkham a professor at georgia techworked on this study and argues that robots can be more ethical than humansoldiers even in decisions to kill by programming and what he calls foundmorality as you establish a venue a region or a task environment or amission under which the system is operating and you engineer that systemto make sure that it acts appropriately under those particular circumstanceswhether it makes that decision what to fire at a window fire and who to firethat i think is a critical decision that we that we already sort of ritualizedwithin the military decision process and we shouldn't relinquish that there'sreasons to deny people their right to

life self-defense intervening on behalfof another to defend their life but um those are decisions that german agentsand moral agent should be making and not automatic processes i will never evermake the claim that these systems will be perfect but i do make the claim thati do i do may i have the belief that these systems can outperform humanbeings in the battlefield ultimately from an ethical perspective we do have amoral responsibility to try to prevent scented to not invest our time andenergy and resources scientists as a society into building a technology thathas that kind of capacity to kill people on its own but for now there are nosigns that research like this will stop

because there's an assumption thatunderlies not only our kids work but also the billion spent on defenseassumption that war will always continue was a very cultural thing some kind ofthe social deliberations sort of moral deliberation our cultural deliberationif you will like how do we want to fight wars what is it to be a warrior in thesociety and what is this society decide that war is about and it's good for inthe past battles had formal boundaries and ends where each side had to burytheir own but it's more robots go to war on behalf of humans mistake to societyhold its killing becomes more automated does it make war all too easy

i think that is a big issue as far aswhat these technologies are going to do and making more much easier to becomeinvolved and really detaching especially the united states of american publicfrom its sense of responsibility and and moral and social deliberation thatshould go into deciding when wars occur a lot of people say well why don't westop working on this technology there's a problem you'd have to stop science it means you also have to first stop warand stop capitalism and there's such a vast amount of money that goes intothinking about defense problems and

solving defense problems that if we turnthat time and energy and resources into solving more practical problems we wouldactually probably alleviate most of the social and political problems thatcaused us to to have defense and security concerns and the fact of the matter is that mostof the funding that's going into robot research of course is to create a betterwar machine and to what end it demonstrates how far we are from thesort of intelligence we need to build robots that can help

Futuristic Design Of Computer


>> tomas reimers: cool. so hi, everyone. my name's tomas. i'm a tf and this is armaghan behlum: armi. nice to see you guys. tomas reimers: cool. so we're going to be talkingabout leap motion today. so leap motion is areally cool product that

lets you interact with acomputer in a different way. so the whole idea behindleap motion is that you can use your hands tointeract with the computer. so right here i have something set up. i'll talk about it in a bit. but the basic version is you cansee that i have my hands in front of my computer and when i move them,you get the analog on the computer and you can analyze this. you can make gestures.

you can use your hands tointeract with the computer in new and interesting way. >> well, i actually firstwant to pass off to armi to show you some cool demos of whatsome people have done with this. and then we'll talk about howyou actually code with this. armaghan behlum: yeah. hello. so as we saw, littledata here, but let's see what some people have done with this.

so let me just open up this example. and then, so, for example, you can seemy hand analog there, but now this time some people using unity havedecided to put a little more skin and stuff around the hand. so i can, let's go with this one,sure, have my hands interacting. and you can probably imagine acouple of other cool useful things that you can do with this. so this is at least one example. and then let's jump out of this.

>> and then another cool oneis, let's go with this one. plasmo ball. again, we wouldn't necessarilyexpect this level of complexity from a final project for cs50. this is just to show yousome of the, give you guys a little inspiration for whatyou guys can do with leap motion. so for example here's a coolphysics example, which there we go. has both of my hands so now youhave this little plasma ball. and the ball is reacting to the physicsof me moving my hand around the ball.

now this is all though using unity,using kind of tools and frameworks that we haven't taughtyou guys in class, but as you can see some prettycool run throughs with that. >> but one thing that you guys can dostarting off right now with leap motion is work in javascript. leap motion has a javascript api thatyou guys can use and we highly, highly recommend that you guys buildyour projects using that. so with that, let mepass it back off to tomas to talk about leapmotion and javascript.

or do you want to showthem the visualizer first? >> armaghan behlum: oh yes. yes. let's talk more about that visualizer. >> tomas reimers: so on a most basiclevel, when you first get to leap motion you're going to have this box. here, want me to take control? >> armaghan behlum: yeah, go for it. >> tomas reimers: so when youfirst get to leap motion

it has a device whichlooks something like this. you plug it into your computer,install the necessary drivers, and then it will basically be set up. so the easiest way to sortof deal with leap motion is open up this program it installscalled the leap motion visualizer. and the visualizer is literallywhat i'm showing here. it allows you to see theskeletal outline of your hands. and what the leap motionis interpreting them as. so the leap motion uses the camerato sort of look at your hands

and then it tries to guess what thebasic skeletal composition that you see on the screen is. and that's what it shows you. armaghan behlum: everysingle little point and thing that you see there isdata that's available to you guys as well to use. so you see that it'scapturing that tomas has five fingers, each ofthose different fingers are also available for you as datapoints to use in whatever application

that you might want. if you want to see ifsomebody's doing a thumbs up you can see if their fingersare curled and whether they're thumb finger is pointingupwards, or where their wrist or palm isand that type of stuff. so you can see some gestures itunderstands better than others. remember, that it is looking at yourhand from at a camera from the bottom, so when you have your hands likethis it understands them fully, but once you start to try and do athumbs up, sometimes it reads it,

sometimes it can guess, but honestlythe camera just can't see the thumb. so it's not reallysure what's happening. just some limitations to keep in mindwhen you're developing with this. >> anyway, so going back to this. the visualizer actuallyhas a lot of useful tools. so the leap motion isprogrammed in such a way that they don't expect you tointeract with that image data. they don't reallyexpect you to understand what's happening behind the scenes.

what they do is exposea bunch of apis for you such that you caninteract with this data directly without understandingwhat's going on under the hood. >> so if we hit h here in the visualizeryou'll see a lot of options. the important one here thoughis if you hit o and then hit h, you'll see that itlets you draw gestures. so a gesture, you'll seeit draws an arrow across. a gesture is one of the ways which leapmotion sort of lets you get at the data without having to process it.

so rather than me needing to figureout, oh, the hand was moving, even if i have point access, theapi will sort of just tell me, hey, they made this gesture. so you can make basic arrow gestures. you can make circle gestures. you can make tapping gestures. and you can make key press gestures. yeah. and that kind of stuff.

so now that we've sort ofseen what leap motion can do, you can see it can read awhole bunch of gestures. i think i'm going topass it back to armi and he's going to talk about howyou get at these with javascript, how you even begin a project with this. and then we'll talk about somecool places you can go with that. sounds good. so yeah, the very first thing wewill want you to do of course, is after you get the leap motion is togo to leapmotion.com, set up, install

the drivers and stuff. after doing that you can gomake sure that it's connected. if you see in your little tray theleap motion icon and it's green, then you know you're all set. and of course check out exactly whattomas just showed you with the gestures and doing the screen taps, andkey taps, and that type of stuff. >> after that though we,once again, like i said, we have access to all of thesethings in javascript as well. the ideal set up thatwe would recommend you

guys is to go into yourvhost directory, local host, public in your cs50 appliance. and when you go there what you'llsee is a index dot html file. now that index dothtml file or index dot php file, whichever isfine, what you can then do is go to your main operating system. and if you go to the ip addressthat's listed in the bottom right corner of your appliance right here,as you can see, then what happens is you go to the page that'sreferenced by that index dot html file.

so all the code that you might put inthere gets sent and is usable here. >> tomas reimers: so it's alsoimportant just for reference that if you guys actually knowhow to set up a server yourself, or you want to put this on the worldwideweb, you're welcome to do whatever. remember that these arejust javascript files and all the leap processingis done on the client. so it doesn't really matterwhere your server lives so long as the computeryou're viewing the website on has leap motion installed.

armaghan behlum: absolutely. like tomas said, yeah,whatever works for you guys. this is just one of our recommendations. now to start using leapmotion what you would do is you would import thejavascript file from leap motion. and then from there whatyou can do is, right now i just have this paragraphtag set up with an id of text. things that we would recommendare setting controller options for leap motion with theenable gestures to be true.

so by default thosegestures that we showed you guys, the circle, and thekey tap, and the swipes, those aren't shown toyou guys by default. but we highly recommend using thoseso you're not reinventing the wheel. enable those to true, passing thosecontroller options to leap dot loop and you're all set to go. because then you just havedefined a anonymous function that will take in aframe from leap motion and that frame has all theinformation that you're going to need.

>> tomas reimers: so just torecap, you have one object. you have this functioncalled leap dot loop. and you call it with two arguments. you call it with one,the controller options. and there are a lot ofoptions you can put in there. the one we're going toemphasize is enable gestures. and if you set it equal to true thenyou can get access at this gestures that we showed you in the visualizer. >> and then the second argument is afunction, it's kind of like a call back

which will be called everytime every frame of leap, so every time leap registers thatyour hand move, it has a new frame. and it calls this function with oneargument, which is the frame object. and that frame object describesthe frame as leap sees it. armaghan behlum: exactly. so this contains all the usefulbits and pieces of information that we were talking about earlier. checking frame dot gesturesis a array of gestures that the leap motion caught yourhands doing in the last frame.

so for example, what we'redoing here is we're checking, hey, leap, in that last frame didyou catch any gestures that i did? and if so what we decide to dois iterate through those gestures and try and get some usefulinformation from them. each gesture has a uniqueid associated with it. they have types. you can look at which fingerswere involved in the gestures by checking out this pointable stuff. so if when you go through theleap motion javascript api stuff,

when they mention pointables,they're talking about these fingers. and then hands are, of course,the entire hand object. >> what else? you can check how longthe motion went on for and, yeah, all those useful things. so what i'm doing right nowhere is i logged the frame, and then i update my html to displayall of these bits of information from the frame. so let's check that out.

>> so here it is. here's the index dot html file. and as you just saw when i just movedmy hand leap caught a circle motion. so you can see me doing a circle overhere, updates with circle information. doing swipes, catches swipes. let's try a screen tab. there we go. screen tap and a key tap. so key taps also, by theway, are when you hit down.

so you can imaginemaybe playing a piano. >> and then screen taps arewhen you hit the screen. so you can imagine maybe you actuallyhave a touch screen in front of you and you're hitting the touchscreen in front of you. and then we can grab oneof these objects in here. so remember i said that i waspassing the frame into console log. and so we can check out all thebits and pieces of information that are available inthat frame as well to use. >> like i said earlier,pointables are the fingers.

at that moment we didn't have ourhands in front of the leap motion so it registered zero,but this is how you would start to find out maybehow many fingers are the screen. and that type of information. tomas reimers: and rememberingthis is just an object. so everything can be accessedsort of like a struct in c. you have the objectname dot the property name. and then within that you havearrays and you have other objects, but remember it's just an object.

there's nothing specialbecause we're using leap. cool. should we check out a coupleof javascript examples? >> tomas reimers: soquickly remember that we said that leap can actuallyrun on any website. leapjs is just served to a client. and so along as the client hasleap motion attached it will work. so leap motion has awebsite where people can share their examplesof things they've made.

so we're just going to gothrough a couple of them to see what's possible beforediving into more specifics about how it's possible. so armaghan behlum: let's see. tomas reimers: now it should be working. armaghan behlum: so nowbefore we saw an example using unity that rendered our handswith pretty impressive graphic skins, but now you can see you can do thesame thing inside a web browser.

this is all inside chromejust using javascript. and then the other nicething is if you want to know how they did this,the examples on javascript also include code options thatyou can check out and then see how this person was grabbinghands and codes and such. >> so that's all you can findat developer.leapmotion.com. you can go and check out javascriptexamples that they have there. so yeah. here are these, oops sorry.

let's try that again. oh. i have two right hands. >> tomas reimers: so and again,remember sometimes leap messes up. just give it a second. it's not perfect, but it's pretty good. armaghan behlum: oneother recommendation also is to not do it in direct sunlight. so the way leap motionworks is, actually

if i show the camera thisas well, infrared light. so it sends those out and thenreads them when they come back. so if you're trying todo it direct sunlight, for example, it's probablynot going to work, or it's going to requiresome calibration to do so. >> also another recommendation is toclear the space behind the leap and in front of leap. think of it as workinginside of a dome that's surrounding this leap motion object.

if there's stuff rightbehind it as well, that's also going to interferewith how the leap motion's trying to recognize your handand that type of stuff. >> so, for example, i think in thiscase it's my laptop actually that's kind of making the leap motion. yeah, there we go. so if i clear out my laptop frombehind it the hand show up pretty well. there's that. so what else did we show them.

tomas reimers: i thinknow would be the time to sort of dive into and let's justmake a demo totally from scratch. it's going to be really simple. basically what we're goingto try to do is make it so that when you swipe your hand, thebackground's going to start out as red, and when you swipe your hand, thebackground's going to turn green. ok? really simple. and it's basically justgoing to go through a lot

of the concepts behindleap so that we can get into this ideology of how leap worksand how we can build stuff with that. and then from there we'llprobably just show you the api docs and where youcan read more about this. and then we'll call it day. so do you want to code ordo you want me to code? well, i guess we can worktogether on this and try >> tomas reimers: so we'lldo some pair coding. armaghan behlum: there we go.

that's exactly what iwanted to check out. so for example in here, let's see. while we are iteratingthrough the gestures already, tomas reimers: want to makejust a completely new file? armaghan behlum: completely new file? yeah, sure. >> tomas reimers: yeah. >> armaghan behlum: so let's do that. >> tomas reimers: so we're goingto make a completely file.

we'll call it hand dot html. that's cool with me. so remember you do an html tag,then within that you have a head. that head has a title within it. so tab the other way. there you go. title, we'll call it leap example. yep. >> armaghan behlum: oops.

title. >> tomas reimers: yep. >> armaghan behlum: there we are. >> tomas reimers: andthen let's make a body. >> armaghan behlum: wait, let'salso make sure to import. tomas reimers: oh, of course. my bad. so always make sure you have the leapscript so that's a script given to you by leap motion which basicallyallows the web browser to connect

to the device on the user's computer. and then in this we alsoneed a body and let's just make the body say hi sothat we can show students how to connect to this newweb page that they made. armaghan behlum: sure. so let's just put another-- >> tomas reimers: hi, hello world. so a very basic example. really just a demo.

>> armaghan behlum: and then in here wecan go to, we called it hand dot html, right? and oh! so i wonder what's wrongwith this right now. let's add read permissionsto hand dot html. tomas reimers: do you wantto do it in the big terminal so that we can just show it on the-- >> armaghan behlum: yeah, that makes sense. all right.

so i just added thepermissions, but if we were to check out thepermissions before we would have seen that actually handdot html didn't have read permissions and therefore we couldn't render it. but now if we do so, we see ourlittle hello world right there. >> tomas reimers: so let's actually,as he was writing, hello world, i thought about a waywe could change this. let's make it say hello world, andthen when you wave, it says goodbye. right?

so hello, goodbye. >> armaghan behlum: sure. >> tomas reimers: that sounds pretty good. >> armaghan behlum: thatsounds good to me, too. >> tomas reimers: so if we'regoing to do that let's just think through the web page a little bit. we're going to need some scriptwhich basically registers that you waved and to a leap,a wave and a swipe, same thing. so we're going to need a script thatbasically registers for that swipe.

and another thing we'regoing to need is we're going to need someactual content to change. >> so as you remember, jqueryallows you to change content. so one thing we might want to includein this is the jquery library. and then to be able to select whatwe're actually going to change content, that's going to need an idor a class, or something that we can use to select it. so we'll just give it aquick id of change text. and then do you want to grab jquery?

armaghan behlum: so what's the firstthing on our to do list then now? tomas reimers: let's grab jquery? armaghan behlum: let'sgrab jquery, ok, cool. in that case, i'm goingto have to actually-- where would be thebest place to do that? >> tomas reimers: jquery, so if yougoogle jquery, hit jquery, the first armaghan behlum: very first one. tomas reimers: or download. it's fine.

hit download v1 and v2 on the left. so we're describing jquery fromonline like you've probably done. scroll down. up, up. >> armaghan behlum: oh, right here now? tomas reimers: or that. so jquery has a hosted versionwhich means that you don't actually need to download it,but you're more than welcome to download itand host it yourself.

armaghan behlum: cool. so now we have jquery. now what's next on our to do list. tomas reimers: awesome. so next what we needdo is we actually need to give p hello world an idso we can change it, right? so let's give an idea of,i don't know, change text? armaghan behlum: let's justdo it this way, i guess. tomas reimers: changetext, cool.

and now let's just refresh the page. make sure everything works. so back in the browser. always a good reminder thatwhen you're building a website, probably refresh every time you makeany somewhat significant change just because sometimes youaccidentally drop a tag, or you accidentally delete something,and then you break something small, but then when you make a bigger changeyou're like, why did this big change seemingly break the unrelated thing.

so it's always good to sort ofgo and do those sanity checks. >> anyway so now let's doone last sanity check, which is let's try to changetext without leap motion, without anything, juston the page load it'll change hello world togoodbye using jquery. so if you remember jquery exposesthis dollar sign function, which we can pass css selector to,namely hashtag change text, which selects the element withan id of change text. and then we're goingto call the method html

on the object it returns with theargument of a string goodbye, which will change the itemshtml to say goodbye. awesome. that seems pretty cool. and now when we refreshthe page we're going to see it instantly changes to goodbye, right? because it doesn't wait for anything. sort of as soon as that scriptruns it changes it to goodbye. >> so now let's wrap that in a function.

right. so we're going to wantto make a function. we'll call it goodbye. so function goodbye isgoing to take no arguments and it's not reallygoing to return anything. and it's just going todo that in javascript. excellent. so our function goodbye nowchanges the text to goodbye, right? so this gives us a wayto basically change

that text to goodbye wheneverwe called that function. so this is pretty cool. >> armaghan behlum: well, wecan also just make sure that now since we're not calling thefunction, if we refresh the page, notice it's not goingto change the text. >> tomas reimers: excellent. so now we're going to startto get into that leap stuff that we were talking about. so armi, do you want totake it from here or?

>> armaghan behlum: yeah. sure. i'm probably going to needto double check things, but for example rememberwe said we wanted to make sure in optionswe set enable gestures tomas reimers: good catch. armaghan behlum: to be true. and then we were recommendingthat you guys would run leap dot loop, whichas we said earlier,

has two options, a json object thatis the options for how you want to configure the leap motion towork, and then a function that's going to catch a frame as a callbackfunction like tomas was saying. and then edit what you wantto do with that function. >> so we pass in theoption and now we define a function that will take in a frame. and now we have to definewhat that function does. it's also for the sake of thefuture, do that to make sure. tomas reimers: excellent.

so now we have thisleap dot loop function call which basically says watch leapwith these options and every time something changes, call thisfunction frame with all of the data that you are aware of in frame. sounds pretty good. so now quick sanity check,which i always recommend, is in that just putconsole dot log frame. and then in chrome open itup and look at your console and play around with leap to see theframes being logged because that will

get you an idea of whatdata you have access to. and as always if you get confused,look up the api reference. and we'll include the linkfor that at the end of this. >> armaghan behlum: so werefresh the page and then we go and open up the console again. and now we notice that we'rehaving frames passed in, these little objects we saw earlier. these are our framesshowing up in the console. >> so now that we've grabbed theframes, as you might remember earlier

from the example that we had,if we check frame dot gestures we get the list of gestures thatthe frame most recently caught. we can check the length of that arrayto see if leap caught any gestures. so if that array isgreater than zero then we know that we have some stuff to do. >> so let's wrap that up in an if conditionand now in here what we know is we have seen a gesture, let's act on it. so now that we're in here wehave a gesture to check out. tomas reimers: well, the firstthing is it's not just one gesture,

it could be as many gestures. >> armaghan behlum: very true. tomas reimers: so perclassic c style here we'll probably want to use a for loop. armaghan behlum: here we are then. we decided to iteratethrough the gestures. and let's see. i plus, plus. and now if we maybe madejust a var gesture equals

frame dot gesturesbracket i, now we have gesture itself, which is just onesingle instance of a gesture object for us to work withinside of this for loop. tomas reimers: let's sanitycheck here again and just console dot log gesture to see what we get. >> armaghan behlum:console dot log gesture. okie dokie. and refresh one more time. >> tomas reimers: and let'stry making a gesture.

you'll see that a bunchof, when he swipes, you get a bunch of gestures in theconsole and if he tries to do a circle, it's just-- >> armaghan behlum: circlesare just really nice. >> tomas reimers: now there's a weird thinghere, which is he's doing one circle, but this is logging 80 gestures, right? that's a lot of gestures. so the first sort of thing torealize, and this can be confusing, is that a gestureisn't just logged once.

>> on every frame, right,so if i'm doing a circle leap will detect thisis a change, from this is a change, from this is a change. and it will log each one of those. but in each one of those,it's going to say, oh, there's a gesture currently in progress. so let me just say, hey, there's agesture and it's currently in progress. so what we don't want todo is say, oh, on every one of those gestures youwant to change text.

what we want to do is when that gesturestops, and we can check for that, then we want to change text. armaghan behlum: mhmm. so like tomas isexplaining these gestures might appear through multipleframes, but for example, when we were havingthat circle, we can see that the id for that onesingle circle that we might have been trying to completewas the same id throughout. and in fact, you can alsocheck out the status.

updated. >> and then this is probably thelast circle that, oh, well, ok. so sometimes it shows you astatus of stopping a gesture and it also shows you a statusof starting a new gesture when it recognizes for sure thatyou've started a new gesture. for example in this case. armaghan behlum: so yeah. and then, let's see. you can also noticethough we were making

a circle and gesturehas a field called type that tells us what kindof gesture that is. so that might be useful for usyou try and do what we're doing. tomas reimers: sotransitioning back to js, the first thing that occurs to mealso, just reading through this code is there's a small optimization,which is we actually don't need this if condition, right? because if frame dot gestures dotlength is zero, that for loop's not going to run anyway.

so we may as well just goahead and get rid of that. again, while you're writing codeit's important to go back and sort of refactor as you realize that youcould have done something better, or that there is another way to do that. so now we're just going to clean thisup quickly and also clean up your code. that's a big deal. >> armaghan behlum: goodstyle is very appreciated. >> tomas reimers: you canalways tell when someone has code where there used to be an ifcondition and then they removed it,

but they didn't uncomment it. it's very obvious andit kind of looks ugly. armaghan behlum: so what'snext on our to do list? tomas reimers: so now as we were saying,i guess the first thing we want to do is make sure that that gesture'sactually a swipe, right? >> tomas reimers: so if we're saying thatour goodbye is kind of like a swipe, we'll go with it's a swipe, thefirst thing we need to say is, hey, is the gesture type a swipe, right? not a circle or a top,but is it a swipe?

so the way we can do thatis we can say gesture dot type equal equal swipe as a string. >> armaghan behlum: [inaudible] gesturedot type equals equals swipe. there we are. >> tomas reimers: andthen the last question we want to see is gesture dotstate equal equal stop, right? so that's when thegesture's been stopped. i actually think for swipe, iknow this off the top of my head, but you're welcome tolook it up, when you

swipe every time it registers ituntil you stop is a start gesture. and then the last one'sjust a stop gesture. so there will only be one stopgesture, which is great for us. so what we can do is say if gesture dottype equal equal swipe and gesture dot status equal equalstop, then let's sanity check here console dot log gesture. >> so we'll go back here. we'll refresh the page. and now the only time something shouldbe console dot logged is when we swipe.

and we try to swipe and we see nothing. so this is actually a big issue. we're not seeing what we expected to. and debugging can be a big part of this. so the first thing we're goingto say is, ok, let's console dot log it if gesture dottype equal equal swipe. armaghan behlum: yeah, let's do that. tomas reimers: so we'regoing to go back to this. we'll refresh.

we'll swipe. and we're going to see a bunch of them. ok. so clearly the problem waswith our gesture dot status. so if we open up one of these we'lllook in the objects and we'll see, well, it's a stop, but, oh,it's called state, not status. so if we head back toour code we can say if gesture dot type equal equal swipeand gesture dot state equal equal stop, then we'll console dot log it.

and so refresh. we swipe. and we'll see that onevery swipe, we're only getting one, which is theend, which is great, right? that's what we want. >> armaghan behlum: yep. and we can also notice that the ids foreach of these gestures are separate. so as tomas was saying because we'recatching this one stop state that exists at the end of a swipe, we'regetting individual separate gestures

from leap motion. great. >> tomas reimers: let's go ahead andjust do the final thing, which is, >> armaghan behlum: goodbye. >> tomas reimers: awesome. and now let's check out our website. one >> armaghan behlum: second. we did, yeah, we did call it goodbye.

>> tomas reimers: no, goodbyeis a real function. let's do that. >> tomas reimers: and when wewave goodbye, it says goodbye. >> armaghan behlum: we have victory. >> tomas reimers: so pretty exciting stuff. hopefully you can build somethingelse, but you get the idea of, right? you can detect gestures. you can call functions. and from that that really gives yousome very fundamental building blocks

to say, oh, maybe when they swipe up,because you can also detect things like direction. i want them to do something. or when they swipe right, iwant them to do something. and we can start to getcreative with how exactly we're going to improve our websiteusing these swipe gestures or circle gestures, or tap gestures,either key taps or screen taps. and then other than that you'remore than welcome to play with the actual data,but if you want to do

that we would suggest you go to the docsbecause they're actually really good. so headed to the docs now. or do you want to talk about that? also one other tidbit of advice,do try and think of this in 3d. so actually let's pull up those gesturesone more time console dot log gesture and we do that. come back in and now let's try acouple of these, couple of those. >> if we go in and check outthese gestures as well as you can see thatthey're dimensionality

is in three directions, actually. so don't just limityourself to a 2d screen even though you mightbe on a 2d website. you can try and think how a usermight interact with the website in 3d. tomas reimers: in a 3d space. and yeah. so you get directions, velocities,all these cool bits of information. >> tomas reimers: and if you're notfamiliar with that, it goes x, y, and then z is this last dimension.

just something which you probably arefamiliar with if you've dealt with 3d coordinate planes before. if you haven't, it's the same as a 2done except there's a third dimension. we call it z. and everything, sort of likedirection, which is where it's going, position-- i think it might evenexpose acceleration, i'm not sure. >> armaghan behlum: yeah, i believe. it definitely has speed. i'm actually not 100%sure about acceleration.

>> tomas reimers: it may be an optionyou can pass on to something. so position and speed are exposedin these sort of three coordinates. so x, y, z or delta x, delta y, delta z. so now headed to the documentationit's developer.leapmotion.com and then you can click documentation. again, leap motion has all thesewonderful apis, one for javascript, one for c sharp and unity, one forc++, one for java, one for python, and one for objective c. i personallywould push you towards javascript or if you want to learn anew language, try python.

both of those languages i've worked withbefore and they're really easy to learn and you already know javascript, whichmakes it a really good contender. >> one word of cautionwhen you enter the docs. make sure you're on docs v2.0. because if you're onversion one, it won't work. also for the example gallery. we spent a good 30 minutestrying the debug our leap before we realized thatv1 doesn't work with v2. so just make sure you're on version two.

and then i'll let himshow your the docs. so here's the api overview and thensome bits and pieces of the information that we've already told you. nice little floatinghands above a leap motion. and a reminder to thinkabout space in 3d. one of the first objects to think aboutwith leap motion are hands, of course. we saw those recognizedby the visualizer. and then you might haveseen that it recognized part of the wrist and thearm associated with it.

tomas reimers: if you wantto pull up the visualizer. armaghan behlum: yeah,let's do that again. tomas reimers: you can see, alwaysjust a good reminder to sort of see, the visualizer tries to showall the data that leap sees. so you'll see that we havethese sort of four points by the wrist and then the actual wrist. and you also have this ball at the palm. all of these are pointsrecognize recognized by the leap. >> armaghan behlum: exactly.

and so with that hand objecteach frame has a hand array as well where you can also getthe left and the right hands. you can get whichdirection the hands are facing with the normaldirection of the palm, or as they call it the palm normal. what else do we have? we also, oops. let's try and scroll down this way. the arms, the fingers arerepresented by the finger

class, which is a pointable object. so like we were saying, we saw thatarray of pointables for each hand. those are the littlefingers to think about. so this is a good overview to gothrough to try and understand. tomas reimers: [inaudible]hand anatomy up there. armaghan behlum: yeah, exactly. there's a lot of raw data that theleap motion takes in interprets well for you, so it's a greatidea to go through here and try and figure out how leap hasalready figured things out for you

and so what information youhave available from there. and then from there i would recommendgoing into this left section over here, which goes, well actually no, those areactually just more api stuff about-- >> tomas reimers: the api reference at thebottom is usually a good place to go. you guys probably saw this whenwe did the google maps pset. but the reference reallyjust goes through all of the functions and parametersavailable in the object to you. for example, this is whati was looking for before. when we have a hand wecan go and figure out

how leap recommendsto us to find a hand. like i said earlier,we have a hands array. find out if we have hands andthen try and grab a single hand to interact with in that way. so that's what werecommend for you guys. the gestures and stuff as well. this api documentation is going tobe a fantastic tool for you guys. do you have any other recommendations? >> tomas reimers: i don't.

i think that's good for now. >> armaghan behlum: yeah,i think so as well. feel free to email us and getin touch about leap motion if you're having maybe any issuesor need any recommendations. and we can try and figure stuffout with you guys as well. thank you. >> tomas reimers: great.

Back To Top