1.添加以太网信息
点击+,设置静态ip
2.连接扫描仪,并连接到事先设置好的Mid网络。
3.安装必要的包
在运行数据采集程序前需要安装keyboard、serial、crcmod、tqdm、laspy、deprecated、pyserial包,命令如下:
yy@yy:~$ cd '/media/yy/work/OpenPyLivox-used'
pip3 install keyboard -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install serial -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install crcmod -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install tqdm -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install laspy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install deprecated -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install pyserial -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
随后运行 python3 main.py
Using computer IP address: 192.168.1.50
*** Discovered a Livox sensor ***
Type: Mid-40
Serial: 0TFDH590067M23
IP(s): 192.168.1.23 (ID: 1)
Attempting to auto-connect to the Livox Mid-40 with S/N: 0TFDH590067M23
Connected to the Livox Mid-40 at IP: 192.168.1.23 (ID: 1)
Computer IP Address: 192.168.1.50
Sensor IP Address(es): ['192.168.1.23']
Data Port Number(s): ['40864']
Command Port Number(s): ['39335']
192.168.1.23 --> F/W Version: 03.08.0000
192.168.1.23 --> Serial # 0TFDH590067M23
192.168.1.23 <-- sent lidar spin up request
192.168.1.23 --> lidar is ready
192.168.1.23 <-- sent start data stream request
192.168.1.23 <-- sent update UTC request
192.168.1.23 <-- sent dual return lidar mode request
192.168.1.23 <-- sent stop IMU data push request
192.168.1.23 <-- sent turn on rain/fog suppression request
192.168.1.23 --> CAPTURING DATA...
192.168.1.23 --> writing real-time data to BINARY file: 20210512-095217
注:
可能会出现以下情况:
1)根据提示keyboard库需要在root权限下使用,因此在采集数据前切换到root
File "/home/yy/.local/lib/python3.6/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.
2)根据程序,我们自己定义的扫描终止热键为ctrl+q
def singleSCanerCapture():
sflag = status()
scanner = CSCanner()
thread_scanner = threading.Thread(target=scanner.scanner_on)
thread_scanner.daemon = True
thread_scanner.start()
# 监听到键盘事件ctrl+c 则停止扫描并掉电
if not keyboard.wait('ctrl+q'):
scanner.scanner_off()
sflag.break_flag = True
print("*"*30+"finished"+"*"*30)