Archives For JavaScript

What I’m Doing

I initialize my Node.js server, plug my Leap Motion into the computer’s USB port and hold my hand in the air.  I make a gesture that looks like left-clicking on a mouse, but am not actually touching anything.  Suddenly, with a whoosh, the rotors on my drone buzz to life.  This particular model, the AR Drone 2.0, has a quadcopter structure with 4 rotors in a square shape, which gives it enhanced stability.  The drone lifts into the air and hovers there, waiting for me to issue a command.  I move my hand forward and the drone edges away from me.

The further away from center I move my hand, the faster the drone moves until I realize, almost too late, that it is quickly approaching a tree.  I drive my hand down and to the right and the drone dodges to the right and under the looming branches, narrowly escaping disaster.  I point with my finger and make a circle in the air counter-clockwise and the drone rotates so that it is facing me.  Moving my hand forward again, the drone accelerates towards me.  Glancing back at my computer, I can see myself getting closer in the drone’s video camera, which is streaming in my browser.   This is only the beginning of my drone journey.

Why Node opens the door for programming robotics with Javascript

A few years ago, it was virtually impossible to control robots using Javascript alone because it was so slow that any application that required a reasonable response time would not function properly.

With Google’s V8 Javascript Engine, Javascript’s day has arrived.  V8 is written in C++ and compiles down to assembly, so it is very fast.  Recent benchmarks put it ahead of PHP, Ruby, and Python – second only to C itself.  Despite being initially designed to run in Google’s Chrome browser, V8 has since been adopted by several javascript frameworks, including Node.

Node is used to make web applications responsive by quickly pushing javascript from the server to the client.  Node also functions asynchronously so that multiple data streams can be queried simultaneously.  This non-blocking data transmission means that Node is able to process a second and third command without waiting for the first command to succeed.  Another unique feature of Node is that it leverages callbacks (functions that run upon success or failure to receive data) to chain instructions so that you can create a series of commands that will run in order upon completion of the previous command.

The implications for robotics are that multiple commands can either be processed simultaneously or chained to occur in a particular sequence.  Languages like Ruby and Python are not asynchronous and commands block one another, which may result in disaster if a single command gets stuck and takes a long time to process.

Why I used Leap Motion and The Future of Controllers

Leap Motion is the first viable product in a paradigm shift that is changing the way we interact with technology.  For those that don’t know, Leap Motion is a small camera that plugs into a computer’s USB port.  It can detect and track each of your hands and every finger’s movement in the half-dome-shaped space above it.  There are several applications, including playing video games, computer interfacing and, now, flying drones.  I used the javascript framework leap.js to translate hand coordinates into drone commands, then published instructions to my Node server using Faye (a simple publish-subscribe messaging system), and issued movement commands to the drone.

At this point, Leap Motion’s software is in need of an upgrade and isn’t very effective at detecting finger movements if, for instance, you turn your hand to the side.  As a result, I used hand movements for everything except takeoff / landing (done by gesturing with pointer finger as though left-clicking mouse) and rotation (done by making a circle in the air with pointer finger).  I have heard that Leap Motion is upgrading their firmware in the next few weeks and am excited that one of the features is much more precise finger tracking. In the meantime, I am leveraging Leap Motion’s X, Y and Z axes hand position detection to control left/right, up/down and forward/back actions.

Devices for interacting with the world around us are rapidly increasing in effectiveness.  Imagine if you could use something like Leap Motion without being tied to a computer.  In early 2014, Thalmic Labs is releasing the Myo, an arm band that detects electrical activity in muscles associated with finger movements to wirelessly control digital technologies.  In the near future, I may be able to build a pocket-sized autonomous personal drone that follows me down the sidewalk while sending a video feed to my Google Glass, then disengage autopilot and control my drone assistant through hand gestures.  I could also send my drone on missions to pick up a burrito, survey surrounding traffic, mow my lawn, take an aerial picture of me and my buddies, and thousands of other possibilities.

In part 2 of this article, I’ll go through some of the challenges facing the emerging drone industry and why we are on the cusp of a hardware revolution.

To Be Continued…

Hey everyone, check out this chat app I built today using Node.js and Angular.js: Node & Angular Chat App

