当前位置:网站首页>3D激光SLAM:Livox激光雷达硬件时间同步
3D激光SLAM:Livox激光雷达硬件时间同步
2022-07-06 18:23:00 【月照银海似蛟龙】
3D激光SLAM:Livox激光雷达硬件时间同步
前言
在进行机器人进行slam的时候往往单一的传感器不能实现强鲁棒性,很多时候需要用到多个传感器的融合,例如激光雷达+相机+IMU+GPS+轮速计+毫米波雷达等等。
在进行多传感器融合的时候就涉及到了数据帧的对应,如果需要用时间戳去对应的话,那么则需要进行时间同步。由于数据的传输接收等存在不同程度的延时,数据的产生频率也不相同,如果仅用软同步的话,那么必然会存在一定偏差,导致数据对准不精确,那么就体现了硬件时间同步的重要性。
本篇主要介绍在3D激光SLAM中,如何对Livox激光雷达进行时间硬件同步。
Livox设备支持3种时间同步方式:
- PTP:IEEE 1588v2.0 PTP 网络协议同步;
- GPS:秒脉冲+GPRMC时间数据,组成GPS时间同步方式;
- PPS:秒脉冲同步,需要上层应用程序通过其他途径(如:uart)获取每个脉冲的时间信息,并修正点云时间。
同步原理
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时间,通过如下计算得到传输路径延迟和两时钟的偏移:
传输路径延时:
时间偏移:
GPS时间同步原理
GPS时钟源的PPS端口每秒发送一次硬件脉冲(PPS信号),随后数据端口发送一次对应这个脉冲上升沿的时间信息(GPRMC格式)。
Livox设备接收到PPS信号上升沿,并由GPRMC数据解析出正确的时间信息后,会设置点云时间为GPS时间,并保持此时间基准持续累加,来实现和GPS设备的时间同步。
注意:
Livox Hub可以直接接收RS485电平的GPRMC信号;
Livox LiDAR无法直接接收GPRMC信号,需要将GPRMC数据端口接入PC,然后通过sdk协议发送给雷达
PPS信号和GPRMC信号的时序要求:
PPS时间同步原理
Livox LiDAR每次接收到PPS信号的上升沿后,会将当前时刻的点云时间置为0,然后重新开始计时直到下一个PPS脉冲到来。我们可以利用这个特性,来实现PPS脉冲对LiDAR时间的同步。
GPS+PPS时间同步使用方法
为了兼容其他厂商的LiDAR硬件,Livox设备也支持GPS时间同步。
由于Livox有不同种类的硬件(LiDAR/Hub),在使用GPS同步时,可以将硬件接口分为3类:
- 使用Livox Hub;
- 使用Livox Converter 1.0连接的LiDAR(如:Mid-40、Mid-100);
- 使用Livox Converter 2.0连接的LiDAR(如:Tele-15、Horizon、Avia);
下面将分别介绍如何使用这3种接口进行GPS时间同步。
Livox Hub
如果GPS模块的时间信号和PPS信号是RS485电平,直接将线接入Hub的GPS时间同步口(GPS sync port)即可。
如果GPS模块的时间信号和PPS信号是TTL电平,则需要进行如下的电平转换后,才能将信号接入Hub的GPS时间同步口(GPS sync port)。
Hub使用GPS同步时,不需要进行SDK软件的配置。
Livox Converter 1.0
将GPS模块的时间信号(GPRMC)通过TTL转usb模块接入PC,PPS(必须是RS485电平)信号接入LiDAR转接盒同步口(Sync Port)。
查看接入PC的usb模块的端口名称,
例如 /dev/ttyUSB0,
添加到 livox_lidar_config.json 文件中“timesync_config”的“device_name”,
然后将“enable_timesync”配置为 true,
波特率“baudrate_index”可以参考 Livox_ros_driver 来配置具体数值
"timesync_config": {
"enable_timesync": true,
"device_name": "/dev/ttyUSB0",
"comm_device_type": 0,
"baudrate_index": 2,
"parity_index": 0
}
然后 运行launch file
Livox Converter 2.0
将GPS模块的时间信号(GPRMC)通过TTL转usb模块接入PC,PPS(注意这里是TTL电平)信号接入LiDAR转接盒同步口(Sync Port)。
查看接入PC的usb模块的端口名称,
例如 /dev/ttyUSB0,
添加到 livox_lidar_config.json 文件中“timesync_config”的“device_name”,
然后将“enable_timesync”配置为 true,
波特率“baudrate_index”可以参考 Livox_ros_driver 来配置具体数值
"timesync_config": {
"enable_timesync": true,
"device_name": "/dev/ttyUSB0",
"comm_device_type": 0,
"baudrate_index": 2,
"parity_index": 0
}
然后 运行launch file
状态检查
通过查看点云数据包头中的timestamp_type数据,
如果timestamp_type为3,则说明设备正在进行GPS时间同步:
UTC时间格式:
PPS时间同步使用方法
Livox LiDAR每次接收到PPS信号的上升沿后,会将当前时刻的点云时间置为0,然后重新开始计时直到下一个PPS脉冲到来。我们可以利用这个特性,来实现PPS脉冲对LiDAR时间的同步。
下面是实现这个流程的伪代码:
// 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()接口。
边栏推荐
- Redis tool class redisutil (tool class III)
- Threadlocalutils (tool class IV)
- Treadpoolconfig thread pool configuration in real projects
- Golang foundation - data type
- Gin 入门实战
- Cat recycling bin
- [unique] what is the [chain storage structure]?
- Shell script quickly counts the number of lines of project code
- First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
- ROS learning (25) rviz plugin
猜你喜欢
Correct use of BigDecimal
2022/0524/bookstrap
Mongodb checks whether the table is imported successfully
猫猫回收站
ROS学习(23)action通信机制
ROS学习(21)机器人SLAM功能包——orbslam的安装与测试
Box stretch and pull (left-right mode)
设置Wordpress伪静态连接(无宝塔)
Reptile practice (VI): novel of climbing pen interesting Pavilion
BigDecimal 的正确使用方式
随机推荐
Get to know MySQL for the first time
Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 2)
The use of video in the wiper component causes full screen dislocation
Appium基础 — Appium Inspector定位工具(一)
Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
Public key \ private SSH avoid password login
Drag to change order
盒子拉伸拉扯(左右模式)
AcWing 1148. Secret milk transportation problem solution (minimum spanning tree)
Shortcut keys commonly used in idea
Modify the system time of Px4 flight control
刨析《C语言》【进阶】付费知识【二】
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
Flir Blackfly S 工业相机:自动曝光配置及代码
Yiwen takes you into [memory leak]
mongodb查看表是否导入成功
How did partydao turn a tweet into a $200million product Dao in one year
Set up [redis in centos7.x]
Unicode string converted to Chinese character decodeunicode utils (tool class II)
ROS learning (23) action communication mechanism