200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > Ubuntu 20.04安装Leap Motion问题总结

Ubuntu 20.04安装Leap Motion问题总结

时间:2020-06-29 10:25:45

相关推荐

Ubuntu 20.04安装Leap Motion问题总结

安装步骤

Step 1 Download and install V2 Tracking.

1、下载Linux版本的 V2 软件(/legacy-v2/)并解压

2、打开leapd.service文件

sudo gedit/lib/systemd/system/leapd.service

打开后粘贴以下代码

[Unit] Description=LeapMotionDaemon After=syslog.target[Service] Type=simple ExecStart=/usr/sbin/leapd[Install] WantedBy=multi-user.target

3、保存并重新加载

sudo ln -s/lib/systemd/system/leapd.service /etc/systemd/system/leapd.servicesystemctldaemon-reload

4 、安装deb文件

sudo dpkg -i Leap-2.3.1+31549-x64.deb

5、运行leapd

sudo leapd #A new terminalLeapControlPanel #A new terminalVisualizer #A new terminal

Step 2 Download leap_motion package.

cd YOUR_WORK_SPACE/srcgit clone /qqfly/leap_motion.gitcd YOUR_WORK_SPACEcatkin_make

Step 3 Export python path.

You must make sure that python can find the essential modules.

source YOUR_WORK_SPACE/devel/setup.bashexport PYTHONPATH=$PYTHONPATH:$HOME/LeapSDK/lib:$HOME/LeapSDK/lib/x64

Step 4 Run the ROS driver. Connect the Leap Motion to your computer.

sudo leapd #A new terminalLeapControlPanel #A new terminalcd YOUR_WORK_SPACEroscore #A new terminalrosrun leap_motion send.py

Now you can see the data updating in the terminal window. Refer to here for more details.

In addition, if you encounter the following problem:

[Info] Tracking initialized[Critical] Secure WebSocket server failed to start[Critical] WebSocket server failed to start[Critical] Have you tried running as root/Administrator?

after you type

sudo leapd

It’s due to the problem that more than one leapd service is runing. Then you can type

sudo service leapd stop

to stop the leapd service and restart it by leapd.

出现问题

一、leapmotion的驱动文件不支持python3,故最好不在ubuntu 20上安装使用

二、python2、pyrospkg和pyyaml安装

1、安装pip3

sudo apt updatesudo apt install python3-pip# 安装完之后检查一下是否可用pip3 -V

2、安装python2

sudo add-apt-repository universesudo apt updatesudo apt install python2# 安装完成之后检查一下是否可用python2

3、安装pip2

wget https://bootstrap.pypa.io/pip/2.7/get-pip.pysudo python2 get-pip.py# 安装完之后检查一下是否可用pip2 -V

4、安装rospkg

sudo pip2 install rospkg

5、安装pyyaml

sudo pip2 install pyyaml

三、python2与python3切换

1、查看已安装的python版本

ls /usr/bin/python*

2、查看系统中是否有python配置选项

sudo update-alternatives --list python

3、第1步中看到了系统有python2和python3两个版本,下面配置python选项

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2

4、python版本切换

python --version

sudo update-alternatives --config python

四、【python】错误SyntaxError: invalid syntax的解决方法总结

报错

import rospyFile "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>from .client import spin, myargv, init_node, \File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 60, in <module>import rospy.impl.initFile "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/init.py", line 54, in <module>from .tcpros import init_tcprosFile "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros.py", line 45, in <module>import rospy.impl.tcpros_serviceFile "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 54, in <module>from rospy.impl.tcpros_base import TCPROSTransport, TCPROSTransportProtocol, \File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 160(e_errno, msg, *_) = e.args^SyntaxError: invalid syntax

具体方法

cd opt/ros/noetic/lib/python3/dist-packages/rospy/implsudo gedit tcpros_base.py

此时会打开相应文档,按照报错找到相应行,将原本的(e_errno, msg, *_) = e.args改为(e_errno, msg) = e.args

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。