1.2.1.1. Livox LiDAR Communication Protocol–Mid360
Release History |
||
---|---|---|
Date |
Version |
Description |
20220519 |
v1.0 |
1. Initialized version |
20220530 |
v1.1 |
1. Merge status and parameter |
20220602 |
v1.2 |
1. Add |
20220622 |
v1.3 |
1. Port 56000 only supports discovery command by broadcasting. Discovery command by broadcasting |
20220628 |
v1.4 |
1. Update working status description |
20220629 |
v1.4.1 |
1. Add |
20220815 |
v1.4.2 |
1. Add |
20220825 |
v1.4.3 |
1.Add |
20220915 |
v1.4.4 |
1.Add point cloud format description in spherical coordinate system |
20221028 |
v1.4.5 |
1. Modified description of FOV configuration |
20221114 |
v1.4.6 |
1. Add description of communication process |
20221213 |
v1.4.7 |
Modified description of pattern_mode configuration |
1.2.1.2. Overview
This communication protocol is only used for livox Mid360 LiDAR.
1.2.1.2.1. Protocol Types
There are two types of data protocols between the user and the LiDAR, see as below:
Point cloud data protocol:
Point cloud data;
IMU data.
For details, see 2.3 Data Types.
Control command protocol:
Configure and query LiDAR parameters;
LiDAR reset;
Push and query LiDAR status;
Upgrade LiDAR;
For details, see 4 CMD Detials
Both protocols are encapsulated using UDP data segments, and the protocol data is Little-endian.
1.2.1.2.2. LiDAR Working Status
The state machine of the current LiDAR is shown in the figure, The state enumeration values currently used by the Mid360 are as follows:
LiDAR Status |
Enumeration Value |
Whether to Support User Settings |
---|---|---|
SAMPLING |
0x01 |
Support(By Parameter Configuration) |
IDLE |
0x02 |
Support(By Parameter Configuration) |
ERROR |
0x04 |
Not Support |
SELFCHECK |
0x05 |
Not Support |
MOTORSTARUP |
0x06 |
Not Support |
UPGRADE |
0x08 |
Support(By Entering Upgrade) |
READY |
0x09 |
Support(By Parameter Configuration) |
1.2.1.2.3. Port Description
The source port and destination port are explained as follows according to the different data types:
Data Type |
Transmission Direction |
LiDAR Port |
Host Computer Port |
Transmission Type |
Transmission Protocol |
---|---|---|---|---|---|
Device Type Query |
LiDAR <—-> PC |
56000 |
Any |
Broadcast |
UDP |
56000 is used as the fixed listening port of Livox LiDAR, mainly used for the host computer to query the device through broadcast:
1. Only the device type query command (cmd_id: 0x0000) is supported. The host computer obtains the specific device type of the LiDAR through this port. This command response is replied by broadcast, so that when the host computer and the LiDAR IP are not in the same network segment, the host computer can still identify the LiDAR.
Mid-360 Communication Port:
Data Type |
Transmission Direction |
LiDAR Port |
Host Computer Port |
Transmission Type |
Transmission Protocol |
---|---|---|---|---|---|
Control Command |
LiDAR<—> Host Computer |
56100 |
Any (56101 recommended) |
Unicast |
UDP |
Push Command |
LiDAR —> Host Computer |
56200 |
Configurable (default 56201) |
Default Unicast |
UDP |
Point Cloud Data |
LiDAR —> Host Computer |
56300 |
Configurable (default 56301) |
Default Unicast(Support Multicast) |
UDP |
IMU Data |
LiDAR —> Host Computer |
56400 |
Configurable (default 56401) |
Default Unicast(Support Multicast) |
UDP |
LOG Data |
LiDAR <—> Host Computer |
56500 |
Any (56501 recommended) |
Unicast |
UDP |
1.2.1.3. Point Cloud & IMU Data Protocol
1.2.1.3.1. Protocol Format
Point cloud data format:
Fields |
Offset (bytes) |
Size (bytes) |
Description |
---|---|---|---|
version |
0 |
1 |
Package protocol version: currently 0. |
length |
1 |
2 |
The length of the entire UDP data segment starting from |
time_interval |
3 |
2 |
Intra-frame point cloud sampling time (Unit: 0.1us); |
dot_num |
5 |
2 |
The current UDP packet data field contains the number of points. |
udp_cnt |
7 |
2 |
Point cloud UDP packet count, each UDP packet is incremented by 1 in turn, and cleared to 0 at the beginning of the point cloud frame. |
frame_cnt |
9 |
1 |
Point cloud frame count, plus 1 for each frame of point cloud (10Hz/15Hz, etc.); |
data_type |
10 |
1 |
Data type. For details, see 2.3 Data Types. |
time_type |
11 |
1 |
Timestamp type. For details, see 2.2 Timestamp. |
reserved |
12 |
12 |
Reserved. |
crc32 |
24 |
4 |
Timestamp + data segment check code, using CRC-32 algorithm. For details, see 6 CRC Algorithm. |
timestamp |
28 |
8 |
Point cloud timestamp. For details, see 2.2 Timestamp. |
data |
36 |
– |
Data information. For details, see 2.3 Data Types. |
1.2.1.3.2. Timestamp
The LiDAR system supports GPS time synchronization and PTP network time synchronization.
GPS time synchronization can be input through UDP packets, or through serial port GPRMC packets, see the time synchronization documentation for more details;
PTP time synchronization supports IEEE1588v2.0 UDP/IP synchronization, and gPTP L2 synchronization;
The timestamp in each packet represents the time of the first point cloud, and there are N point clouds in each packet. The time of these N point clouds is equally spaced, and the total time interval is the value of time_interval
.
Timestamp type:
Timestamp Type |
Sync Source Type |
Data Format |
Description |
---|---|---|---|
0 |
No synchronization source, the timestamp is the time when the LiDAR is turned on |
uint64_t |
Unit: ns |
1 |
gPTP/PTP synchronization, the time of master clock source as a timestamp |
uint64_t |
Unit: ns |
2 |
GPS time synchronization |
uint64_t |
Unit: ns |
Notice:
The time limit for GPS time synchronization is from 1/1/2000 to 31/12/2037
PTP time synchronization does not support IEEE1588v2.1
Not recommended for use in scenarios where IEEE1588v2.0 and gPTP coexist;
1.2.1.3.3. Data Types
There are N samples in each packet. The size of N depends on the data type.
There are four data types from 0 to 3, the default data type is 1:
Data Type |
Sampling Type |
Echo Mode |
Coordinate Mode |
N |
---|---|---|---|---|
0 |
IMU data |
|||
1 |
Point cloud data 1 |
Single echo mode |
Cartesian coordinates(32bit) |
96 |
2 |
Point cloud data 2 |
Single echo mode |
Cartesian coordinates(16bit) |
96 |
3 |
Point cloud data 3 |
Single echo mode |
Spherical coordinates |
96 |
Data Type 0
IMU Data:
Field |
Offset (bytes) |
Data Type |
Description |
---|---|---|---|
gyro_x |
0 |
float |
Unit: rad/s |
gyro_y |
4 |
float |
Unit: rad/s |
gyro_z |
8 |
float |
Unit: rad/s |
acc_x |
12 |
float |
Unit: g |
acc_y |
16 |
float |
Unit: g |
acc_z |
20 |
float |
Unit: g |
Data Type 1
Single echo Cartesian coordinate data format:
Field |
Offset (bytes) |
Data Type |
Description |
---|---|---|---|
x |
0 |
int32_t |
X axis, Unit: mm |
y |
4 |
int32_t |
Y axis, Unit: mm |
z |
8 |
int32_t |
Z axis, Unit: mm |
Reflectivity |
12 |
uint8_t |
Reflectivity |
Tag |
13 |
uint8_t |
According to the point cloud frame header |
Data Type 2
Single echo Cartesian coordinate data format (16bit):
Field |
Offset (bytes) |
Data Type |
Description (10mm is the resolution in 16bit format) |
---|---|---|---|
x |
0 |
int16_t |
X axis, Unit: 10mm |
y |
2 |
int16_t |
Y axis, Unit: 10mm |
z |
4 |
int16_t |
Z axis, Unit: 10mm |
Reflectivity |
6 |
uint8_t |
Reflectivity |
Tag |
7 |
uint8_t |
According to the point cloud frame header |
Data Type 3
Single return spherical coordinate data format:
Field |
Offset (bytes) |
Data Type |
Description (10mm is the resolution in 16bit format) |
---|---|---|---|
depth |
0 |
uint32_t |
Depth, Unit: mm |
theta |
4 |
uint16_t |
Zenith angle[0, 18000], Unit: 0.01 degree |
phi |
6 |
uint16_t |
Azimuth[0, 36000], Unit: 0.01 degree |
Reflectivity |
8 |
uint8_t |
Reflectivity |
Tag |
9 |
uint8_t |
According to the point cloud frame header |
1.2.1.3.4. Tag Information
Tag mainly indicates other additional information of the detection point.The point cloud is marked as an 8bit unsigned integer, which is divided into several areas according to the bit, and each area represents an attribute of the detection point, including rain, fog, dust, adhesion point clouds between similar objects, etc.; Among them, the confidence level indicates the reliability of the detection point, and the normal point is generally 0 (High confidence); Low confidence indicates that the detection point is greatly affected by the corresponding attributes, and the reliability of the detection result is poor; if necessary, the point cloud can be filtered based on this information.Details are as follows:
Bit |
Description |
---|---|
bit 6~7 |
Reserved |
bit 4~5 |
Properties of Detection Points: other |
bit 2~3 |
Properties of Detection Points: Rain, fog, dust and other tiny particles |
bit 0~1 |
Properties of Detection Points: Glue point cloud between adjacent objects |
1.2.1.4. Control Command
1.2.1.4.1. Frame Format
Format of control command is as follows:
Field |
Offset(byte) |
Size (byte) |
Description |
---|---|---|---|
sof |
0 |
1 |
Starting byte, fixed to be 0xAA. |
version |
1 |
1 |
Protocol version, 0 for current version. |
length |
2 |
2 |
Length of frame; |
seq_num |
4 |
4 |
This field is incremented by 1 for each new REQ request message; |
cmd_id |
8 |
2 |
Different types of messages are distinguished by this field, For details, see 5 Return Code Description. |
cmd_type |
10 |
1 |
Command Type: |
sender_type |
11 |
1 |
The sender’s device type: |
resv |
12 |
6 |
Reserved. |
crc16 |
18 |
2 |
Frame header checksum, check data starts from sof to crc16 (not included), 18 bytes in total. For details, see 6 CRC Algorithm. |
crc32 |
20 |
4 |
Frame data checksum. For details, see 6 CRC Algorithm; |
data |
24 |
n |
4 CMD detials. |
1.2.1.4.2. Command ID
Command id list:
Function Type |
CMD ID |
Function |
---|---|---|
Device Type Query |
0x0000 |
Discovery by broadcasting |
LiDAR Information |
0x0100 |
Parameter information configuration |
0x0101 |
Inquire LiDAR information |
|
0x0102 |
Push LiDAR information |
|
Control CMD |
0x0200 |
Request reboot device |
0x0201 |
Restore factory settings |
|
0x0202 |
Set GPS timestamp |
|
General Uprade CMD |
0x0400 |
Request to start upgrade |
0x0401 |
Firmware data transfer |
|
0x0402 |
Firmware transfer complete |
|
0x0403 |
Get firmware upgrade status |
1.2.1.4.3. Communication Process
1.2.1.5. CMD Detials
1.2.1.5.1. Device Type Query
1.2.1.5.1.1. 0x0000 Discovery By Broadcasting
Request
CMD |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
NULL |
ACK
ACK |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code |
dev_type |
1 |
uint8_t |
LiDAR type |
|
serial_number |
2 |
uint8_t[16] |
LiDAR SN |
|
lidar_ip |
18 |
uint8_t[4] |
LiDAR IP address |
|
cmd_port |
22 |
uint16_t |
LiDAR command port |
1.2.1.5.2. LiDAR Information
1.2.1.5.2.1. 0x0100 Parameter Configuration
Request
CMD |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
key_num |
0 |
uint16_t |
Number of key in |
rsvd |
2 |
uint16_t |
Reserved |
|
key_value_list |
4 |
key_value_list[N] |
|
Format of each parameter in key_value_list
is as follows:
Data Field |
Offset(byte) |
Data Type |
Description |
---|---|---|---|
key |
0 |
uint16_t |
Key number, see table below |
length |
2 |
uint16_t |
Length of value to the key |
value |
4 |
– |
Value content to the key |
ACK
ACK |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code |
error_key |
1 |
uint16_t |
If the |
1.2.1.5.2.2. 0x0101 Parameter Inquire
Request
CMD |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
key_num |
0 |
uint16_t |
Number of key in |
rsvd |
2 |
uint16_t |
||
key_list |
4 |
– |
Key list |
The key type in the key_list
:
Data |
Offset(byte) |
Data Type |
Description |
---|---|---|---|
key |
0 |
uint16_t |
key number |
ACK
ACK |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return Code |
key_num |
1 |
uint16_t |
Number of key in |
|
key_value_list |
3 |
– |
Value of key |
1.2.1.5.2.3. 0x0102 LiDAR Information Push
LiDAR push Actively
CMD |
Name |
Offset(byte) |
Data Type |
Description |
---|---|---|---|---|
data |
key_num |
0 |
uint16_t |
Number of key in |
rsvd |
2 |
uint16_t |
||
key_value_list |
4 |
– |
Value of key |
Format of the key_value_list
:
Data Field |
Offset(byte) |
Data Type |
Description |
---|---|---|---|
key |
0 |
uint16_t |
key number, see table below |
length |
2 |
uint16_t |
Length of value to the key |
value |
4 |
– |
Value content to the key |
Specific meanings to key_value_list
are as follows:
Number(key) |
Name |
Length |
Type |
Content |
Support Parameter Information Configuration Command(cmd_id=0x0100) |
---|---|---|---|---|---|
0x0000 |
pcl_data_type |
1 |
uint8_t |
Type of point cloud data, For details, see[Data Types](2.3 Data Types) |
Yes |
0x0001 |
pattern_mode |
1 |
uint8_t |
Pattern mode |
Yes |
0x0004 |
lidar_ipcfg |
12 |
uint8_t[12] |
LiDAR IP address configuration |
Yes |
0x0005 |
state_info_host_ipcfg |
8 |
uint8_t[8] |
IP address configuration for pushing LiDAR status information |
Yes |
0x0006 |
pointcloud_host_ipcfg |
8 |
uint8_t[8] |
IP address configuration for pushing LiDAR point cloud data |
Yes |
0x0007 |
imu_host_ipcfg |
8 |
uint8_t[8] |
IP address configuration for pushing LiDAR IMU data |
Yes |
0x0012 |
install_attitude |
24 |
Installation location of LiDAR on user device. |
Yes |
|
0x0015 |
fov_cfg0 |
20 |
FOV configuration, if you do not need to use all the FOV, you can delineate an area (angle range) on the FOV sphere, the lidar only samples in this area, other areas do not work, you can configure two such areas independently, except for the configuration In addition to this parameter, the configuration needs to be enabled through fov_cfg_en; this is the configuration of the first working area, and its format is as follows: |
Yes |
|
0x0016 |
fov_cfg1 |
20 |
Same as fov_cfg0, this is the configuration of the second working area |
Yes |
|
0x0017 |
fov_cfg_en |
1 |
uint8_t |
Dividing the enable of different regions by bit |
Yes |
0x0018 |
detect_mode |
1 |
uint8_t |
Detect mode |
Yes |
0x0019 |
func_io_cfg |
4 |
uint8_t[4] |
Function IO configuration. Bytes 0-3 represent functions of IN0, NI1, OUT0, and OUT1 pins respectively, corresponding Mid-360 M12 pin numbers are 8, 10, 12, and 11. |
Yes |
0x001A |
work_tgt_mode |
1 |
uint8_t |
LiDAR target working mode, For details, see1.2 LiDAR Working Status |
Yes |
0x001C |
imu_data_en |
1 |
uint8_t |
0x00: Disable IMU data push |
Yes |
0x8000 |
sn |
16 |
uint8_t[16] |
String type(Use ‘\0’ padding for less than 16 bits) |
No |
0x8001 |
product_info |
64 |
char[64] |
String type(Use ‘\0’ padding for less than 32 bits) |
No |
0x8002 |
version_app |
4 |
uint8_t[4] |
App firmware version number: aa.bb.cc.dd |
No |
0x8003 |
version_loader |
4 |
uint8_t[4] |
Loader firmware version number |
No |
0x8004 |
version_hardware |
4 |
uint8_t[4] |
Hardware version number |
No |
0x8005 |
mac |
6 |
uint8_t[6] |
LiDAR MAC address: aa:bb:cc:dd:ee:ff |
No |
0x8006 |
cur_work_state |
1 |
uint8_t |
Current working state of LiDAR |
No |
0x8007 |
core_temp |
4 |
int32_t |
Core temperature(Unit: 0.01℃) |
No |
0x8008 |
powerup_cnt |
4 |
uint32_t |
Count of LiDAR powerup |
No |
0x8009 |
local_time_now |
8 |
uint64_t |
Local time of device |
No |
0x800A |
last_sync_time |
8 |
uint64_t |
Master time of last synchronization: |
No |
0x800B |
time_offset |
8 |
int64_t |
Time offset of current local time from synchronization source, unit: ns: |
No |
0x800C |
time_sync_type |
1 |
uint8_t |
Type of time synchronization |
No |
0x800E |
lidar_diag_status |
2 |
uint16_t |
LiDAR diag status code |
No |
0x8010 |
FW_TYPE |
1 |
uint8_t |
Firmware type: |
No |
0x8011 |
hms_code |
1 |
uint32_t[8] |
Diagnostic Trouble Code, Each non-0 value represents a piece of diagnostic information. When the radar does not work normally, the cause of the problem can be confirmed through the diagnostic code |
1.2.1.5.3. Control Command
1.2.1.5.3.1. 0x0200 Reboot Device
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
timeout |
0 |
uint16_t |
Reboot device delay time: ms |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
1.2.1.5.3.2. 0x0201 Restore Factory Settings
After this command is issued, the LiDAR will be restored to the factory settings. After the reply is successful, the LiDAR will reboot immediately.
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
SN |
0 |
uint8_t[16] |
Reserved |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
1.2.1.5.3.3. 0x0202 Set GPS Timestamp
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
type |
0 |
uint8_t |
Timestamp format |
time_set |
1 |
uint64_t |
If GPS synchronized, this field should be the time of the last rising edge of the PPS signal, the type is uint64_t, unit: ns |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
1.2.1.5.4. General Upgrade
1.2.1.5.4.1. 0x0400 Request to Start Upgrade
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
firmware_type |
0 |
uint8_t |
Firmware type: |
encrypt_type |
1 |
uint8_t |
Encrypt type: |
|
firmware_length |
2 |
uint32_t |
Firmware length |
|
dev_type |
6 |
uint8_t |
Device type |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
1.2.1.5.4.2. 0x0401 Firmware Data Transmit
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
firmware_offset |
0 |
uint32_t |
|
current_length |
4 |
uint32_t |
||
encrypt_type |
8 |
uint8_t |
||
rsvd |
9 |
uint8_t[3] |
||
data |
12 |
uint8_t[n] |
firmware data |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
current_offset |
1 |
uint32_t |
||
received_length |
5 |
uint32_t |
1.2.1.5.4.3. 0x0402 Firmware Transmit Complete
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
checksum_type |
0 |
uint8_t |
|
checksum_length |
1 |
uint8_t |
||
checksum_data |
2 |
uint8_t[n] |
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
1.2.1.5.4.4. 0x0403 Get Firmware Upgrade State
Request
CMD |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
NULL |
|||
ACK
ACK |
Name |
Offset (byte) |
Data Type |
Description |
---|---|---|---|---|
data |
ret_code |
0 |
uint8_t |
Return code: |
upgrade_progress |
1 |
uint8_t |
Upgrade progress: |
1.2.1.6. Return Code Description
Name |
Return Code |
Description |
---|---|---|
LVX_RET_SUCCESS |
0x00 |
Execution succeed |
LVX_RET_FAILURE |
0x01 |
Execution failed |
LVX_RET_NOT_PERMIT_NOW |
0x02 |
Current state does not support |
LVX_RET_OUT_OF_RANGE |
0x03 |
Setting value out of range |
LVX_RET_PARAM_NOTSUPPORT |
0x20 |
The parameter is not supported |
LVX_RET_PARAM_REBOOT_EFFECT |
0x21 |
Parameters need to reboot to take effect |
LVX_RET_PARAM_RD_ONLY |
0x22 |
The parameter is read-only and cannot be written |
LVX_RET_PARAM_INVALID_LEN |
0x23 |
The request parameter length is wrong, or the ack packet exceeds the maximum length |
LVX_RET_PARAM_KEY_NUM_ERR |
0x24 |
Parameter |
LVX_RET_UPGRADE_PUB_KEY_ERROR |
0x30 |
Public key signature verification error |
LVX_RET_UPGRADE_DIGEST_ERROR |
0x31 |
Digest check error |
LVX_RET_UPGRADE_FW_TYPE_ERROR |
0x32 |
Firmware type mismatch |
LVX_RET_UPGRADE_FW_OUT_OF_RANGE |
0x33 |
Firmware length out of range |
LVX_RET_UPGRADE_FW_ERASING |
0x34 |
Firmware erasing |
1.2.1.7. CRC Algorithm
CRC Name |
Polynomial Formula |
Width |
Polynomial |
Initial Value |
Result XOR value |
Input Reverse |
Output Reverse |
---|---|---|---|---|---|---|---|
CRC-16/CCITT-FALSE |
x^16^ + x^12^ + x^5^ + 1 |
16 |
0x1021 |
0xFFFF |
0x0000 |
false |
false |
CRC-32 |
x^32^ + x^26^ + x^23^ + x^22^ + x^16^ + x^12^ + x^11^ + x^10^ + x^8^ + x^7^ + x^5^ + x^4^ + x^2^ + x + 1 |
32 |
0x04C11DB7 |
0xFFFFFFFF |
0xFFFFFFFF |
true |
true |