大疆Mid360雷达使用教程总结

2024-01-20 10:44

本文主要是介绍大疆Mid360雷达使用教程总结,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

大疆Mid360雷达使用教程总结

Reference:

  • https://github.com/Livox-SDK/livox_ros_driver2

1. 下载编译安装Livox-SDK2

Reference:

  • https://github.com/Livox-SDK/Livox-SDK2/blob/master/README.md

下载编译安装Livox-SDK2:

git clone https://github.com/Livox-SDK/Livox-SDK2.gitcd ./Livox-SDK2/mkdir buildcd buildcmake .. && make -jsudo make install

编译生成的库文件为静态库,库文件安装路径为"/usr/local/lib",头文件安装路径为"/usr/local/include"。

如果需要移除Livox-SDK2:

$ sudo rm -rf /usr/local/lib/liblivox_lidar_sdk_*
$ sudo rm -rf /usr/local/include/livox_lidar_*

2. 下载编译Livox ROS Driver 2

下载Livox ROS Driver 2

mkdir -p catkin_livox_ros_driver2/src/livox_ros_driver2git clone https://github.com/Livox-SDK/livox_ros_driver2.git 

For ROS1

以ROS Noetic环境下编译为例:

source /opt/ros/noetic/setup.shcd catkin_livox_ros_driver2/src/livox_ros_driver2./build.sh ROS1

For ROS2 Foxy

source /opt/ros/foxy/setup.shcd catkin_livox_ros_driver2/src/livox_ros_driver2./build.sh ROS2

For ROS2 Humble

source /opt/ros/humble/setup.shsource /opt/ros/humble/setup.sh./build.sh humble

3. 运行Livox ROS Driver 2

注意,如果运行如下命令后Rviz中没有显示点云数据,则有可能是雷达配置问题。

这里需要的配置包括:

  • 将点云格式设置为PointXYZRTLT,对应参数为xfer_format=0,其位于ROS1的launch文件rviz_MID360.launch中或ROS2的launch文件rviz_MID360_launch.py
  • 设置雷达ip地址。查看雷达背后的id码,以47MDL960020112为例,其最后两位即为当前雷达的默认ip地址,即雷达的出厂默认ip地址为192.168.1.112。对应需要设置参数为文件MID360_config.json中的ip
  • 设置目标主机ip地址,即连接雷达和雷达进行通信的主机ip地址。这里需要设置到相同网段,这里设置为192.168.1.50,则对应需要在文件MID360_config.json中指定host_net_info的ip地址。

完整的文件MID360_config.json如下:

{"lidar_summary_info" : {"lidar_type": 8},"MID360": {"lidar_net_info" : {"cmd_data_port": 56100,"push_msg_port": 56200,"point_data_port": 56300,"imu_data_port": 56400,"log_data_port": 56500},"host_net_info" : {"cmd_data_ip" : "192.168.1.50","cmd_data_port": 56101,"push_msg_ip": "192.168.1.50","push_msg_port": 56201,"point_data_ip": "192.168.1.50","point_data_port": 56301,"imu_data_ip" : "192.168.1.50","imu_data_port": 56401,"log_data_ip" : "","log_data_port": 56501}},"lidar_configs" : [{"ip" : "192.168.1.112","pcl_data_type" : 1,"pattern_mode" : 0,"extrinsic_parameter" : {"roll": 0.0,"pitch": 0.0,"yaw": 0.0,"x": 0,"y": 0,"z": 0}}]
}

For ROS

cd catkin_livox_ros_driver2source devel/setup.shroslaunch livox_ros_driver2 rviz_MID360.launch

For ROS2

cd catkin_livox_ros_driver2source install/setup.shros2 launch livox_ros_driver2 rviz_MID360_launch.py

4. ROS1和ROS2的launch文件

ROS的启动文件位于如下目录:

catkin_livox_ros_driver2/src/livox_ros_driver2/launch_ROS1

ROS2的启动文件位于如下目录:

catkin_livox_ros_driver2/src/livox_ros_driver2/launch_ROS2

不同的启动文件对应不同的雷达和配置,并在不同的场景中使用。

