Tutorial 3:
There is now a service implemented into MyRobotLab, (Thanks to Alessandro Didonna) Which performs the hand and the LeapMotion in the matter as the video below. The great thing about this is that it’s compatible on Mac, Windows, Linux and possibly Androids!
Here is the script link to automaticaly run the hand and the Leap in MyRobotLab:
https://github.com/MyRobotLab/pyrobotlab/blob/master/home/hairygael/InMoov4.LeapMotion.py
- Connect your Leap to the PC.
- Start the Leap visualiser with the Leap Api.(see below in the tutorial2/Step4/section 1,2,3)
- Start MyRobotLab (version above 1.0.2000), add/paste the script in the python tab.
- Make sure to adapt the min and max values for each of your servos.
- Change the COM port to your Arduino port. (see below in the tutorial2/Step4/section 4)
- Run the script.
- Voilà!!
Tutorial 2:
Another way is to run Leap Motion on your Mac without using MyRobotLab.
Please note: This tutorial assumes you are using a Mac OS. In this tutorial when there is code or text referenced, do not include the “ ”. For example, if you see: Search “Leap Motion” only enter Leap Motion without the quotations. Lastly, once terminal is open keep it open as we’ll be working through several steps in order
Step 1: Components:
- (1)Leap Motion
- (1)InMoov Hand and Forearm
- (5) HK15298 Servo
- (1) Arduino Uno or Mega
- (1) NervoBoard or a servo shield
- (1) Meter USB Cable
- (1) Power Supply 5-6V with a minimum of 3Amps
Step 3: Connect the Wires
For this part you’ll need the following components/tools/supplies:
1.(1)An Arduino Uno (or Arduino Mega)
2.(1)NervoBoard (nervo-board-tutorial) or a servo shield
3.(5) x HK15298 Servos (These servos are nice. I don’t recommend MG995 or servo with plastic gears!)
4.Separate power supply
Option 1: variable power supply
Option 2: Old power supply with the following specs: DC Between 5V and 7V Greater than 3A to sufficiently power all servos
5.The diagram attached, is to show you the basic connection of the servos to the Arduino.You can see that there are two wires (black and red) extending to the right from the prototyping PCB. Please note that these wires are where you should connect your separate power supply for the servos.
Step 4: Install Software
1.Install Leap Motion Desktop Software: Download Desktop App
2.See: System requirements
3.Verify Leap Motion settings:
1-Open Leap Motion (Cmd + SPACE > search “Leap Motion”)
2-Click on Leap Motion icon at top of page > click on settings
3-Verify that your settings match those in the pictures included:
4-Calibrate if needed. If you do, ideally you should have the Leap Motion surface very clean and you should also have a clean mirror available. I used the mirror in the bathroom with the Leap Motion connected to my laptop.
5-Once done, click “OK” to close.
4.Install Arduino IDE: Click here to download
5.Install Node.js: Click here to download
6.Verify Node.js and npm are installed:
1-Open terminal (Cmd + SPACE > “terminal” > press enter)
2-Verify Node.js:
1-In terminal type “node -v” > press enter
2-If you see something like “v8.9.3” then you are good to go
3-If you see something like “-bash: npp: command not found” then you need to install Node.js
3-Verify npm:
1-In terminal type “npm -v” > press enter
2-If you see something like “5.5.1” then you are good to go
3-If you see something like “-bash: npp: command not found” then you need to install npm. Note: npm is installed along with Node.js
7.Set up folders:
1-In terminal:
1-Return to home folder: “cd” > press enter
2-Go to Documents folder: “cd Documents” > press enter
3-Create new folder then go to new folder: “mkdir roboHand; cd roboHand” > press enter
8-Install needed Node.js modules:
1-In terminal:
1-“npm install -g gl-matrix” > press enter
2-“npm install -g johnny-five” > press enter
3-“npm install -g underscore” > press enter
4-“npm install -g ws” > press enter
2-Verify modules are installed (optional):
1- “npm list MODULENAME” > press enter
9.Install Leap Motion JavaScript SDK:
1-In terminal:
1-“npm install leapjs” > press enter
CONGRATULATIONS! IF YOU’VE FOLLOWED THE STEPS SUCCESSFULLY, YOU SHOULD NOW HAVE ALL OF THE SOFTWARE NEEDED FOR THIS PROJECT INSTALLED ON YOUR COMPUTER.
Step 5: Prepare/Run the Code
1.Prepare Hardware:
1-Make sure Leap Motion is plugged into your computer
2-Get ready to turn power on to power your servos after JavaScript code is running
2.Prepare Arduino:
1-We’ll be uploading code included with the Arduino IDE called StandardFirmata
2-Open Arduino IDE > Plug in Arduino
3-Verify port: Tools > Port > select appropriate port
4-Verify correct board: Tools > Board > select appropriate board
5-Upload StandardFirmata code: File > Examples > Firmata > StandardFirmata > upload to Arduino
3.Prepare JavaScript Code:
1.In terminal:
1-“git clone git://github.com/SJCCRAC/leapApp” > press enter
4.Run JavaScript Code (leapApp.js):
1-In terminal:
1-“cd leapApp/script” > press enter
2-“node leapApp.js” > press enter
2-Your code should now have started…turn power on to your servos!
5.Play with camera controlled robot hand:
1-If everything went smoothly, you should now be able to place your hand above the Leap Motion and control the robot hand.
6.Terminal/JavaScript Code Tips:
1-To stop JavaScript code:
1-In terminal type: CONTROL + C… CONTROL + C
2-To restart JavaScript code:
1-In terminal, press up arrow on the keyboard to cycle through most recent entries > press enter when you’ve found the one you want to enter
Tutorial 1:
This is my original version of the tutorial:
Thanks to Seokju Lee, and Doctor Shim. KAIST
Unmanned System Research Group (USRG) & Field Robotics Center (C-FRIEND)
Flight Dynamics and Control Laboratory (FDCL)
Dept. of Robotics Program
This is exactly what I received for to make the Leap control the InMoov Hand, I have spent many hours pulling of my hair because things are not always obvious for everybody.
Windows is not working correctly with Leap and this script, Linux will work but you won’t have the fancy Visualiser that I showed in the video.
So your best option is to use a Apple Computer, Leap requires a lot of video resource, so don’t expect to do this on a old machine. I used a MacBookPro.
To install the files and node.js you will need to use the terminal, so it is not that easy if you’ve never done that before.
The [directory] tree you will create should be like this:
———————————-
|-[Project folder (you’ve made)]
|—-[node_modules]
|——–[johnny-five]
|——–[ws]
|—-[LeapHand (unzip file)]
|——–[src]
|————[lib]
|—————-joint.js
|—————-leapFrame.js
|————app.js
|——–Makefile
|——–README.md
If you need to adjust the degree rotation of your servos, edit app.js and modify the values.