In case you haven’t noticed, we’re big fans of hackathons at Leap Motion, and when it comes to the left coast, there’s no hackathon bigger than LA Hacks. Recently, we caught up with a couple of teams from last month’s epic code battle, including finalists Team Armateur.
When Gagik Movsisyan and his team stepped into UCLA’s Pauley Pavilion, they weren’t sure what they were going to build. Taking their inspiration from a broken robotic arm, they decided to bring it to life with Leap Motion, Bluetooth, and an Arduino board.
Working with technology that only existed in science fiction just a decade ago is pretty amazing. We had both electrical engineers and software engineers on our team so developing a hardware hack was a good way of utilizing our various skills.
We were all really excited when we heard our team name called into the finals, although we were too sleepy to celebrate at that moment. Overall, the hackathon was a great experience and I think we surprised even ourselves with what we were able to do in only 36 hours.
— LeapMotion (@LeapMotion) April 14, 2014
Mapping Hand Motions to Robotic Joints
The robotic arm we used had five different motors, which controlled the different joints of the arm. We used the velocity of the palm, which was given by the API, to determine which direction the hand was moving. Palm velocity is a three-dimensional vector with X, Y, and Z components.
Our program interpreted a positive Z coordinate as vertical upward motion and a negative Z as vertical downward motion. The program would then send a string (with the LightBlue library) which consisted of two values: the number of the motor to activate, and the speed. The same was done for x and y which controlled left, right, forward, and backward movements.
We also had to take into account the pitch of the user’s wrist to determine the up and down motion of the robot’s wrist. The microcontroller on the robot received the string and translated the data into commands that moved the robot.
Narrowing Down the Lag
Part of the lag you see in the video was due to the amount of code being run repeatedly. During trials, the robot was much slower because we had a lot of code from the API that we weren’t using. After removing unnecessary code, the robot was much more responsive.
The distance between the Leap Motion device and the robot also affected the responsiveness, because we used Bluetooth. This can be improved if a strong wireless connection is used instead. More powerful motors, an upgraded Bluetooth receiver, and more powerful battery would also improve the responsiveness.
Armateur’s Python code is open-source and can be found on GitHub. Check it out!