launch file nameDescription
rviz_HAP.launchConnect to HAP LiDAR device
Publish pointcloud2 format data
Autoload rviz
msg_HAP.launchConnect to HAP LiDAR device
Publish livox customized pointcloud data
rviz_MID360.launchConnect to MID360 LiDAR device
Publish pointcloud2 format data
Autoload rviz
msg_MID360.launchConnect to MID360 LiDAR device
Publish livox customized pointcloud data
rviz_mixed.launchConnect to HAP and MID360 LiDAR device
Publish pointcloud2 format data
Autoload rviz
msg_mixed.launchConnect to HAP and MID360 LiDAR device
Publish livox customized pointcloud data

5. 雷达参数配置之launch文件

Livox_ros_driver2的所有内部参数配置均位于launch文件中。

如下为三个常用参数的功能描述,包括

  • 设置点云发布频率,最高为100Hz
  • 多个雷达时,设置每个雷达的话题名称
  • 设置点云消息格式,包括
ParameterDetailed descriptionDefault
publish_freqSet the frequency of point cloud publish
Floating-point data type, recommended values 5.0, 10.0, 20.0, 50.0, etc. The maximum publish frequency is 100.0 Hz.
10.0
multi_topicIf the LiDAR device has an independent topic to publish pointcloud data
0 – All LiDAR devices use the same topic to publish pointcloud data
1 – Each LiDAR device has its own topic to publish point cloud data
0
xfer_formatSet pointcloud format
0 – Livox pointcloud2(PointXYZRTLT) pointcloud format
1 – Livox customized pointcloud format
2 – Standard pointcloud2 (pcl :: PointXYZI) pointcloud format in the PCL library (just for ROS)
0

设置点云发布频率

打开对应的launch文件,配置参数publish_freq

设置点云消息的数据格式

打开对应的launch文件,配置参数xfer_format。这里支持以下三种格式:

格式代号消息类型说明
0PointXYZRTLTLivox pointcloud2pointcloud format
1livox_ros_driver2::CustomMsgLivox customized pointcloud format
2pcl::PointXYZIStandard pointcloud2 pointcloud format in the PCL library (just for ROS)

其中,Livox自定义的用于支持PCL库的PointXYZRTLT点格式的定义如下:

float32 x               # X axis, unit:m
float32 y               # Y axis, unit:m
float32 z               # Z axis, unit:m
float32 intensity       # the value is reflectivity, 0.0~255.0
uint8   tag             # livox tag
uint8   line            # laser number in lidar
float64 timestamp       # Timestamp of point

