How To: Install the Leap Motion Driver & SDK outside of Ubuntu/Debian Linux

The Leap Motion Leap sensor forms part of some research I’m working on atm, but the drivers only come as .debs packaged for Ubuntu or other Debian-based distros. As I’m on Arch (and don’t really want to run dpkg alongside pacman), I wanted a way to pull out the files from the .deb bundle and stick them in the right place. Luckily, it’s pretty easy to do – here’s how…

Download and Extraction

So, let’s say you go to https://developer.leapmotion.com/downloads and get yourself a copy of the most recent Linux driver, which at the time of writing is: Leap_Packages_1.0.9+8411_Linux.tgz.

Extracting the archive will give you two files:
Leap-1.0.9+8411-x64.deb, and
Leap-1.0.9+8411-x86.deb.

If you look at either of those two files with Archive Manager you’ll see the file data.tar.gz within ’em. Pick your flavour (32-bit is x86, while 64-bit is x64) and extract it.

Inside the data folder you’ve just extracted you’ll find three directories:
etc,
lib, and
usr.

Scripted Install

In the folder with the above etc, lib and usr folders, create a file (call it anything you like, install-leap.sh for example) and dump the following into it:

Now chmod +x the file so it’s executable and we’re almost ready to go. Unfortunately this doesn’t allow for that easy uninstallation, but you can just manually ‘nix it by throwing the following into another script:

Optional: Reload udev rules

Try skipping this section for now and come back to it if your device doesn’t register, ok?

Apparently udev uses the inotify mechanism so you don’t need this (source: http://unix.stackexchange.com/questions/39370/how-to-reload-udev-rules-without-reboot) but I did this anyway and it worked:

Start the daemon & visualiser

Now that’s all done, you should be able to start the Leap daemon with:

Then plug your leap sensor in and it should work when you run ‘Visualizer’ or such. Cheers!

Leap visualiser on Linux

Update – July 2016

Doing this again today, I needed to move the contents of the /usr/share/Leap folder (i.e. *.ldat) to the /usr/local/sbin folder for leapd to start without errors – also, as mentioned, be sure to run leapd as sudo or it’ll launch (with websocket errors) but it won’t work. Also, I moved the *.so files, “platform” folder and “Playground_Data” folders into /usr/local/bin, which has made that folder a bit of a dog’s breakfast, but it works… Probably a better idea to use “alien” to install the deb, or make a PKGBUILD on arch than this hacky way of cobbling it together.

The Leap motion input device looks incredible

The Leap is a new 3D input motion controller in a similar vein to the Kinect, but with apparently about 200x the resolution – how amazing is that?

To quote the Leap people:

Leap represents an entirely new way to interact with your computers. It’s more accurate than a mouse, as reliable as a keyboard and more sensitive than a touchscreen. For the first time, you can control a computer in three dimensions with your natural hand and finger movements.

I’ve applied for a free dev-kit, so fingers-crossed! Worst case though, the sensor’s only meant to be around the $70 mark when they come out.

Would so love to work with this tech for my Ph.D research… looks like it solves a lot of problems right off the bat. Awesome!

How To: Create a Simple Fireworks Effect in OpenGL and SDL

I’m teaching the programming stream for Diploma in I.T. – Multimedia at the moment, so we’re going to be making some simple games and things over the next couple of months, but to start them off we’re doing a little bit of work on particle effects because they’re simple and fun – you just write a single class which describes the properties and behavior of your particle, and then scale it up by adding a large number of particles to get some pretty nice effects.

So instead of doing a particle fountain, I thought some fireworks might be kinda neat… Take a swiz at the video below and see what you think!

Full C++ source-code available after the break for those of a curious nature =D

Continue reading How To: Create a Simple Fireworks Effect in OpenGL and SDL

ActionScript 3.0 Particle Systems #6: Particle Attraction

More ActionScript… This time we’re attracting the particles towards the mouse cursor when the distance between them is low enough… Looks alright, just a kinda fun effect & dead simple to code.

Source code and flash files on the flipside…

Continue reading ActionScript 3.0 Particle Systems #6: Particle Attraction

ActionScript 3.0 Particle Systems #5: Smoke Effect

I’ve basically spent the day trying to get this one right, and it’s not too bad, although it’s pretty heavy on the CPU. Really, you want about 150 particles and a slower fade out, or 150 particles and add two per frame instead of just one, but on my rig it’s getting jerky with that many particles, so in the animation below we’ve got 80 particles as a compromise =( Also, because we’ve only got 80 particles I’ve deliberately ramped up the alpha decay (i.e. how quickly the particles fade out) and upped the vertical speed to get them off the stage before the particle is forced to vanish by our particle limit. If you put the mouse cursor right down near the bottom of the stage and look at the particles at the top you’ll just catch them vanishing instead of fading out fully, but these are the compromises we make for a smoother framerate ;)

If it’s running poorly on your machine, try right clicking on the stage and lowering the quality, or just grab the files from after the jump and mess around in Flash CS4 (free trials available) with all the different variables (especially the ones that start with min or max!!).

I’ve set the window-mode to use GPU acceleration on this one, so if nothing displays and you’ve got an older graphics card (and you want to see it), just view the source code for this page, grab the object section and change wmode=”gpu” to wmode=”direct”.

Credits: LearnFlash.com’s particle systems vids for the how-to, kaioa.com for the FPSCounter Class, and me for coding it up and running with it!

EnJoY!

Update: I’ve modified the above example to use the RateController Class I wrote yesterday. Aside from adding a RateController object, the only other modification was adding a listener to toggle the animation on a MOUSE_LEAVE event (cursor leaving the stage), and then changing the toggleAnimation function to wait for a click (and not MOUSE_MOVE i.e. cursor returns to stage) before adding particles again. Too easy… :)

Update 2: Many thanks to Joel for pointing out that in my zeal to optimise things I’d actually added some null pointer errors as well as some extra fps, and for correctly suggesting that using Sprites instead of MovieClips would result in a small speed boost, too. The swf file above and code & zip file below have received suitably stern words, and everything now works (relatively) swiftly and error free.

As usual, source code and flash files after the hop skip jump…

Continue reading ActionScript 3.0 Particle Systems #5: Smoke Effect