(Partial) ROS2 driver for the Leap Motion Controller
You should have ROS2 Foxy installed on your device and the Leap Motion SDK for Linux.
Currently, this ROS2 package supports publishing raw camera images from the controller, basic visualization using RViz and a pointcloud2 generated from stereo_image_proc node. Hand tracking features are still not ported.
1. Download the SDK from Leap Motion.
2. Uncompress the tar file and install the deb file inside it.
gunzip -c Leap_Motion_SDK_Linux_2.3.1.tgz | tar xvf -
cd LeapDeveloperKit_2.3.1+31549_linux/
sudo dpkg -i Leap-2.3.1+31549-x64.deb # or Leap-2.3.1+31549-x86.deb
3. Colcon seems to have problems finding libLeap.so
. This is the quickiest (and dirtiest) way to fix it: copying it.
sudo cp LeapSDK/lib/x64/libLeap.so /usr/lib
# or sudo cp LeapSDK/lib/x86/libLeap.so /usr/lib
4. Clone the repo to your workspace.
cd ~/catkin_ws/src
git clone https://github.com/TaISLab/leap_motion.git
5. Copy the Leap Config file from the repo to the system-wide location:
sudo cp leap_motion/config/leapd.conf /var/.Leap\ Motion/config.json
6. Configure Leap Motion systemd service
- Create a service file
cd /lib/systemd/system
sudo nano leapd.service
- The file should be like this:
[Unit]
Description=LeapMotion Daemon
After=syslog.target
[Service]
Type=simple
ExecStart=/usr/sbin/leapd --run --config=/var/.Leap\ Motion/config.json
[Install]
WantedBy=multi-user.target
- Link it:
sudo ln -s /lib/systemd/system/leapd.service/etc/systemd/system/leapd.service
systemctl daemon-reload
- Now this should start the service:
sudo service leapd start
- You can check the status with:
sudo service leapd status
- And see te output with this command:
Visualizer
7. Compile the ros2 package:
cd ~/catkin_ws/
colcon build --symlink-install --packages-select leap_motion
1. (OPTIONAL) If it gives you an error about the leap daemon not running, stop the LeapControlPanel have a look here and use the following command:
sudo service leapd restart
2. Source your current catkin workspace.
source ~/catkin_ws/install/setup.bash
3. Launch camera.launch.py
file.
ros2 launch leap_motion camera.launch.py
4. You can use Rviz config file leap_camera.rviz
to see the output
Check Jeff Gensler's ROS2 Image Pipeline Tutorial to learn a bit more about the disparity images, great reading!