feat:support AVIA and Mid-70
@@ -1,10 +1,16 @@
|
||||
# How to use lvx file in ros
|
||||
**How to use lvx file in ros**([在ROS驱动程序下使用lvx文件的方法](./zh/如何在ROS驱动程序下使用lvx文件.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
lvx is a point cloud storage format customized by livox; if you want to use lvx file in ros, you need to convert it to rosbag file.
|
||||
|
||||
## 1. Save lvx data file
|
||||
# 1. Save lvx data file
|
||||
|
||||
### 1.1 Use livox viewer to store lvx files
|
||||
## 1.1 Use livox viewer to store lvx files
|
||||
|
||||
The operation steps are as follows :
|
||||
|
||||
@@ -15,13 +21,13 @@ The operation steps are as follows :
|
||||
|
||||

|
||||
|
||||
### 1.2 Use Livox-SDK to store lvx files
|
||||
## 1.2 Use Livox-SDK to store lvx files
|
||||
|
||||
#### 1.2.1 Git clone Livox-SDK
|
||||
### 1.2.1 Git clone Livox-SDK
|
||||
|
||||
`git clone https://github.com/Livox-SDK/Livox-SDK.git`
|
||||
|
||||
#### 1.2.2 Connect Lidar device and save the lvx file
|
||||
### 1.2.2 Connect Lidar device and save the lvx file
|
||||
|
||||
- Open the terminal window under this file path: ../Livox_SDK/build/sample/lidar_lvx_file
|
||||
- Execute the follow command: ./lidar_lvx_sample
|
||||
@@ -34,23 +40,23 @@ The operation steps are as follows :
|
||||
|
||||

|
||||
|
||||
## 2. Convert Lvx data file(v1.0/v1.1)to rosbag file(Only supports Ubuntu System)
|
||||
# 2. Convert Lvx data file(v1.0/v1.1)to rosbag file(Only supports Ubuntu System)
|
||||
|
||||
### 2.1 Git clone livox_ros_driver
|
||||
## 2.1 Git clone livox_ros_driver
|
||||
|
||||
`git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src`
|
||||
|
||||
### 2.2 Set publish frequency
|
||||
## 2.2 Set publish frequency
|
||||
|
||||
If you need to convert rosbag data with the frequency to 10Hz, please set the ‘publish_freq’ parameter to 10.0 in "../ws_livox/src/livox_ros_driver/launch/lvx_to_rosbag.launch file". Similarly, you can set other frequencies.
|
||||
|
||||

|
||||
|
||||
### 2.3 Open a terminal window under this path
|
||||
## 2.3 Open a terminal window under this path
|
||||
|
||||
`../ws_livox`
|
||||
|
||||
### 2.4 Convert lvx point cloud data file (v1.0/v1.1) to rosbag file
|
||||
## 2.4 Convert lvx point cloud data file (v1.0/v1.1) to rosbag file
|
||||
|
||||
livox_ros_driver supports the conversion of lvx pointcloud data files to rosbag files. Use the command as follows :
|
||||
|
||||
@@ -62,6 +68,6 @@ After replacing "/home/livox/test.lvx" in the above command with the local lvx d
|
||||
|
||||

|
||||
|
||||
### 2.5 Playing the Rosbag data
|
||||
## 2.5 Playing the Rosbag data
|
||||
|
||||

|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
**Set publish frequency**([在ROS驱动程序中设置发布频率](./zh/在ROS驱动程序中设置发布频率.md))
|
||||
|
||||
# Set publish frequency
|
||||
|
||||
## 1. Git clone livox_ros_driver
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1. Git clone livox_ros_driver
|
||||
|
||||
`git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src`
|
||||
|
||||
## 2. Set publish frequency
|
||||
# 2. Set publish frequency
|
||||
|
||||
Take the conversion of lvx files to rosbag files as an example :
|
||||
|
||||
@@ -13,11 +18,11 @@ If you need to convert rosbag data with the frequency to 10Hz, please set the
|
||||
|
||||

|
||||
|
||||
## 3. Open a terminal window under this path
|
||||
# 3. Open a terminal window under this path
|
||||
|
||||
`../ws_livox`
|
||||
|
||||
## 4. Convert lvx point cloud data file (v1.0/v1.1) to rosbag file
|
||||
# 4. Convert lvx point cloud data file (v1.0/v1.1) to rosbag file
|
||||
|
||||
livox_ros_driver supports the conversion of lvx pointcloud data files to rosbag files. Use the command as follows :
|
||||
|
||||
@@ -29,6 +34,6 @@ After replacing "/home/livox/test.lvx" in the above command with the local lvx d
|
||||
|
||||

|
||||
|
||||
## 5. Playing the Rosbag data
|
||||
# 5. Playing the Rosbag data
|
||||
|
||||

|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
**The installation of Livox SDK on Linux 32-bit system and Mac**([在32位Linux系统和Mac系统中安装Livox SDK](./zh/在32位Linux系统和Mac系统中安装Livox SDK.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1 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.
|
||||
|
||||
@@ -46,7 +46,7 @@ Connect Livox LiDAR/Hub normally without additional wiring.
|
||||
|
||||
### 2.1.2 Attention
|
||||
|
||||
Network environments with multiple master clocks are not supported. For the construction of master clock, please refer to Appendix [3.1 Set Up PTP Master Clock](#Appendix).
|
||||
Network environments with multiple master clocks are not supported. For the construction of master clock, please refer to Appendix [3.1 Set Up PTP Master Clock](#3.1).
|
||||
|
||||
### 2.1.3 Accuracy
|
||||
|
||||
@@ -82,7 +82,7 @@ Remarks: If the data output by the GPS module is 485 level, the TTL to 485 modul
|
||||
|
||||
#### 2.2.2.2 Configuration
|
||||
|
||||
Mid firmware version: >= v03.07.0000, SDK version >= v2.1.0
|
||||
Mid firmware version: >= v03.07.0000, SDK version >= v2.0.0
|
||||
|
||||
**Use ROS driver**
|
||||
|
||||
@@ -178,49 +178,55 @@ LiDAR_time_last = LiDAR_time;
|
||||
|
||||
1 microsecond
|
||||
|
||||
# Appendix
|
||||
# 3 Appendix
|
||||
|
||||
## Set Up PTP Master Clock
|
||||
## 3.1 Set Up PTP Master Clock
|
||||
|
||||
Address: [http://linuxptp.sourceforge.net](http://linuxptp.sourceforge.net)
|
||||
Address: [https://github.com/ptpd/ptpd](https://github.com/ptpd/ptpd)
|
||||
|
||||
Download, compile and install:
|
||||
|
||||
```bash
|
||||
git clone http://git.code.sf.net/p/linuxptp/code linuxptp
|
||||
cd linuxptp
|
||||
git clone https://github.com/ptpd/ptpd.git
|
||||
autoreconf -vi
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
make install
|
||||
```
|
||||
|
||||
In order to run this software, you need Linux kernel version 3.0 or newer. Check whether your network interface supports PTP with the following command(example, network interface is 'eth0').
|
||||
Modify the configuration file client-e2e-socket.conf in the test folder according to your needs. You can use the following configuration:
|
||||
|
||||
```bash
|
||||
ethtool -T eth0
|
||||
Add a network interface name, such as eth0:
|
||||
|
||||
```
|
||||
; Network interface to use (required)
|
||||
ptpengine:interface = eth0
|
||||
```
|
||||
|
||||
This command shows whether a MAC supports hardware or software time stamping.
|
||||
Set the master clock function and set the parameters to masteronly:
|
||||
|
||||
The following example output indicates support for hardware time stamping.
|
||||
|
||||

|
||||
|
||||
The following example output indicates network interface not support for linuxptp/ptp4l, cannot be used.
|
||||
|
||||

|
||||
|
||||
If MAC supports hardware time stamping, then run the following command:
|
||||
|
||||
```bash
|
||||
sudo ptp4l -i eth0 -l 6 -m
|
||||
```
|
||||
; Options: none slaveonly masteronly masterslave
|
||||
ptpengine:preset = masteronly
|
||||
```
|
||||
|
||||
When a sync packet appears on the network, it indicates that the master clock of ptp4l is successfully turned on.
|
||||
Set clock_class to a value lower than 128:
|
||||
|
||||
Use the following command, PTP Hardware Clock is synchronized to system clock.
|
||||
```
|
||||
; Clock class - announced in master state. Always 255 for slave-only mode.
|
||||
; Minimum, maximum and default values are controlled by presets.
|
||||
; If set to 13 (application specific time source), announced
|
||||
; time scale is always set to ARB. This setting controls the
|
||||
; states a PTP port can be in. If below 128, port will only
|
||||
; be in MASTER or PASSIVE states (master only). If above 127,
|
||||
; port will be in MASTER or SLAVE states.
|
||||
ptpengine:clock_class = 126
|
||||
```
|
||||
|
||||
`phc2sys` usage: http://manpages.ubuntu.com/manpages/cosmic/man8/phc2sys.8.html
|
||||
Then run the following command:
|
||||
|
||||
```bash
|
||||
sudo phc2sys -c eth0 -s CLOCK_REALTIME -O 0
|
||||
```
|
||||
ptpd2 -c test/client-e2e-socket.conf
|
||||
```
|
||||
|
||||
When a sync packet appears on the network, it indicates that the master clock of ptpd is successfully turned on.
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 333 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,342 @@
|
||||
|
||||
|
||||
**Livox device time synchronization**([livox设备时间同步说明中文文档](./livox设备时间同步说明.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1 Time synchronization instructions
|
||||
|
||||
Livox devices support 3 time synchronization methods:
|
||||
|
||||
PTP: IEEE 1588v2.0 PTP network protocol synchronization;
|
||||
|
||||
GPS: Pulse per second + GPRMC time data, forming a GPS time synchronization method;
|
||||
|
||||
PPS: Pulse synchronization per second, requires the upper application program to obtain the time information of each pulse through other channels (such as uart) and correct the point cloud time. At present, only LiDAR supports this synchronization method, and because the usage is relatively complicated, it is not recommended for users to use this method for LiDAR time synchronization.
|
||||
|
||||
Synchronization methods supported by different devices:
|
||||
|
||||
| Devices | Supported synchronization method |
|
||||
| ----------- | ------------------------------------------- |
|
||||
| Livox LiDAR | 1. PTP v2<br>2. GPS<br>3. PPS(not recommanded) |
|
||||
| Livox Hub | 1. PTP v2<br>2. GPS |
|
||||
|
||||
|
||||
|
||||
## 1.1 Synchronization principle
|
||||
|
||||
### 1.1.1 PTP time synchronization principle
|
||||
|
||||
The synchronization process uses the Delay request-response mechanism (two steps) of IEEE 1588v2.0 PTP. The Livox device acts as the slave and synchronizes the PTP time with the master clock device.
|
||||
|
||||

|
||||
|
||||
The master and slave clocks obtain the t1, t2, t3, and t4 time through the interaction of Sync, Follow_Up, Delay_Req, Delay_Resp these data packets, and the transmission path delay and the offset of the two clocks are calculated as follows:
|
||||
|
||||
Transmission path delay: Delay = [(t4 – t1) – (t3 – t2)]/2
|
||||
|
||||
Time offset: Offset = (t2 - t1) - Delay = [(t2 – t1) + (t3 – t4)]/2
|
||||
|
||||
### 1.1.2 GPS time synchronization principle
|
||||
|
||||
The PPS port of the GPS clock source sends a hardware pulse (PPS signal) once per second, and then the data port sends the time information corresponding to the rising edge of this pulse (GPRMC format) once.
|
||||
|
||||
After the Livox device receives the rising edge of the PPS signal and parses the correct time information from the GPRMC data, it will set the point cloud time as the GPS time, and keep this time reference for continuous accumulation to achieve time synchronization with the GPS device.
|
||||
|
||||
- Livox Hub can directly receive RS485 level GPRMC signal;
|
||||
|
||||
- Livox LiDAR cannot directly receive GPRMC signals, it needs to connect the GPRMC data port to the PC, and then send it to the radar through the SDK protocol;
|
||||
|
||||

|
||||
|
||||
The timing requirements of PPS signal and GPRMC signal:
|
||||
|
||||
| Time | Description | Effective Range | Recommended Value |
|
||||
| ---- | --------------------------------------- | ---------------- | -------------- |
|
||||
| t0 | Interval between rising edges of adjacent twice second pulse | 900 ms ~ 1100 ms | 1000 ms |
|
||||
| t1 | High level time of each second pulse | 5 ms ~ 900 ms | 10 ms ~ 200 ms |
|
||||
| t2 | GGPRMC transmission time (baud rate: 9600bps) | ≈ 70 ms | 70 ms |
|
||||
| t3 | The delay of GPRMC data transmission relative to the rising edge of the pulse | 0 ms ~ 900 ms | 0 ms ~ 430 ms |
|
||||
|
||||
|
||||
|
||||
## 1.2 Application scenario
|
||||
|
||||
**PTP:**
|
||||
|
||||
In the absence of GPS and PPS hardware signals, PTP v2 can be used for time synchronization between Livox LiDAR/Hub and other devices. This method requires minimal external hardware support, and only requires a master clock device in the entire network.
|
||||
|
||||
**GPS:**
|
||||
|
||||
This synchronization method can be used when Livox Hub is connected to multiple LiDARs. Livox Hub needs to be connected to the PPS signal of the GPS receiver and the time signal in GPRMC format. At this time, the LiDAR point cloud time will be automatically corrected to the GPS time.
|
||||
|
||||
Livox LiDAR can also use GPS synchronization, but it needs to connect the GPRMC signal to the PC, and then send the time data to the LiDAR through the SDK protocol.
|
||||
|
||||
# 2 Instructions of use
|
||||
|
||||
## 2.1 PTP
|
||||
|
||||
When Livox LiDAR or Hub is connected to a network with a ptp master clock, the device will automatically synchronize its time to the master clock.
|
||||
|
||||
### 2.1.1 Configuration and use
|
||||
|
||||
**Step one: Check whether the master clock in the network is normal**
|
||||
|
||||
For the method of configuring the master clock on the PC, please refer to the appendix [Configuring the PTP master clock](#Appendix);
|
||||
|
||||
If there are datas of Sync and Follow_Up in the network, it means that the PTP master clock source is working normally:
|
||||
|
||||

|
||||
|
||||
**Step 2: Connect Livox LiDAR/Hub**
|
||||
|
||||
Livox LiDAR/Hub can be connected normally through the network cable, no additional wiring is required.
|
||||
|
||||
**Step 3: How to check the device is using PTP 1588 synchronization**
|
||||
|
||||
1、By checking the timestamp_type data in the point cloud data packet header, the point cloud data protocol: https://github.com/Livox-SDK/Livox-SDK/wiki/Livox-SDK-Communication-Protocol
|
||||
|
||||
If timestamp_type is 1, it means that the device is performing PTP time synchronization:
|
||||
|
||||
| timestamp_type | data_type | timestamp type |
|
||||
| -------------- | --------- | ---------- |
|
||||
| 1 | uint64_t | Nanosecond(ns) |
|
||||
|
||||
2、Or check the Settings option in the Livox Viewer host computer, the Sync State in the figure below indicates that the Hub is using ptp 1588 synchronization.
|
||||
|
||||

|
||||
|
||||
### 2.1.2 Precautions
|
||||
|
||||
- PTP synchronization has the highest priority. When PTP, PPS or GPS are available at the same time, PTP network synchronization will be selected priority;
|
||||
- Does not support network environments with multiple master clocks;
|
||||
- Hundred nanoseconds accuracy;
|
||||
|
||||
## 2.2 GPS
|
||||
|
||||
In order to be compatible with LiDAR hardware from other manufacturers, Livox devices also support GPS time synchronization.
|
||||
|
||||
Since Livox has different types of hardware (LiDAR/Hub), when using GPS synchronization, the hardware interfaces can be divided into 3 categories:
|
||||
|
||||
1. Use Livox Hub;
|
||||
2. LiDAR connected with Livox Converter 1.0 (such as Mid-40, Mid-100);
|
||||
3. LiDAR connected with Livox Converter 2.0 (such as Tele-15, Horizon);
|
||||
|
||||
The following will introduce how to use these three interfaces to synchronize GPS time.
|
||||
|
||||
### 2.2.1 Configuration and use
|
||||
|
||||
#### 2.2.1.1 Livox Hub
|
||||
|
||||
##### Hardware connection
|
||||
|
||||
If the GPS module's time signal and PPS signal are both RS485 level, directly connect the line to the GPS time synchronization port (GPS sync port) of Hub.
|
||||
|
||||
If the time signal of the GPS module and the PPS signal are both TTL level, the following level conversion is required before the signal can be connected to the GPS time synchronization port of Hub (GPS sync port).
|
||||
|
||||

|
||||
|
||||
Remarks:
|
||||
|
||||
When the Hub uses GPS synchronization, there is no need to configure the SDK software.
|
||||
|
||||
#### 2.2.1.2 Livox Converter 1.0
|
||||
|
||||
Currently, the default devices using Livox Converter 1.0 include:
|
||||
|
||||
1. Mid-40
|
||||
2. Mid-100
|
||||
|
||||
##### Hardware connection
|
||||
|
||||
Connect the GPS module's time signal (GPRMC) to the PC through the TTL-to-usb module, and connect the PPS signal to the Sync Port of the LiDAR adapter box.
|
||||
|
||||

|
||||
|
||||
If the PPS output by the GPS module is an RS485 level signal, the TTL to 485 module can be omitted in the above figure.
|
||||
|
||||
##### Software configuration
|
||||
|
||||
Since the PC needs to receive the GPRMC data and then send it to LiDAR through the SDK protocol, the product firmware version has the following requirements:
|
||||
|
||||
- Mid firmware version: >= **v03.07.0000**
|
||||
- SDK version >= **v2.1.0**
|
||||
|
||||
**When using ROS driver**
|
||||
|
||||
1. Connect the hardware correctly according to the above introduction;
|
||||
|
||||
2. Check the port name of the usb module connected to the PC, such as `/dev/ttyUSB0`,add to the "device_name" of the "timesync_config" in the file [livox_lidar_config.json](https://github.com/Livox-SDK/livox_ros_driver/blob/master/livox_ros_driver/config/livox_lidar_config.json) ,and then configure "enable_timesync" to 'true',the baud rate "baudrate_index" can be set to specific value referring to https://github.com/Livox-SDK/livox_ros_driver ;
|
||||
|
||||
```
|
||||
"timesync_config": {
|
||||
"enable_timesync": true,
|
||||
"device_name": "/dev/ttyUSB0",
|
||||
"comm_device_type": 0,
|
||||
"baudrate_index": 2,
|
||||
"parity_index": 0
|
||||
```
|
||||
|
||||
3. Run launch file;
|
||||
|
||||
**When using SDK only**
|
||||
|
||||
The following link is a program for receiving and analyzing GPRMC data and sending it to LiDAR through the SDK protocol:
|
||||
|
||||
[https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync](https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync)
|
||||
|
||||
#### 2.2.1.3 Livox Converter 2.0
|
||||
|
||||
Currently, the standard equipments using Livox Converter 2.0 in the box include:
|
||||
|
||||
1. Horizon
|
||||
2. Tele-15
|
||||
|
||||
##### Hardware connection
|
||||
|
||||
Connect the GPS module's time signal (GPRMC) to the PC through the TTL-to-usb module, and connect the PPS signal to the Sync Port of the LiDAR adapter box.
|
||||
|
||||

|
||||
|
||||
##### Software configuration
|
||||
|
||||
Since the PC needs to receive the GPRMC data and then send it to LiDAR through the SDK protocol, the product firmware version has the following requirements:
|
||||
|
||||
- Horizon firmware version: >= **v06.06.0000**
|
||||
- Tele-15 firmware version: >= **v07.09.0000**
|
||||
- SDK version >= **v2.1.0**
|
||||
|
||||
**When using ROS driver**
|
||||
|
||||
1. Connect the hardware correctly according to the above introductions;
|
||||
|
||||
2. Check the port name of the usb module connected to the PC, such as `/dev/ttyUSB0`, add to the "device_name" of "timesync_config" in the file [livox_lidar_config.json](https://github.com/Livox-SDK/livox_ros_driver/blob/master/livox_ros_driver/config/livox_lidar_config.json) ,and then set "enable_timesync" to 'true',baud rate "baudrate_index" can be set to specific value referring to https://github.com/Livox-SDK/livox_ros_driver ;
|
||||
|
||||
```
|
||||
"timesync_config": {
|
||||
"enable_timesync": true,
|
||||
"device_name": "/dev/ttyUSB0",
|
||||
"comm_device_type": 0,
|
||||
"baudrate_index": 2,
|
||||
"parity_index": 0
|
||||
```
|
||||
|
||||
3. Run launch file;
|
||||
|
||||
**Using SDK only**
|
||||
|
||||
The following link is a program for receiving and analyzing GPRMC data and sending it to LiDAR through the SDK protocol:
|
||||
|
||||
[https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync](https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync)
|
||||
|
||||
### 2.2.3 Status check
|
||||
|
||||
1. By viewing the timestamp_type data in the point cloud data packet header, the point cloud data protocol: https://github.com/Livox-SDK/Livox-SDK/wiki/Livox-SDK-Communication-Protocol
|
||||
|
||||
If timestamp_type is 3, it means that the device is in GPS time synchronization:
|
||||
|
||||
| timestamp_type | data_type | time type |
|
||||
| -------------- | -------------- | ----------- |
|
||||
| 3 | UTC(8 Bytes) | UTC time format |
|
||||
|
||||
UTC time format:
|
||||
|
||||

|
||||
|
||||
2. Or in the Livox Viewer host computer, check the Settings option, the Sync State in the figure below indicates that the Hub is using GPS synchronization.
|
||||
|
||||

|
||||
|
||||
|
||||
### 2.2.3 Precautions
|
||||
|
||||
- Normally, the GPS module can output the PPS signal and time signal normally after receiving the GPS signal. When in use, you need to ensure that the GPS signal is stable;
|
||||
- Currently the time signal only supports the two formats: GPRMC and GNRMC;
|
||||
- 1 us level accuracy
|
||||
|
||||
## 2.3 PPS
|
||||
|
||||
**Due to the complexity of this usage, users are not recommended to use this synchronization method**
|
||||
|
||||
Every time Livox LiDAR receives the rising edge of the PPS signal, it will set the point cloud time at the current moment to 0, and then restart timing until the next PPS pulse arrives. We can use this feature to realize the synchronization of the PPS pulse to the LiDAR time.
|
||||
|
||||
The following is the pseudo code to implement this process:
|
||||
|
||||
```c
|
||||
// PPS Time Synchronization
|
||||
static uint64_t lidar_time_last;
|
||||
static uint64_t lidar_time_real;
|
||||
|
||||
// 1. Read the PPS rising edge time, Unit is nanosecond.
|
||||
uint64_t pps_time_ns = get_pps_rising_nsecond();
|
||||
// 2. Read LiDAR point time, Unit is nanosecond.
|
||||
uint64_t lidar_time = get_lidar_pack_time();
|
||||
// 3. Update real time.
|
||||
if (lidar_time < lidar_time_last)
|
||||
{
|
||||
//LiDAR time jump indicates the generation of PPS rising edge.
|
||||
lidar_time_real = pps_time_ns + lidar_time%(1000000000);
|
||||
}
|
||||
else
|
||||
{
|
||||
lidar_time_real += lidar_time - lidar_time_last;
|
||||
}
|
||||
//Update history
|
||||
lidar_time_last = lidar_time;
|
||||
```
|
||||
|
||||
Remarks:
|
||||
|
||||
Users need to obtain the time information of the rising edge of the PPS through other methods, corresponding to the get_pps_rising_nsecond() interface in the above code.
|
||||
|
||||
|
||||
# Appendix
|
||||
|
||||
## Configure PTP master clock
|
||||
|
||||
Address: [http://linuxptp.sourceforge.net](http://linuxptp.sourceforge.net)
|
||||
|
||||
Download, compile and install:
|
||||
|
||||
```bash
|
||||
git clone http://git.code.sf.net/p/linuxptp/code linuxptp
|
||||
cd linuxptp
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
If you want ptp4l to work normally, you need the system's Linux kernel version 3.0 or later. Use the following command to check whether the network card supports the software/hardware timestamp function (for example: query the status of the network card'eth0').
|
||||
|
||||
```bash
|
||||
ethtool -T eth0
|
||||
```
|
||||
|
||||
In the example below, it shows that the eth0 network card supports hardware time stamping.
|
||||
|
||||

|
||||
|
||||
In the example below, the wlan0 network card does not support hardware and software timestamps, linuxptp/ptp4l cannot work normally.
|
||||
|
||||

|
||||
|
||||
Run the following command to enable the master clock function of ptp4l:
|
||||
|
||||
```bash
|
||||
sudo ptp4l -i eth0 -l 6 -m
|
||||
```
|
||||
|
||||
If the `Sync Message` data appears in the network, it means that the master clock function of the ptp4l program is operating normally:
|
||||
|
||||

|
||||
You can also use the following command to make sure that PTP hardware clock is synchronized to system clock:
|
||||
|
||||
For more details of the usage, please refer to the [phc2sys link](http://manpages.ubuntu.com/manpages/cosmic/man8/phc2sys.8.html)
|
||||
|
||||
```bash
|
||||
sudo phc2sys -c eth0 -s CLOCK_REALTIME -O 0
|
||||
```
|
||||
After completing the above steps, the LiDAR time and the PC system time can be synchronized through ptp4l.
|
||||
@@ -0,0 +1,341 @@
|
||||
|
||||
|
||||
**Livox设备时间同步**([livox device time synchronization manual](./livox device time synchronization manual.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1 时间同步说明
|
||||
|
||||
Livox设备支持3种时间同步方式:
|
||||
|
||||
PTP:IEEE 1588v2.0 PTP 网络协议同步;
|
||||
|
||||
GPS:秒脉冲+GPRMC时间数据,组成GPS时间同步方式;
|
||||
|
||||
PPS:秒脉冲同步,需要上层应用程序通过其他途径(如:uart)获取每个脉冲的时间信息,并修正点云时间。目前仅LiDAR支持这种同步方式,且由于用法较为复杂,不推荐用户使用这种方式进行LiDAR时间的同步。
|
||||
|
||||
不同设备支持的同步方式:
|
||||
|
||||
| 设备 | 支持的同步方式 |
|
||||
| ----------- | ------------------------------------------- |
|
||||
| Livox LiDAR | 1. PTP v2<br>2. GPS<br>3. PPS(不推荐使用) |
|
||||
| Livox Hub | 1. PTP v2<br>2. GPS |
|
||||
|
||||
|
||||
|
||||
## 1.1 同步原理
|
||||
|
||||
### 1.1.1 PTP时间同步原理
|
||||
|
||||
同步过程使用IEEE 1588v2.0 PTP的Delay request-response机制(two steps),Livox设备作为slave端,和master时钟设备进行ptp时间同步。
|
||||
|
||||

|
||||
|
||||
master和slave时钟通过Sync、Follow_Up、Delay_Req、Delay_Resp这几个数据包的交互,得到t1、t2、t3、t4时间,通过如下计算得到传输路径延迟和两时钟的偏移:
|
||||
|
||||
传输路径延时:Delay = [(t4 – t1) – (t3 – t2)]/2
|
||||
|
||||
时间偏移:Offset = (t2 - t1) - Delay = [(t2 – t1) + (t3 – t4)]/2
|
||||
|
||||
### 1.1.2 GPS时间同步原理
|
||||
|
||||
GPS时钟源的PPS端口每秒发送一次硬件脉冲(PPS信号),随后数据端口发送一次对应这个脉冲上升沿的时间信息(GPRMC格式)。
|
||||
|
||||
Livox设备接收到PPS信号上升沿,并由GPRMC数据解析出正确的时间信息后,会设置点云时间为GPS时间,并保持此时间基准持续累加,来实现和GPS设备的时间同步。
|
||||
|
||||
- Livox Hub可以直接接收RS485电平的GPRMC信号;
|
||||
|
||||
- Livox LiDAR无法直接接收GPRMC信号,需要将GPRMC数据端口接入PC,然后通过sdk协议发送给雷达;
|
||||
|
||||

|
||||
|
||||
PPS信号和GPRMC信号的时序要求:
|
||||
|
||||
| 时间 | 描述 | 有效范围 | 推荐值 |
|
||||
| ---- | --------------------------------------- | ---------------- | -------------- |
|
||||
| t0 | 相邻两次秒脉冲上升沿的间隔 | 900 ms ~ 1100 ms | 1000 ms |
|
||||
| t1 | 秒脉冲的高电平时间 | 5 ms ~ 900 ms | 10 ms ~ 200 ms |
|
||||
| t2 | GPRMC的传输时间(波特率:9600bps) | ≈ 70 ms | 70 ms |
|
||||
| t3 | GPRMC数据开始发送相对于脉冲上升沿的延迟 | 0 ms ~ 900 ms | 0 ms ~ 430 ms |
|
||||
|
||||
|
||||
|
||||
## 1.2 应用场景
|
||||
|
||||
**PTP:**
|
||||
|
||||
在没有GPS和PPS硬件信号的情况下,PTP v2可用于Livox LiDAR/Hub和其他设备之间的时间同步。这种方法所需要的外部硬件支持最少,只需要在整个网络中有一个master时钟设备即可。
|
||||
|
||||
**GPS:**
|
||||
|
||||
Livox Hub接入多个LiDAR时可以使用这种同步方式,Livox Hub需要接入GPS接收器的PPS信号,以及GPRMC格式的时间信号,此时LiDAR点云时间会自动修正成GPS时间。
|
||||
|
||||
Livox LiDAR也可以使用GPS同步,但需要将GPRMC信号接入PC,然后通过SDK协议将时间数据发送给LiDAR。
|
||||
|
||||
# 2 使用方法
|
||||
|
||||
## 2.1 PTP
|
||||
|
||||
当Livox LiDAR或者Hub连接到有ptp master时钟的网络中时,设备会自动同步自己的时间到主时钟。
|
||||
|
||||
### 2.1.1 配置和使用
|
||||
|
||||
**第一步:检查网络中的master时钟是否正常:**
|
||||
|
||||
PC上配置主时钟的方法可参考附录 [配置PTP主时钟](#附录);
|
||||
|
||||
如果网络中有Sync、Follow_Up这两个数据,则说明存在PTP master时钟源,且正常工作:
|
||||
|
||||

|
||||
|
||||
**第二步:连接Livox LiDAR/Hub**
|
||||
|
||||
通过网线正常连接Livox LiDAR/Hub即可,无需额外接线。
|
||||
|
||||
**第三步:如何查看设备在使用PTP 1588同步**
|
||||
|
||||
1、通过查看点云数据包头中的timestamp_type数据,点云数据协议:https://github.com/Livox-SDK/Livox-SDK/wiki/Livox-SDK-Communication-Protocol
|
||||
|
||||
如果timestamp_type为1,则说明设备正在进行PTP时间同步:
|
||||
|
||||
| timestamp_type | data_type | 时间类型 |
|
||||
| -------------- | --------- | ---------- |
|
||||
| 1 | uint64_t | 纳秒(ns) |
|
||||
|
||||
2、或者在Livox Viewer上位机中,查看Settings选项,下图的Sync State表明Hub在使用ptp 1588同步。
|
||||
|
||||

|
||||
|
||||
### 2.1.2 注意事项
|
||||
|
||||
- PTP同步优先级最高,当PTP、PPS或GPS同时可用时,会优先使用PTP网络同步;
|
||||
- 不支持具有多个主时钟的网络环境;
|
||||
- 百纳秒精度;
|
||||
|
||||
## 2.2 GPS
|
||||
|
||||
为了兼容其他厂商的LiDAR硬件,Livox设备也支持GPS时间同步。
|
||||
|
||||
由于Livox有不同种类的硬件(LiDAR/Hub),在使用GPS同步时,可以将硬件接口分为3类:
|
||||
|
||||
1. 使用Livox Hub;
|
||||
2. 使用Livox Converter 1.0连接的LiDAR(如:Mid-40、Mid-100);
|
||||
3. 使用Livox Converter 2.0连接的LiDAR(如:Tele-15、Horizon);
|
||||
|
||||
下面将分别介绍如何使用这3种接口进行GPS时间同步。
|
||||
|
||||
### 2.2.1 配置和使用
|
||||
|
||||
#### 2.2.1.1 Livox Hub
|
||||
|
||||
##### 硬件连接
|
||||
|
||||
如果GPS模块的时间信号和PPS信号是RS485电平,直接将线接入Hub的GPS时间同步口(GPS sync port)即可。
|
||||
|
||||
如果GPS模块的时间信号和PPS信号是TTL电平,则需要进行如下的电平转换后,才能将信号接入Hub的GPS时间同步口(GPS sync port)。
|
||||
|
||||

|
||||
|
||||
备注:
|
||||
|
||||
Hub使用GPS同步时,不需要进行SDK软件的配置。
|
||||
|
||||
#### 2.2.1.2 Livox Converter 1.0
|
||||
|
||||
目前默认使用Livox Converter 1.0的设备有:
|
||||
|
||||
1. Mid-40
|
||||
2. Mid-100
|
||||
|
||||
##### 硬件连接
|
||||
|
||||
将GPS模块的时间信号(GPRMC)通过TTL转usb模块接入PC,PPS信号接入LiDAR转接盒同步口(Sync Port)。
|
||||
|
||||
如果GPS模块输出的PPS为RS485电平的信号,则上图可以省略TTL转485模块。
|
||||
|
||||
##### 软件配置
|
||||
|
||||
由于需要PC接收GPRMC数据,然后通过SDK协议发送给LiDAR,对产品的固件版本有如下要求:
|
||||
|
||||
- Mid firmware version: >= **v03.07.0000**
|
||||
- SDK version >= **v2.1.0**
|
||||
|
||||
**使用ROS driver的情况**
|
||||
|
||||
1、按照上面的介绍正确连接硬件;
|
||||
|
||||
2、查看接入PC的usb模块的端口名称,例如 `/dev/ttyUSB0`,添加到 [livox_lidar_config.json](https://github.com/Livox-SDK/livox_ros_driver/blob/master/livox_ros_driver/config/livox_lidar_config.json) 文件中"timesync_config"的"device_name",然后将"enable_timesync"配置为 `true`,波特率"baudrate_index"可以参考 https://github.com/Livox-SDK/livox_ros_driver 来配置具体数值;
|
||||
|
||||
```
|
||||
"timesync_config": {
|
||||
"enable_timesync": true,
|
||||
"device_name": "/dev/ttyUSB0",
|
||||
"comm_device_type": 0,
|
||||
"baudrate_index": 2,
|
||||
"parity_index": 0
|
||||
```
|
||||
|
||||
3、运行launch file;
|
||||
|
||||
**只使用SDK的情况 **
|
||||
|
||||
下面的链接是实现GPRMC数据接收和解析,并通过SDK协议发送给LiDAR的程序:
|
||||
|
||||
[https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync](https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync)
|
||||
|
||||
#### 2.2.1.3 Livox Converter 2.0
|
||||
|
||||
目前包装盒中标配使用Livox Converter 2.0的设备有:
|
||||
|
||||
1. Horizon
|
||||
2. Tele-15
|
||||
|
||||
##### 硬件连接
|
||||
|
||||
将GPS模块的时间信号(GPRMC)通过TTL转usb模块接入PC,PPS信号接入LiDAR转接盒同步口(Sync Port)。
|
||||
|
||||

|
||||
|
||||
##### 软件配置
|
||||
|
||||
由于需要PC接收GPRMC数据,然后通过SDK协议发送给LiDAR,对产品的固件版本有如下要求:
|
||||
|
||||
- Horizon firmware version: >= **v06.06.0000**
|
||||
- Tele-15 firmware version: >= **v07.09.0000**
|
||||
- SDK version >= **v2.1.0**
|
||||
|
||||
**使用ROS driver的情况**
|
||||
|
||||
1、按照上面的介绍正确连接硬件;
|
||||
|
||||
2、查看接入PC的usb模块的端口名称,例如 `/dev/ttyUSB0`,添加到 [livox_lidar_config.json](https://github.com/Livox-SDK/livox_ros_driver/blob/master/livox_ros_driver/config/livox_lidar_config.json) 文件中"timesync_config"的"device_name",然后将"enable_timesync"配置为 `true`,波特率"baudrate_index"可以参考 https://github.com/Livox-SDK/livox_ros_driver 来配置具体数值;
|
||||
|
||||
```
|
||||
"timesync_config": {
|
||||
"enable_timesync": true,
|
||||
"device_name": "/dev/ttyUSB0",
|
||||
"comm_device_type": 0,
|
||||
"baudrate_index": 2,
|
||||
"parity_index": 0
|
||||
```
|
||||
|
||||
3、运行launch file;
|
||||
|
||||
**只使用SDK的情况 **
|
||||
|
||||
下面的链接是实现GPRMC数据接收和解析,并通过SDK协议发送给LiDAR的程序:
|
||||
|
||||
[https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync](https://github.com/Livox-SDK/Livox-SDK/tree/master/sample_cc/lidar_utc_sync)
|
||||
|
||||
### 2.2.3 状态检查
|
||||
|
||||
1、通过查看点云数据包头中的timestamp_type数据,点云数据协议:https://github.com/Livox-SDK/Livox-SDK/wiki/Livox-SDK-Communication-Protocol
|
||||
|
||||
如果timestamp_type为3,则说明设备正在进行GPS时间同步:
|
||||
|
||||
| timestamp_type | data_type | 时间类型 |
|
||||
| -------------- | -------------- | ----------- |
|
||||
| 3 | UTC(8 Bytes) | UTC时间格式 |
|
||||
|
||||
UTC时间格式:
|
||||
|
||||

|
||||
|
||||
2、或者在Livox Viewer上位机中,查看Settings选项,下图的Sync State表明Hub在使用GPS同步。
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
### 2.2.3 注意事项
|
||||
|
||||
- 通常情况下,GPS模块接收到GPS信号,才能正常输出PPS信号和时间信号。在使用时,需要确保GPS信号是稳定的;
|
||||
- 目前时间信号只支持GPRMC/GNRMC这两种格式;
|
||||
- 1 us级别精度
|
||||
|
||||
## 2.3 PPS
|
||||
|
||||
**由于这个用法较为复杂,不建议用户使用这种同步方式**
|
||||
|
||||
Livox LiDAR每次接收到PPS信号的上升沿后,会将当前时刻的点云时间置为0,然后重新开始计时直到下一个PPS脉冲到来。我们可以利用这个特性,来实现PPS脉冲对LiDAR时间的同步。
|
||||
|
||||
下面是实现这个流程的伪代码:
|
||||
|
||||
```c
|
||||
// PPS Time Synchronization
|
||||
static uint64_t lidar_time_last;
|
||||
static uint64_t lidar_time_real;
|
||||
|
||||
// 1. Read the PPS rising edge time, Unit is nanosecond.
|
||||
uint64_t pps_time_ns = get_pps_rising_nsecond();
|
||||
// 2. Read LiDAR point time, Unit is nanosecond.
|
||||
uint64_t lidar_time = get_lidar_pack_time();
|
||||
// 3. Update real time.
|
||||
if (lidar_time < lidar_time_last)
|
||||
{
|
||||
//LiDAR time jump indicates the generation of PPS rising edge.
|
||||
lidar_time_real = pps_time_ns + lidar_time%(1000000000);
|
||||
}
|
||||
else
|
||||
{
|
||||
lidar_time_real += lidar_time - lidar_time_last;
|
||||
}
|
||||
//Update history
|
||||
lidar_time_last = lidar_time;
|
||||
```
|
||||
|
||||
备注:
|
||||
|
||||
用戶需要通过其他方式获得PPS上升沿的时间信息,对应上述代码中的get_pps_rising_nsecond()接口。
|
||||
|
||||
# 附录
|
||||
|
||||
## 配置PTP主时钟
|
||||
|
||||
地址:[http://linuxptp.sourceforge.net](http://linuxptp.sourceforge.net)
|
||||
|
||||
下载,编译和安装:
|
||||
|
||||
```bash
|
||||
git clone http://git.code.sf.net/p/linuxptp/code linuxptp
|
||||
cd linuxptp
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
如果要让ptp4l正常工作,需要系统的Linux kernel version 3.0或者更新版本。通过下面的指令来检查网卡是否支持软件/硬件时间戳功能(如:查询网卡 'eth0' 的状态)。
|
||||
|
||||
```bash
|
||||
ethtool -T eth0
|
||||
```
|
||||
|
||||
下图的例子中,表明eth0网卡支持硬件时间戳。
|
||||
|
||||

|
||||
|
||||
下图的例子中wlan0网卡不支持硬件和软件时间戳,linuxptp/ptp4l不能正常工作。
|
||||
|
||||

|
||||
|
||||
运行如下指令,开启ptp4l的master时钟功能:
|
||||
|
||||
```bash
|
||||
sudo ptp4l -i eth0 -l 6 -m
|
||||
```
|
||||
|
||||
如果网络中出现 `Sync Message` 数据,说明ptp4l程序的master时钟功能正常运行:
|
||||
|
||||

|
||||
|
||||
可以使用如下命令让系统时间和PTP硬件时钟同步:
|
||||
|
||||
如果需要更多相关的信息, 请参考 [phc2sys 链接](http://manpages.ubuntu.com/manpages/cosmic/man8/phc2sys.8.html)
|
||||
|
||||
```bash
|
||||
sudo phc2sys -c eth0 -s CLOCK_REALTIME -O 0
|
||||
```
|
||||
完成以上步骤,即可通过ptp4l实现雷达时间和PC本地系统时间的同步。
|
||||
@@ -0,0 +1,97 @@
|
||||
**在32位Linux系统和Mac系统中安装Livox SDK**([The installation of Livox SDK on Linux 32-bit system and Mac](../The-installation-of-Livox-SDK-on-Linux-32-bit-system-and-Mac.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1. Livox SDK API
|
||||
|
||||
Livox SDK API 提供了一种C语言样式的函数,方便集成到C/C++程序中。如需更多信息,请查阅[Livox SDK API Reference](https://livox-sdk.github.io/Livox-SDK/)。
|
||||
|
||||
## 1.1 安装
|
||||
|
||||
下面以在Ubuntu 16.04/14.04 32-bit和Mac系统中安装过程为例。
|
||||
|
||||
### 1.1.1 Ubuntu 16.04/14.04 32-bit LTS
|
||||
|
||||
#### 安装依赖
|
||||
|
||||
Livox SDK需要以下依赖 [CMake 3.0.0+](https://cmake.org/), [Apache Portable Runtime (APR) 1.61+](http://apr.apache.org/) 和 [Boost 1.54+](https://www.boost.org/)。需要用apt来安装boost、cmake:
|
||||
|
||||
```
|
||||
sudo apt install cmake libboost-atomic-dev libboost-system-dev
|
||||
```
|
||||
|
||||
在 [Apache Portable Runtime (APR) 1.61+](http://apr.apache.org/) 下载最新的apr linux源码:
|
||||
|
||||
```
|
||||
tar -zxvf apr-1.X.X.tar.gz
|
||||
cd apr-1.X.X
|
||||
./configure --prefix=/usr/local/apr --disable-lfs
|
||||
make && sudo make install
|
||||
```
|
||||
|
||||
#### 编译Livox SDK
|
||||
|
||||
在Livox SDK目录中,运行以下命令来编译工程:
|
||||
|
||||
```
|
||||
git clone https://github.com/Livox-SDK/Livox-SDK.git
|
||||
cd Livox-SDK/build
|
||||
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/apr/lib/pkgconfig/ && export PKG_CONFIG_PATH
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
由于 PKG_CONFIG_PATH 只在当前终端窗口有效,所以每个新的窗口都需要运行`PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/apr/lib/pkgconfig/ && export PKG_CONFIG_PATH` ,除非在 .bashrc 文件中加入这一行作为环境变量。
|
||||
|
||||
### 1.1.2 Mac
|
||||
|
||||
#### 安装依赖
|
||||
|
||||
Livox SDK需要以下依赖 [CMake 3.0.0+](https://cmake.org/), [Apache Portable Runtime (APR) 1.61+](http://apr.apache.org/) 和 [Boost 1.54+](https://www.boost.org/)。可以使用brew来安装这些依赖:
|
||||
|
||||
```
|
||||
brew install cmake apr boost
|
||||
```
|
||||
|
||||
然后运行以下命令:
|
||||
|
||||
```
|
||||
brew info apr
|
||||
```
|
||||
|
||||
可以看到以下信息并获取apr路径:
|
||||
|
||||
```
|
||||
apr: stable 1.X.X (bottled) [keg-only]
|
||||
Apache Portable Runtime library
|
||||
https://apr.apache.org/
|
||||
/usr/local/Cellar/apr/1.X.X (XX files, X.XMB)
|
||||
Poured from bottle on XXXX-XX-XX at XX:XX:XX
|
||||
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/apr.rb
|
||||
==> Caveats
|
||||
apr is keg-only, which means it was not symlinked into /usr/local,
|
||||
because Apple's CLT package contains apr.
|
||||
|
||||
If you need to have apr first in your PATH run:
|
||||
echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile
|
||||
```
|
||||
|
||||
#### 编译Livox SDK
|
||||
|
||||
在Livox SDK目录中,运行以下命令来编译工程:
|
||||
|
||||
```
|
||||
git clone https://github.com/Livox-SDK/Livox-SDK.git
|
||||
cd Livox-SDK/build
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/apr/1.X.X/libexec/lib/pkgconfig
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
由于 PKG_CONFIG_PATH 只在当前终端窗口有效,所以每个新的窗口都需要运行以上的命令,除非在 .bash_profile 文件中加入这一行作为环境变量。
|
||||
@@ -0,0 +1,39 @@
|
||||
**在Ros中设置发布频率**([Set publish frequency](../Set-publish-frequency.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
# 1. Git clone livox_ros_driver
|
||||
|
||||
`git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src`
|
||||
|
||||
# 2. 设置发布频率
|
||||
|
||||
以lvx文件到rosbag文件的转换为例:
|
||||
|
||||
如果需要设置转换为rosbag数据的频率为10Hz,可以在 "../ws_livox/src/livox_ros_driver/launch/lvx_to_rosbag.launch file"文件中将‘publish_freq’参数设置为10.0。同理,可以将其设置成需要的频率。
|
||||
|
||||

|
||||
|
||||
# 3. 在以下路径打开终端窗口
|
||||
|
||||
`../ws_livox`
|
||||
|
||||
# 4. 将lvx点云文件(v1.0/v1.1)转换为rosbag文件
|
||||
|
||||
livox_ros_driver支持将lvx点云数据转换为rosbag文件。使用以下命令:
|
||||
|
||||
`roslaunch livox_ros_driver lvx_to_rosbag.launch lvx_file_path:="/home/livox/test.lvx"`
|
||||
|
||||
将上述命令中"/home/livox/test.lvx"替换为本地lvx文件的路径之后,即可以运行;如果转换成功,在上述路径下将会产生同名的rosbag格式的文件。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
# 5. 播放rosbag数据
|
||||
|
||||

|
||||
@@ -0,0 +1,73 @@
|
||||
**在ROS驱动程序下使用lvx文件的方法**([How to use lvx file in ros](../How-to-use-lvx-file-under-ros.md))
|
||||
|
||||
|
||||
|
||||
[TOC]
|
||||
|
||||
|
||||
|
||||
lvx文件是由览沃定义的点云存储格式;如果需要在ros中使用lvx文件,需要将其转换为rosbag文件。
|
||||
|
||||
# 1、保存lvx格式的数据文件
|
||||
|
||||
## 1.1 使用览沃Viewer保存lvx文件
|
||||
|
||||
操作步骤如下所示:
|
||||
|
||||
- 打开设备管理器;
|
||||
- 连接设备;
|
||||
- 开始采样;
|
||||
- 记录并保存lvx文件;
|
||||
|
||||

|
||||
|
||||
## 1.2 使用Livox-SDK保存lvx文件
|
||||
|
||||
### 1.2.1 Git clone Livox-SDK
|
||||
|
||||
`git clone https://github.com/Livox-SDK/Livox-SDK.git`
|
||||
|
||||
### 1.2.2 连接雷达设备并保存lvx文件
|
||||
|
||||
- 在以下文件路径打开终端窗口: ../Livox_SDK/build/sample/lidar_lvx_file
|
||||
- 执行以下命令: ./lidar_lvx_sample
|
||||
- 连接指定的设备: -c “Lidar SN”
|
||||
- 设置点云持续时间: -t 10 (10 second)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
# 2 将lvx文件(v1.0/v1.1)转换为rosbag文件(仅支持Ubuntu系统)
|
||||
|
||||
## 2.1 Git clone livox_ros_driver
|
||||
|
||||
`git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src`
|
||||
|
||||
## 2.2 设置点云发布频率
|
||||
|
||||
如果需要设置转换为rosbag数据的频率为10Hz,可以在 "../ws_livox/src/livox_ros_driver/launch/lvx_to_rosbag.launch file"文件中将‘publish_freq’参数设置为10.0。同理,可以将其设置成需要的频率。
|
||||
|
||||

|
||||
|
||||
## 2.3 在以下路径打开终端窗口
|
||||
|
||||
`../ws_livox`
|
||||
|
||||
## 2.4 将lvx点云文件(v1.0/v1.1)转换为rosbag文件
|
||||
|
||||
livox_ros_driver支持将lvx点云数据转换为rosbag文件。使用以下命令:
|
||||
|
||||
`roslaunch livox_ros_driver lvx_to_rosbag.launch lvx_file_path:="/home/livox/test.lvx"`
|
||||
|
||||
将上述命令中"/home/livox/test.lvx"替换为本地lvx文件的路径之后,即可以运行;如果转换成功,在上述路径下将会产生同名的rosbag格式的文件。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 2.5 播放Rosbag数据
|
||||
|
||||

|
||||