[中文版本使用说明](<https://github.com/Livox-SDK/Livox-SDK/blob/master/README_CN.md>)
# 1 Introduction
Livox SDK is the software development kit designed for all Livox products. It is developed based on C/C++ following Livox SDK Communication Protocol, and provides easy-to-use C style API. With Livox SDK, users can quickly connect to Livox products and receive point cloud data.
Livox SDK consists of Livox SDK communication protocol, Livox SDK core, Livox SDK API, Linux sample, and ROS demo.
## Prerequisites
* Ubuntu 14.04/Ubuntu 16.04/Ubuntu 18.04, both x86 and ARM (Nvidia TX2)
* Windows 7/10, Visual Studio 2015 Update3/2017
* C++11 compiler
# 2 Livox SDK Communication Protocol
Livox SDK communication protocol opens to all users. It is the communication protocol between user programs and Livox products. The protocol consists of control commands and data format. Please refer to the [Livox SDK Communication Protocol](<https://github.com/Livox-SDK/Livox-SDK/wiki/Livox-SDK-Communication-Protocol>) for detailed information.
# 3 Livox SDK Core
Livox SDK provides the implementation of control commands and point cloud data transmission, as well as the C/C++ API. The basic structure of Livox SDK core is shown as below:
![Livox SDK Architecture](doc/images/sdk.png)
User Datagram Protocol (UDP) is used for communication between Livox SDK and LiDAR sensors. Please refer to the Livox SDK Communication Protocol for further information. Point cloud data handler supports point cloud data transmission, while command handler receives and sends control commands. And the C/C++ API is based on command handler and point cloud data handler.
The Livox LiDAR sensors can be connected to host directly or through the Livox Hub. Livox SDK supports both connection methods. When LiDAR units are connected to host directly, the host will establish communication with each LiDAR unit individually. And if the LiDAR units connect to host through Hub, then the host only communicates with the Livox Hub while the Hub communicates with each LiDAR unit.
# 4 Livox SDK API
Livox SDK API provides a set of C style functions which can be conveniently integrated in C/C++ programs. Please refer to the [Livox SDK API Reference](https://livox-sdk.github.io/Livox-SDK/) for further information.
## 4.1 Installation
The installation procedures in Ubuntu 18.04/16.04/14.04 LTS and Windows 7/10 are shown here as examples. For Ubuntu 18.04/16.04/14.04 32-bit LTS and Mac, you can get it in [Livox-SDK wiki](https://github.com/Livox-SDK/Livox-SDK/wiki).
### 4.1.1 Ubuntu 18.04/16.04/14.04 LTS
#### Dependencies
Livox SDK requires [CMake 3.0.0+](https://cmake.org/) as dependencies. You can install these packages using apt:
```
sudo apt install cmake pkg-config
```
#### Compile Livox SDK
In the Livox SDK directory, run the following commands to compile the project:
```
git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK
```
Install apr library by:
```
sudo ./third_party/apr/apr_build.sh
```
or by:
```
sudo apt install libapr1-dev
```
then
```
cd build && cmake ..
make
sudo make install
```
### 4.1.2 Windows 7/10
#### Dependencies
Livox SDK supports Visual Studio 2015 Update3/2017 and requires install [CMake 3.0.0+](https://cmake.org/) as dependencies.
In the Livox SDK directory, run the following commands to create the Visual Studio solution file.
Generate the 32-bit project:
```
cd Livox-SDK
.\third_party\apr\apr_build.bat
cd build && \
cmake ..
```
Generate the 64-bit project:
```
cd Livox-SDK
.\third_party\apr\apr_build.bat amd64
cd build && \
cmake .. -G "Visual Studio 15 2017 Win64"
```
#### Compile Livox SDK
You can now compile the Livox SDK in Visual Studio.
### 4.1.3 ARM-Linux Cross Compile
The procedure of cross compile Livox-SDK in ARM-Linux are shown below.
#### Dependencies
Host machine requires install cmake and gcc. You can install these packages using apt:
```
sudo apt install cmake gcc
```
#### Cross Compile Toolchain
If your ARM board vendor provides a cross compile toolchain, you can skip the following step of installing the toolchain and use the vendor-supplied cross compile toolchain instead.
The following commands will install C and C++ cross compiler toolchains for 32bit and 64bit ARM board. You need to install the correct toolchain for your ARM board. For 64bit SoC ARM board, only install 64bit toolchain, and for 32bit SoC ARM board, only install 32bit toolchain.
Install **ARM 32 bits cross compile toolchain**:
```
sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
```
Install **ARM 64 bits cross compile toolchain**:
```
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
```
#### Cross Compile Livox-SDK
For **ARM 32 bits toolchain**,In the Livox SDK directory,run the following commands to cross compile the project:
```
cd Livox-SDK
cd build && \
cmake .. -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++
make
```
For **ARM 64 bits toolchain**,In the Livox SDK directory,run the following commands to cross compile the project:
```
cd Livox-SDK
cd build && \
cmake .. -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
make
```
**Note:**
- gcc cross compiler need to support C ++11 standard
## 4.2 Run Livox SDK Sample
Two samples are provided in Sample/Lidar and Sample/Hub, which demonstrate how to configure Livox LiDAR units and receive the point cloud data when directly connecting Livox SDK to LiDAR units or by using a Livox Hub, respectively. The sequence diagram is shown as below:
![](doc/images/sample.png)
### 4.2.1 Ubuntu 18.04/16.04 /14.04 LTS
For Ubuntun 18.04/16.04/14.04 LTS, run the *lidar_sample* if connect with the LiDAR unit(s):
```
cd sample/lidar && ./lidar_sample
```
or run the *hub_sample* if connect with the hub unit(s):
```
cd sample/hub && ./hub_sample
```
### 4.2.2 Windows 7/10
After compiling the Livox SDK as shown in section 4.1.2, you can find `hub_sample.exe` or `lidar_sample.exe` in the {Livox-SDK}\build\sample\hub\Debug or {Livox-SDK}\build\sample\lidar\Debug folder, respectively, which can be run directly.
Then you can see the information as below:
![](doc/images/sdk_init.png)
### 4.3 Connect to the specific LiDAR units
Samples we provided will connect all the broadcast device in you LAN in default.There are two ways to connect the specific units:
* run sample with input options
* edit the Broadcast Code list in source code
**NOTE:**
Each Livox LiDAR unit owns a unique Broadcast Code . The broadcast code consists of its serial number and an additional number (1,2, or 3). The serial number can be found on the body of the LiDAR unit (below the QR code).The Broadcast Code may be used when you want to connect to the specific LiDAR unit(s). The detailed format is shown as below:
![Broadcast Code](doc/images/broadcast_code.png)
#### 4.3.1 Program Options
We provide the following program options for connecting the specific units and saving log file:
```
[-c]:Register LiDAR units by Broadcast Code. Connect the registered units ONLY.
[-l]:Save the log file(In the executable file's directory).
[-h]:Show help.
```
Here is the example:
```
./lidar_sample -c "00000000000002&00000000000003&00000000000004" -l
./hub_sample -c "00000000000001" -l
```
#### 4.3.2 Edit Broadcast Code List
Comment the following code section:
```
/** Connect all the broadcast device. */
int lidar_count = 0;
char broadcast_code_list[kMaxLidarCount][kBroadcastCodeSize];
```
Remove the comment of the following code section, set the BROADCAST_CODE_LIST_SIZE and replace the broadcast code lists in the `main.c` for both LiDAR sample ({Livox-SDK}/sample/lidar/main.c) and Hub sample ({Livox-SDK}/sample/hub/main.c) with the broadcast code of your devices before building.
```
/** Connect the broadcast device in list, please input the broadcast code and modify the BR
没有合适的资源?快使用搜索试试~ 我知道了~
Livox-SDK-master_Livox_
共633个文件
c:268个
h:188个
cpp:32个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 5 下载量 173 浏览量
2021-10-02
12:19:10
上传
评论 2
收藏 1.91MB ZIP 举报
温馨提示
Livox SDK的C++代码,用于某雷达的二次开发
资源推荐
资源详情
资源评论
收起资源包目录
Livox-SDK-master_Livox_ (633个子文件)
win32ver.awk 4KB
make_nw_export.awk 3KB
make_exports.awk 3KB
nw_ver.awk 2KB
make_var_export.awk 1023B
nw_make_header.awk 941B
apr_build.bat 4KB
buildconf 4KB
apr_pools.c 79KB
jlibtool.c 53KB
apr_snprintf.c 43KB
proc.c 41KB
apr_tables.c 40KB
testfile.c 39KB
filepath.c 37KB
apr_escape.c 36KB
sockaddr.c 36KB
proc_mutex.c 36KB
sendrecv.c 34KB
testpoll.c 29KB
filestat.c 29KB
z_asio.c 24KB
open.c 23KB
apr_skiplist.c 23KB
proc.c 22KB
sendfile.c 22KB
shm.c 22KB
proc.c 20KB
sha2.c 19KB
testsock.c 19KB
readwrite.c 19KB
dso.c 18KB
aplibtool.c 18KB
testhash.c 17KB
port.c 17KB
apr_fnmatch.c 17KB
testskiplist.c 17KB
sockets.c 17KB
sockets.c 17KB
apr_hash.c 17KB
proc.c 16KB
pipe.c 16KB
testcond.c 16KB
proc.c 15KB
sendrecv.c 15KB
readwrite.c 15KB
errorcodes.c 15KB
kqueue.c 14KB
sockopt.c 14KB
testatomic.c 14KB
epoll.c 14KB
poll.c 13KB
shm.c 13KB
testdir.c 13KB
filestat.c 13KB
testescape.c 13KB
apr_cstr.c 12KB
dir.c 12KB
select.c 12KB
signals.c 12KB
teststr.c 12KB
testrand.c 12KB
testnames.c 12KB
main.c 12KB
main.c 12KB
apr_strings.c 12KB
open.c 11KB
time.c 11KB
testlfs.c 11KB
testucs.c 11KB
getopt.c 11KB
time.c 10KB
dir.c 10KB
abts.c 10KB
filepath.c 10KB
filestat.c 10KB
utf8.c 10KB
testshm.c 10KB
sockets.c 10KB
readwrite.c 10KB
apr_random.c 9KB
testlock.c 9KB
testfileinfo.c 9KB
sockopt.c 9KB
pollset.c 9KB
testipsub.c 9KB
testfnmatch.c 9KB
userinfo.c 9KB
testtime.c 9KB
multicast.c 9KB
apr_cpystrn.c 9KB
misc.c 9KB
ppc.c 8KB
filedup.c 8KB
pipe.c 8KB
testlockperf.c 8KB
thread.c 8KB
open.c 8KB
thread.c 8KB
pollset.c 8KB
共 633 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
西西nayss
- 粉丝: 70
- 资源: 4754
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页