HesaiTechnology / HesaiLidar_ROS_2.0

33 stars 39 forks source link

Introduction to HesaiLidar_ROS_2.0

This repository includes the ROS Driver for Hesai LiDAR sensor manufactured by Hesai Technology. Developed based on HesaiLidar_SDK_2.0, After launched, the project will monitor UDP packets from Lidar,parse data and publish point cloud frames into ROS topic

Support Lidar type

Installation dependencies

Install ROS related dependency libraries, please refer to: http://wiki.ros.org

Install Boost

sudo apt-get update
sudo apt-get install libboost-all-dev

Install Yaml

sudo apt-get update
sudo apt-get install -y libyaml-cpp-dev

Clone

$ git clone --recurse-submodules https://github.com/HesaiTechnology/HesaiLidar_ROS_2.0.git

Compile and run

Introduction to the configuration file config.yaml parameters

lidar:
- driver:
    udp_port: 2368                                       #UDP port of lidar
    ptc_port: 9347                                       #PTC port of lidar
    device_ip_address: 192.168.1.201                     #IP address of lidar
    pcap_path: "<Your PCAP file path>"                   #The path of pcap file (set during offline playback)
    correction_file_path: "<Your correction file path>"  #LiDAR angle file, required for offline playback of pcap/packet rosbag
    firetimes_path: "<Your firetime file path>"          #The path of firetimes file
    source_type: 2                                       #The type of data source, 1: real-time lidar connection, 2: pcap, 3: packet rosbag
    pcap_play_synchronization: true                      #Pcap play rate synchronize with the host time
    x: 0                                                 #Calibration parameter
    y: 0                                                 #Calibration parameter
    z: 0                                                 #Calibration parameter
    roll: 0                                              #Calibration parameter
    pitch: 0                                             #Calibration parameter
    yaw: 0                                               #Calibration parameter
ros:
    ros_frame_id: hesai_lidar                            #Frame id of packet message and point cloud message
    ros_recv_packet_topic: /lidar_packets                #Topic used to receive lidar packets from ROS
    ros_send_packet_topic: /lidar_packets                #Topic used to send lidar packets through ROS
    ros_send_point_cloud_topic: /lidar_points            #Topic used to send point cloud through ROS
    send_packet_ros: true                                #true: Send packets through ROS 
    send_point_cloud_ros: true                           #true: Send point cloud through ROS 

Real time playback

Set the source_type in the configuration file to 1 and input the correct lidar udp_port, ptc_port (default 9347, usually unchanged) and device_ip_address, then run start.launch.

Parsing PCAP file

Set the source_type in the configuration file to 2 and input the correct lidar pcap_path , correction_file_path and firetime_file_path, then run start.launch.

Record and playback ROSBAG file

Realize multi lidar fusion

According to the configuration of a single lidar, multiple drivers can be created in config.yaml, as shown in the following example

lidar:
- driver:              
    udp_port: 2368                  
    ptc_port: 9347              
    device_ip_address: 192.168.1.201          
    pcap_path: "<The PCAP file path>"                  
    correction_file_path: "<The correction file path>" 
    firetimes_path: "<Your firetime file path>"       
    source_type: 2          
    pcap_play_synchronization: true                   
    x: 0                                      
    y: 0                                     
    z: 0                                
    roll: 0                                 
    pitch: 0                             
    yaw: 0                                   
ros:
    ros_frame_id: hesai_lidar                  
    ros_recv_packet_topic: /lidar_packets      
    ros_send_packet_topic: /lidar_packets      
    ros_send_point_cloud_topic: /lidar_points  
    send_packet_ros: true                     
    send_point_cloud_ros: true             
- driver:               
    udp_port: 2368                         
    ptc_port: 9347                           
    device_ip_address: 192.168.1.201                  
    pcap_path: "<The PCAP file path>"                   
    correction_file_path: "<The correction file path>"  
    firetimes_path: "<Your firetime file path>"        
    source_type: 2        
    pcap_play_synchronization: true                     
    x: 0                                       
    y: 0                                       
    z: 0                                       
    roll: 0                                    
    pitch: 0                                   
    yaw: 0                                     
ros:
    ros_frame_id: hesai_lidar                  
    ros_recv_packet_topic: /lidar_packets2     
    ros_send_packet_topic: /lidar_packets2     
    ros_send_point_cloud_topic: /lidar_points2 
    send_packet_ros: false                     
    send_point_cloud_ros: true