Installing the ROS driver for the Leap Motion controller

To interface the Leap Motion 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 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 have it properly compiled.

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.

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. After going through the preceding steps, you can save .bashrc and take a new Terminal, so that we will get the preceding variables in the new Terminal.

The final step is to copy the libLeap.so file to /usr/local/lib. Here is how we do it:

    $ sudo cp $LEAP_SDK/lib/x64/libLeap.so /usr/local/lib

After copying, execute ldconfig:

    $ sudo ldconfig

Okay, you are finished with setting the environment variables. 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

This will install the leap_motion driver; check whether the ROS workspace path is properly set.

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

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