One Giant LEAP For Robotkind

Finaly my long awaited Leap Motion pre-order arrived so I decided to see what I could do with it.

After playing with some of the demo programs I noticed on there was a Processing library on the leap developer site (can be found here). The control program for my hexapod is already written in processing so adding the leap was relatively easy.

All I have done currently is map x, y, z, yaw, pitch & roll of the users hand onto the body of the hexapod. The smoothing and inverse kinematics are then done and sent to the hexapod over TCP/IP. Raspberry Pi on the hexapod receives this with a python script and outputs the values to the servos.  Hand tracking with the Leap is enabled or disabled by a key tap gesture with any finger.

To add this to my code it was as easy as including the library at the top of the sketch:

import de.voidplus.leapmotion.*;
LeapMotion leap;

Then initialising the leap in void setup()

leap = new LeapMotion(this).withGestures("key_tap");

and setting position from the Leap in main:

if (enableLeap == true){
 for(Hand hand : leap.getHands()){
  PVector hand_position = hand.getPosition();

  HexapodOrientationYaw = hand.getYaw();
  HexapodOrientationPitch = hand.getPitch();
  HexapodOrientationRoll = hand.getRoll();

  HexapodPositionX = hand_position.x;
  HexapodPositionY = hand_position.y;
  HexapodPositionZ = hand_position.z;

Turning the Leap control on and of is done by a seprate function which runs when a gesture is recognised.

void leapOnKeyTapGesture(KeyTapGesture g){
 enableLeap=!enableLeap; //toggle Leap on/off
 delay(200); //small debounce

When I get some time I hope to add the ability to use both hands to control the front two legs. This will allow for manipulation of objects through the Leap


2 responses to “One Giant LEAP For Robotkind”

  1. KAP says :

    Beautifully done. Is the hexapod a personal design, or a kit? Love the wooden hardware.

    • ducktaperules says :

      thanks. the hexapod is my own design. i would like to develop the hardware further so that i could offer it as a kit but at the moment i just don’t have the time to spend making it look better. i would like it to be made of acrylic eventually so that it looks a bit more professional and polished but i don’t know if it will ever get there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: