Installing the ROS driver for the Leap Motion controller

To interface the Leap Motion controller with ROS, we will need the ROS driver for it. Here is the link to get the ROS driver for Leap Motion; you can clone it using the following command:

$ git clone https://github.com/ros-drivers/leap_motion

Before installing the leap_motion driver package, we have to do a few things to ensure that it is properly compiled:

  1. The first step is to set the path of the Leap Motion SDK in the .bashrc file.

Assuming that the Leap SDK is in the user's home folder with the name LeapSDK, we have to set the path variable in .bashrc, as follows:

$ export LEAP_SDK=$LEAP_SDK:$HOME/LeapSDK

This environment variable is needed for compiling the code of the ROS driver, which has Leap SDK APIs.

  1. We also have to add the path of the Python extension of the Leap Motion SDK to .bashrc.

Here is the command used to do it:

export PYTHONPATH=$PYTHONPATH:$HOME/LeapSDK/lib:$HOME/LeapSDK/lib/x64
  

This will enable Leap Motion SDK APIs in Python.

  1. After performing the preceding steps, you can save .bashrc and open a new Terminal so that we will get the preceding variables in the new Terminal.
  2. The final step is to copy the libLeap.so file to /usr/local/lib.

Here is how to do it:

$ sudo cp $LEAP_SDK/lib/x64/libLeap.so /usr/local/lib
  1. After copying the file, execute ldconfig:
$ sudo ldconfig

Okay, you are now finished with setting the environment variables.

  1. Now you can compile the leap_motion ROS driver package. You can create a ROS workspace or copy the leap_motion package to an existing ROS workspace and use catkin_make.

You can use the following command to install the leap_motion package:

$ catkin_make install --pkg leap_motion  

The preceding will install the leap_motion driver. Now, let's test the device in ROS.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.150.59