Node and Angular are both relatively new javascript frameworks that pack a lot of power.  Node is a platform for building really fast network applications that can run on many different devices.  It is great at processing multiple connections without blocking and is one of the most important javascript developments in the last 5 years.  I’ll likely use Node extensively in the future running on Raspberry Pi to build some cool Internet of Things devices.

Angular is a javascript framework, maintained by Google, that can serve as a backbone for single-page web application.  It augments browser-based applications with MVC (model-view-controller) capability and enables rapid prototyping with easy-to-read code.  Angular’s two-way data binding reduces the amount of code that needs to be written and brings templating responsibilities to the client side.  Angular is often compared to Backbone.js, which relies on boilerplate code instead of two way data-binding.

A lot of people have been asking me why I am leaving the venture capital world to begin a difficult and uncertain life as an entrepreneur.  It’s simple – I want to make awesome stuff.  I taught myself the basics of coding and was accepted into Hack Reactor, a coding bootcamp that runs 6 days per week and ~12 hours per day.

There are many reasons that I chose Hack Reactor over other bootcamps and a brief discussion of this topic is available on Quora.  The instructors were senior engineers at companies like Twitter and Google and are focused on teaching emerging web browser languages (javascript, jQuery, node, coffeescript, etc).  Most graduates become software engineers at leading tech companies and they have a near 100% placement rate.  Hack Reactor made headlines recently when a few current students set a world record for an algorithmmic challenge called the N-Queens problem.

I want to point out that Venture Capitalists are an essential component of the startup ecosystem and my departure from VC is due to the fact that I want to be a builder.  Without Venture Capitalists, early stage founders would have a much more difficult time raising funds, exits would be far fewer, and many of the most interesting tech companies would likely never have existed.

Learning To Code

July 15, 2012 — 2 Comments

If you’ve never coded before, have no fear.  While it’s possible to start a tech business without any coding / web development background, putting some effort into learning the basics will pay dividends in getting your engineers to respect and follow you.  One of the easiest ways to get started is to take an online course, such as the one offered by Codecademy.  This will teach you web programming basics such as HTML, JavaScript and CSS to help you build interactive websites.  This is an amazing tool to get you on your feet quickly, especially if you have no programming experience.

Back-end Frameworks: Once you’re done with Codecademy, you’ll have the basics of front-end web development.  At this point you may want to learn a bit about back-end frameworks like Ruby on Rails or Django (Python).  The debate between whether to learn Python or Ruby is a heated one and you really can’t go wrong with either.  There’s a great thread on this topic on Quora.  At this point in your coding career, I would stay away from languages like PHP and Java given the time required to get up to speed and develop anything useful.

If you elect to learn Ruby, TryRuby is a great introduction to the Ruby programming language and can be accessed from your web browser (doesn’t require any installation).  This is pretty lightweight and will give you a sense for how the Ruby language functions.  Once you’ve gotten through TryRuby, you’re likely ready to dive deeper by following a Ruby on Rails tutorial.  Getting the Ruby on Rails framework up-and-running on your computer will be one of your hardest tasks and is easier on a Mac.  A great tutorial is Michael Hartl’s Ruby on Rails Tutorial.  Whenever you get stuck, you’ll be able to find solutions to your problems using Google since Ruby has one of the most active communities of any programming language.

For those that elect to go with Django, many tutorials exist.  Python has been popular for longer than Ruby and, as a result, there is a ton of information out there.  Most of the computer science departments at major universities teach Python, so taking an online class like the one currently being offered by Udacity, is a great option.  There are so many online course options available that I’ll post a separate dedicated thread later.


When you want to begin building mobile applications (i.e. for the iPhone), this is easiest with a Mac and can be done using the iOS development tool Xcode.  There’s a great post on this on Udemy, so I won’t go into it here.  To program a native mobile app (as opposed to a web-based mobile website), you’ll have to dabble in Objective-C (Cocoa) or something similar (like RubyMotion).


If you want to be in the startup world, but think of yourself as a business cofounder, you’ll have to know something about programming to command any respect from your engineers.  You’re unlikely to get much traction with the tech community or in finding a technical cofounder if you have no technical knowledge.  The best way to learn to code is to do some of the tutorials suggested above and then create something for yourself.  It’ll be painful, but building yourself a tool will increase your credibility and give you confidence in your ability to understand the technical side of things.