在C++中可以定义如下:

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/impl/pcl_base.hpp>/*** @brief Livox Mid360 Point Type*/
namespace mid360_ros {
struct Point
{PCL_ADD_POINT4DPCL_ADD_INTENSITYstd::uint8_t tag;     // livox tag --- 对于Mid360, 其取值为[0,1,2,3,4]std::uint8_t line;    // laser number in lidar --- 对于Mid360, 其取值为[0,1,2,3],即总共4条激光线,每次采样四个点的线号依次为0,1,2,3double timestamp;     // 单位为ns的绝对时间戳EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;
}
POINT_CLOUD_REGISTER_POINT_STRUCT(mid360_ros::Point,(float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)(std::uint8_t, tag, tag)(std::uint8_t, line, line)(double, timestamp, timestamp)
)

另外一种Livox自定义的点云数据格式为:

std_msgs/Header header     # ROS standard message header
uint64          timebase   # The time of first point
uint32          point_num  # Total number of pointclouds
uint8           lidar_id   # Lidar device id number
uint8[3]        rsvd       # Reserved use
CustomPoint[]   points     # Pointcloud data

上述点云数据格式中的一个点的格式(CustomPoint)的定义如下:

uint32  offset_time     # offset time relative to the base time
float32 x               # X axis, unit:m
float32 y               # Y axis, unit:m
float32 z               # Z axis, unit:m
uint8   reflectivity    # reflectivity, 0~255
uint8   tag             # livox tag
uint8   line            # laser number in lidar

设置多个雷达的点云话题

打开对应的launch文件,配置参数multi_topic

6. 雷达参数配置之Json文件

修改雷达的IP、端口

Lidar的IP和端口等设置位于config文件夹下的json-style的配置文件中。

参数说明如下:

ParameterTypeDescriptionDefault
ipStringIp of the LiDAR you want to config192.168.1.100
pcl_data_typeIntChoose the resolution of the point cloud data to send
1 – Cartesian coordinate data (32 bits)
2 – Cartesian coordinate data (16 bits)
3 --Spherical coordinate data
1
pattern_modeIntSpace scan pattern
0 – non-repeating scanning pattern mode
1 – repeating scanning pattern mode
2 – repeating scanning pattern mode (low scanning rate)
0
blind_spot_set (Only for HAP LiDAR)IntSet blind spot
Range from 50 cm to 200 cm
50
extrinsic_parameterSet extrinsic parameter
The data types of “roll” “picth” “yaw” are float
The data types of “x” “y” “z” are int

示例如下:

{"lidar_summary_info" : {"lidar_type": 8  # protocol type index, please don't revise this value},"HAP": {"device_type" : "HAP","lidar_ipaddr": "","lidar_net_info" : {"cmd_data_port": 56000,  # command port"push_msg_port": 0,"point_data_port": 57000,"imu_data_port": 58000,"log_data_port": 59000},"host_net_info" : {"cmd_data_ip" : "192.168.1.5",  # host ip (it can be revised)"cmd_data_port": 56000,"push_msg_ip": "","push_msg_port": 0,"point_data_ip": "192.168.1.5",  # host ip"point_data_port": 57000,"imu_data_ip" : "192.168.1.5",  # host ip"imu_data_port": 58000,"log_data_ip" : "","log_data_port": 59000}},"lidar_configs" : [{"ip" : "192.168.1.100",  # ip of the LiDAR you want to config"pcl_data_type" : 1,"pattern_mode" : 0,"blind_spot_set" : 50,"extrinsic_parameter" : {"roll": 0.0,"pitch": 0.0,"yaw": 0.0,"x": 0,"y": 0,"z": 0}}]
}

当连接多个激光雷达时,将不同激光雷达对应的对象添加到 “lidar_configs” 数组中即可。

示例如下:

{"lidar_summary_info" : {"lidar_type": 8  # protocol type index, please don't revise this value},"HAP": {"lidar_net_info" : {  # HAP ports, please don't revise these values"cmd_data_port": 56000,  # HAP command port"push_msg_port": 0,"point_data_port": 57000,"imu_data_port": 58000,"log_data_port": 59000},"host_net_info" : {"cmd_data_ip" : "192.168.1.5",  # host ip"cmd_data_port": 56000,"push_msg_ip": "","push_msg_port": 0,"point_data_ip": "192.168.1.5",  # host ip"point_data_port": 57000,"imu_data_ip" : "192.168.1.5",  # host ip"imu_data_port": 58000,"log_data_ip" : "","log_data_port": 59000}},"MID360": {"lidar_net_info" : {  # Mid360 ports, please don't revise these values"cmd_data_port": 56100,  # Mid360 command port"push_msg_port": 56200,"point_data_port": 56300,"imu_data_port": 56400,"log_data_port": 56500},"host_net_info" : {"cmd_data_ip" : "192.168.1.5",  # host ip"cmd_data_port": 56101,"push_msg_ip": "192.168.1.5",  # host ip"push_msg_port": 56201,"point_data_ip": "192.168.1.5",  # host ip"point_data_port": 56301,"imu_data_ip" : "192.168.1.5",  # host ip"imu_data_port": 56401,"log_data_ip" : "","log_data_port": 56501}},"lidar_configs" : [{"ip" : "192.168.1.100",  # ip of the HAP you want to config"pcl_data_type" : 1,"pattern_mode" : 0,"blind_spot_set" : 50,"extrinsic_parameter" : {"roll": 0.0,"pitch": 0.0,"yaw": 0.0,"x": 0,"y": 0,"z": 0}},{"ip" : "192.168.1.12",  # ip of the Mid360 you want to config"pcl_data_type" : 1,"pattern_mode" : 0,"extrinsic_parameter" : {"roll": 0.0,"pitch": 0.0,"yaw": 0.0,"x": 0,"y": 0,"z": 0}}]
}

修改雷达的扫描模式 — 不支持

很遗憾,从官方Github上的issues看,MID360当前尚不支持重复扫描模式,即只支持默认的非重复扫描模式!尝试修改pattern_mode参数并不会起作用。

具体可见:

  • https://github.com/Livox-SDK/livox_ros_driver2/issues/36

这篇关于大疆Mid360雷达使用教程总结的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/625760

相关文章

Python实现图片分割的多种方法总结

《Python实现图片分割的多种方法总结》图片分割是图像处理中的一个重要任务,它的目标是将图像划分为多个区域或者对象,本文为大家整理了一些常用的分割方法,大家可以根据需求自行选择... 目录1. 基于传统图像处理的分割方法(1) 使用固定阈值分割图片(2) 自适应阈值分割(3) 使用图像边缘检测分割(4)

使用Python实现图像LBP特征提取的操作方法

《使用Python实现图像LBP特征提取的操作方法》LBP特征叫做局部二值模式,常用于纹理特征提取,并在纹理分类中具有较强的区分能力,本文给大家介绍了如何使用Python实现图像LBP特征提取的操作方... 目录一、LBP特征介绍二、LBP特征描述三、一些改进版本的LBP1.圆形LBP算子2.旋转不变的LB

Maven的使用和配置国内源的保姆级教程

《Maven的使用和配置国内源的保姆级教程》Maven是⼀个项目管理工具,基于POM(ProjectObjectModel,项目对象模型)的概念,Maven可以通过一小段描述信息来管理项目的构建,报告... 目录1. 什么是Maven?2.创建⼀个Maven项目3.Maven 核心功能4.使用Maven H

Python中__init__方法使用的深度解析

《Python中__init__方法使用的深度解析》在Python的面向对象编程(OOP)体系中,__init__方法如同建造房屋时的奠基仪式——它定义了对象诞生时的初始状态,下面我们就来深入了解下_... 目录一、__init__的基因图谱二、初始化过程的魔法时刻继承链中的初始化顺序self参数的奥秘默认

SpringBoot使用GZIP压缩反回数据问题

《SpringBoot使用GZIP压缩反回数据问题》:本文主要介绍SpringBoot使用GZIP压缩反回数据问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录SpringBoot使用GZIP压缩反回数据1、初识gzip2、gzip是什么,可以干什么?3、Spr

Windows Docker端口占用错误及解决方案总结

《WindowsDocker端口占用错误及解决方案总结》在Windows环境下使用Docker容器时,端口占用错误是开发和运维中常见且棘手的问题,本文将深入剖析该问题的成因,介绍如何通过查看端口分配... 目录引言Windows docker 端口占用错误及解决方案汇总端口冲突形成原因解析诊断当前端口情况解

Spring Boot 集成 Quartz并使用Cron 表达式实现定时任务

《SpringBoot集成Quartz并使用Cron表达式实现定时任务》本篇文章介绍了如何在SpringBoot中集成Quartz进行定时任务调度,并通过Cron表达式控制任务... 目录前言1. 添加 Quartz 依赖2. 创建 Quartz 任务3. 配置 Quartz 任务调度4. 启动 Sprin

Linux下如何使用C++获取硬件信息

《Linux下如何使用C++获取硬件信息》这篇文章主要为大家详细介绍了如何使用C++实现获取CPU,主板,磁盘,BIOS信息等硬件信息,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录方法获取CPU信息:读取"/proc/cpuinfo"文件获取磁盘信息:读取"/proc/diskstats"文

Java使用SLF4J记录不同级别日志的示例详解

《Java使用SLF4J记录不同级别日志的示例详解》SLF4J是一个简单的日志门面,它允许在运行时选择不同的日志实现,这篇文章主要为大家详细介绍了如何使用SLF4J记录不同级别日志,感兴趣的可以了解下... 目录一、SLF4J简介二、添加依赖三、配置Logback四、记录不同级别的日志五、总结一、SLF4J

使用Python实现一个优雅的异步定时器

《使用Python实现一个优雅的异步定时器》在Python中实现定时器功能是一个常见需求,尤其是在需要周期性执行任务的场景下,本文给大家介绍了基于asyncio和threading模块,可扩展的异步定... 目录需求背景代码1. 单例事件循环的实现2. 事件循环的运行与关闭3. 定时器核心逻辑4. 启动与停