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.
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 for detailed information.
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:
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.
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 for further information.
Livox SDK requires CMake 3.0.0+ as dependencies. You can install these packages using apt:
sudo apt install cmake
In the Livox SDK directory, run the following commands to compile the project:
git clone https://github.com/Dat-Bois/Livox-SDK.git
cd Livox-SDK
cd build && cmake ..
make
sudo make install
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:
cd sample/lidar && ./lidar_sample
or run the hub_sample if connect with the hub unit(s):
cd sample/hub && ./hub_sample
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:
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_cc -c "00000000000002&00000000000003&00000000000004" -l
./hub_sample_cc -c "00000000000001" -l
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 BROADCAST_CODE_LIST_SIZE. */
/*#define BROADCAST_CODE_LIST_SIZE 3
int lidar_count = BROADCAST_CODE_LIST_SIZE;
char broadcast_code_list[kMaxLidarCount][kBroadcastCodeSize] = {
"000000000000002",
"000000000000003",
"000000000000004"
};*/
We provide the C++ sample to generate the lvx file for hub and LiDAR unit(s). You can use the same way in 4.2.1
and 4.2.2
to run them.
You can alse use the program options in 4.3.1
to connect specific device and generate the log file, and we provide two new options for lvx file:
[-t] Time to save point cloud to the lvx file.(unit: s)
[-p] Get the extrinsic parameter from standard extrinsic.xml file(The same as viewer) in the executable file's directory.(Especially for LiDAR unit(s) as the hub will calculate the extrinsic parameter by itself)
Here is the example:
./lidar_lvx_sample -c "00000000000002&00000000000003&00000000000004" -l -t 10 -p
./hub_lvx_sample -c "00000000000001" -l -t 10