We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Lightning talk - Programming Mini Drones With JavaScript

00:00

Formal Metadata

Title
Lightning talk - Programming Mini Drones With JavaScript
Title of Series
Number of Parts
133
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
In this talk you will learn how to program popular over-the-counter flying mini drones with JavaScript for fun and profit. Well, mostly for fun, but while having fun you can learn JavaScript, node.js, physical computing, Internet of Things and other stuff that surely can be profitable. Cylon.js is a node.js based JavaScript framework for robtics and physical computing. It supports an extensive range of hardware, from remote controlled toys to IoT devices. Cylon.js is great for abstracting away the annoying aspects of hardware coding, leaving the fun part: seeing your code bridge the gap from the digital to the physical world.
Software developerOffice suiteInformation technology consultingOpen sourceRoboticsSoftware developerInteractive televisionDemo (music)Mobile appJSONXMLUMLComputer animation
Mobile WebMobile appSoftware developerINTEGRALService (economics)Computing platformSoftware developerInteractive televisionMobile appComputer architectureInternet forumMereologyMultiplication signMoment (mathematics)WebsiteNumberPhysical systemVideo gameXML
Software developerMultiplication signCodeForm (programming)Bridging (networking)Software developerRepresentation (politics)PhysicalismVideo gameTelecommunicationWebsiteProjective planeVirtual machineMobile appLogicJava appletOffice suiteComputer animation
Software developerSoftware developerRoboticsGame controllerCrash (computing)Web crawlerClient (computing)Mobile appSmartphoneSpring (hydrology)Control theoryPerfect groupProjective planeShape (magazine)Mixed realityBeat (acoustics)Binary multiplierCodeEndliche ModelltheorieData modelCopyright infringementComputer animation
Software developerEuler anglesFormal languageSoftwareCuboidNP-hardMemory managementPhysical lawLevel (video gaming)Communications protocolScripting languageMereologySoftware developerWeb 2.0Stack (abstract data type)Functional programmingGoodness of fitComputer programmingComputer hardwareObject-oriented programmingSpeech synthesisSoftware frameworkBitFunctional (mathematics)Closed set
Software developerSoftware developerSoftware frameworkEvent horizonProcess (computing)Open sourceScripting languageHypermediaRoboticsGroup actionDressing (medical)Series (mathematics)Drum memoryJava appletProduct (business)CodeNear-ring
Software developerInternet der DingeComputer hardwarePlastikkarteSoftware frameworkKeyboard shortcutHybrid computerRoboticsComputing platformProcess (computing)Template (C++)Group actionPhysical systemNeuroinformatikCurveCloud computingCodeVariety (linguistics)Analytic setInternetworkingOpen sourcePoint cloudComputer simulationNP-hardRow (database)Programmer (hardware)Extreme programmingScripting languageSoftware testingSource codeWhiteboardCellular automatonRule of inferenceGame controllerPrototype
Software developerDemo (music)Demo (music)Multiplication signCrash (computing)
Software developerCodeLine (geometry)AbstractionPersonal area networkKeyboard shortcutGame controllerComputer programmingRoboticsConnected spaceDevice driverEndliche ModelltheorieCondition numberGroup actionCircleComputer animation
Software developerKeyboard shortcutBridging (networking)Rule of inferenceSource code
Software developerDrill commandsRight angleDemo (music)MappingGame controllerSource codeComputer animation
Software developerInclusion mapSource codeComputer animation
Software developerDrill commandsSource codeComputer animation
WindowSoftware developerDrill commandsInclusion mapEndliche ModelltheoriePhysical systemVideoconferencingSystem callMoving averageWeb crawlerYouTubeModule (mathematics)Multiplication signSoftware developerComputer hardwareDemo (music)Source codeComputer animation
Software developerDrill commandsCellular automatonInclusion mapGraph coloringSource codeComputer animation
Software developerSystem callRight angleSource codeComputer animation
Software developerExecution unitoutputSoftware developerSoftware repositoryDemo (music)Moving averageLink (knot theory)Web crawlerHybrid computerModule (mathematics)Group actionInheritance (object-oriented programming)Rule of inferenceComputer animation
Transcript: English(auto-generated)
A quick show of hands. How many people received a drone for Christmas? Or gifted one to their children? Or gifted one to their significant other? Nothing says love like a drone. No? OK.
Have anyone tried programming against a drone or other robotic device? That's a couple of hands. Cool. My name is Anders. I work for the Nordic consultancy company KnowIt at their Oslo office. And I'm here to talk to you about using open source robotics to fly your Christmas drone, so at least mine.
And there will also be a demo. And hopefully, it will be entertaining if I fly or if I crash or burn. OK. At KnowIt and Oslo, we do a lot of software development that has real impact on the world and people around us. For example, we have developed a mobile app
for the public transport company in Oslo that completely changed the way people buy tickets and interact with the transport company. And also, we are responsible for most of the Oslo municipality systems, from the integration platform to online forums for applying for kindergarten. And we have applied developed techniques, microservice
architecture to ensure employees and citizens are constant on hassle-free service. But as a developer, nonetheless, I spend most of my time in the fully digital realm. Sometimes, there are apps or websites or other form of representation on my work.
But most of my work is impossible to explain to my mother. So I spent a couple of years of my life implementing telecom business logic in Java. My mother was not interested. So at my office, we have a designated portion of our paid hours to do a project of our own,
to work and grow and develop as developers. And I've had an immense satisfaction in spending time doing projects where my work has an impact in actual physical things. There might not be an immediate business value to the work, but seeing my code bridge the gap from the digital
to the physical world tickles me in just the right places. That started me at this gig in the beginning. The instant gratification. I write the code, the machine obeys. I write the code, the machine moves. Like it.
So in the past, colleagues have done projects on Arduino, Lego Mindstorm, mind control racetrack cars. Lots of cool stuff. But to me, nothing beats flying robots. As a kid, the people who flew helicopters
and RC model planes, they were the kings. The models were hard to build, hard to fly, and they always crashed spectacularly into a thousand very expensive pieces. But today's plethora of drones in all shapes and sizes, they're quite something else. They are usually multi-copters, onboard controllers, advanced gyros, making them stable
and just perfect for casual play. So one of my favorite toys right now is the pirate rolling spider. It's a quadcopter, and it's pretty stable. Not too expensive. I think it's around 60 pounds in the UK. Perfect size for indoor flying. And most importantly for a developer,
it's controlled by a smartphone app over Bluetooth. So meaning there's some hopefully sane API in there somewhere. And indeed, the code for the smartphone client is open, and pirate publishes an SDK for the firmware, and then publish some documentation,
and even some C code displaying how they work. So this is good news, because speaking of instant gratification, hardware programming can be hard, at least for a developer such as myself. In my toolbox, I have a couple of object-oriented languages, a bit of functional programming, various web technologies,
and a whole heap of already or very soon to be obsolete frameworks. What I don't have deep knowledge of is low-level hardware close programming. Embedded software, networking protocols, Bluetooth stacks, et cetera. But thankfully, Atwood's law applies. Anything that can be written in JavaScript
will be written in JavaScript. And JavaScript is a language that is widely used. Maybe not as widely understood, but it's a part of most developers' toolbox, and basic skills are easily acquired and developed. So there is a vibrant community of open source robotics out there,
and JavaScript is one of their preferred tools. And I think there are two initiatives worth mentioning. One of them is NodeBots. It's originating in the Node.js community, and they've held a worldwide series of meetups and other events teaching developers and hobbyists JavaScript robotics.
People get together, hack, solder, and code JavaScript against their creations. NodeCopter is also a community that have been arranging meetups on JavaScript, coding for the Parrot AR drones, a larger drone, maybe someone who's in it. And if either of these outfits have an event near you,
I suggest you go see them. They're pretty cool. So my favorite tool coming out of this open source robotics community is Silent.js. It's made by the hybrid group out of Pasadena, California, and it's a framework also based on Node.js,
and it does a really great job at abstracting away the annoying aspects of hardware coding. And why should you, as programmers, care about this? Is it all about the instant gratifications, fiddling with toys? Well, it's fun.
There should be plenty. You can show it to your mother. You can learn more JavaScript. You can learn more Node.js. And if all that is not high enough on the Gartner hype curve for you, how about the internet of things? Silent.js is not all about giving commands
and controlling hardware. Data flows also the other way. So it's an excellent platform for getting started with IoT using ready-made sensors or hardware you build yourself. So Silent.js is an extensible system for connecting a very wide variety of drones,
robotic toys, wearables, smart home devices, IoT prototyping and embedded computing modules, and cloud-based analytics and messaging platforms. You see the AR drone, Arduino, the Tesla board, the Sphero,
the Pebble, Philips Hue, the Ali, Leap Motion controller, the Intel Edison, keyboard. If it's not there, you build your own. Silent.js provides templates and tools to make your own Silent.js sub-modules.
And if JavaScript is not your thing, the guys behind Silent.js also made R2, doing just the same in Ruby, and GoBot doing the very same in Go. So if you hate JavaScript, some of you do. No excuse not to get the drones in there.
Okay, it's demo time. I've had some problems last night, of course. No demo is complete without problems. I'm sure you'll be equally happy whether I fly or crash. So I'm just gonna try. Yeah, I'm not quite sure whether NDC has insurance
for you guys, if someone is bested by this.
All right. Okay, here is a short snippet of code in JavaScript.
Silent robot is a collection of connections and devices. And the connection devices are just a layer abstraction above the adapter and the drivers, which is really the meat of the things where you issue commands, receive events,
but everything that's hidden in the Silent sub-modules. So a simple controller program will look just like this. Just a few lines. The first 20 lines is just about hooking everything up together afterwards. It's everything about defining keyboard controls.
Okay. So let's see. I'll think about start with drone wheels off keyboard.
I really would like some debug here. No drone wheels off keyboard. Okay. Ah, I didn't finish.
Okay. Find my drone, trimming. Okay. T for takeoff. Up, up, up. Okay.
Up, up, up. No. Doesn't understand it's been lifting off. Just wait a while. Okay. Now I can turn. Counterclockwise, clockwise. Come on up, fly a bit forward.
Yeah. Tilt right. Tilt left. Okay. I have some tricks. Ooh, flip to the left. Flip to the right. Front flip. Back flip.
Okay. And land. Yeah. Yeah. Thank you. Okay, that went well.
Do you want to see me do the same with the leap control? So this is the demo that didn't work. Spent last night in my hotel bed flying drones. So, yeah. Ooh.
So, we're gonna try like this.
Okay, so I have defined a couple of gestures that maps to commands.
So, clockwise, supposed to be take off. Ah, okay. I think I did some very strange things last night. So, backwards.
Okay, I think I'm gonna do take off first.
No, I'm gonna, sorry. I was gonna demonstrate take off by gesture. Okay, let's try it again. So the counterclockwise is take off. Sorry?
Backward, yeah, sure.
Okay. And counterclockwise, it's gonna land. No. It's not gonna do anything. Okay. And I'm gonna turn. Oh, it's still gonna land again. Let's try again. Sorry. This is not easy. Test-driven hardware development.
It's gonna land every time. Okay, one more. And then we'll call it quits.
No? Okay, sorry. Emergency. Okay, I have one more demo. Have you guys seen the YouTube video with the drones flying in swarm? Do all this crazy shit in 3D. Yeah, this doesn't do that.
I would like them to do. One of the node modules called the Node Rolling Spider JS, which is what the silent module's based on, has a swarm API. These are pretty stupid drones. They don't really know about each other.
So I can't make them aware of where they are. But I can make them fly simultaneously, perhaps.
Can you guys see if they have the same color eyes everywhere? Ready for commands. Okay. So we have one called swarm.
Okay, cover your faces. This doesn't have the leap motion support. So it's just, yeah. Three out of three. Okay, one, two, three, take off. Oh, so beautiful. Turn right.
Up, turn left. Up, up, up, up, up, up, up, up, up, up, up, up, up. You want some tricks? And da, da, da, da, da. Yeah.
Right. Ah, we lost one. So, and we have two more tricks.
Okay. Thank you. Okay, so that's all my demos. Here are some links. There's a GitHub repo. Maybe wait a couple of days for me to do some housekeeping on that.
None of this work is particularly original. I lean on the, oh, sorry, I said wrong. I lean on the Silent Rolling Spider module, which is not by me. I say my same link twice. And also the Node Rolling Spider repo. Also some links to Silent JS, hybrid group.
Parrot has some excellent developers kit. And check out the node bots if they have an event near you. So go try it for yourself. And remember, flying is learning how to throw yourself at the ground and miss.
Thank you.