嚴淑芹
摘 ?要: 人工智能平臺離不開各種硬件設備如機械雷達(Mechanical Radar)、慣性測量單元(IMU)等傳感器。這些傳感器實時捕獲點陣圖、陀螺儀數(shù)據(jù)、加速度計數(shù)據(jù)等信息傳入后臺,后臺運用算法對這些數(shù)據(jù)進行時間戳對齊等處理,得到可用的信息。文章在傳感器已選型的基礎上,介紹如何將機械雷達、慣性測量單元以及毫米波雷達在物理上搭建成一個人工智能平臺;如何在Ubuntu操作系統(tǒng)上運用各個傳感器供應商提供的軟件開發(fā)包(SDK)開發(fā)軟件,以使得各個傳感器能獨立工作去捕獲數(shù)據(jù);如何運用Python開發(fā)上位機軟件(GUI)讓這些傳感器協(xié)同工作以及按照時間戳保存數(shù)據(jù)。
關鍵詞: 人工智能平臺; 傳感器; 機械雷達; Ubuntu; Python
中圖分類號:TP399 ? ? ? ? ?文獻標識碼:A ? ? 文章編號:1006-8228(2020)01-19-04
Abstract: AI Bench depends on versatile hardware like sensors (Mechanical Radar, IR Camera, IMU, etc.). The sensors will acquire PCD data, visible spectrum photo, infrared spectrum photo, gyro data, accelerometer data, and then the data will be passed to be processed by advanced algorithm to get the valuable information after the processing. With all the sensors determined, this paper introduces how to assemble Mechanical Radar, IR Camera, Imaging Camera, IMU in hardware way, and how to integrate them in software way, and describes how to develop software with Ubuntu operating system, and SDKs provided by the sensor suppliers, to make the sensors run according to projects requirements in detail, as well as how to develop the software for upper computer with Python to make the sensors work collaboratively.
Key words: AI bench; sensor; mechanical radar; Ubuntu; Python
0 引言
隨著人工智能和大數(shù)據(jù)技術的不斷發(fā)展,越來越需要豐富多樣和量大的數(shù)據(jù)。而絕大部分數(shù)據(jù)來源于傳感器。對一個人工智能系統(tǒng)而言,將所有硬件(傳感器、交換機等)進行物理上的集成和軟件上的整合,將是人們進行下一步大數(shù)據(jù)處理的基礎和關鍵開始。
1 基于SDK的各個傳感器的軟件開發(fā)
各個傳感器的軟件開發(fā)與功能實現(xiàn)都是基于供應商提供的軟件開發(fā)包(SDK)。其中,機械雷達(Lidar)、雙光相機(Uranus)、IMU、工業(yè)相機是通過以太網(wǎng)與主機Ubuntu進行通訊的,而毫米波雷達和云臺是通過CAN總線與主機Ubuntu進行通訊。該部分主要介紹以太網(wǎng)絡上的各個傳感器的軟件開發(fā)。毫米波雷達通過供應商提供的DBC文件以及USB2CAN設備及其驅(qū)動和Python-CAN強大功能,即可實現(xiàn)對它的控制。
1.1 機械雷達(Lidar)的軟件開發(fā)與功能實現(xiàn)
本項目采用的機械雷達是禾賽科技的Pandar40。Pandar40是一款40線機械式激光雷達,其內(nèi)部包含40組激光收發(fā)對,通過360°旋轉(zhuǎn)進行3D成像。它的工作原理是:激光雷達的測距方式——飛行時間測量法(Time of Flight)[1],即:
⑴ 激光雷達的激光器發(fā)射出一束超短激光脈沖;
⑵ 激光投射到物體上后發(fā)生漫反射,激光接收器接收漫反射光;
⑶ 通過激光光束在空中的飛行時間,準確計算得出目標物體到傳感器間的距離。
在Ubuntu上打開一個終端,下載供應商的SDK。使用命令:
git clone https://github.com/HesaiTechnology/HesaiLidarSDK.git --recursive
安裝SDK正常運行所需要的各種軟件包。使用命令:
sudo apt install cmake libproj-dev libpcap-dev libboost-all-dev libyaml-cpp-dev libjpeg-dev libgdal-dev libpq-dev libvtk6-dev libvtk6-qt-dev libpcl-dev
在軟件開發(fā)包SDK的源文件test.cc基礎上,將代碼按照項目需求進行修改。
int main(int argc, char **argv)
{
testResultMainPath = argv[0] + std::string("/Pandar40_Records/");
char command[260];