Hesai LiDAR ROS Build and Receive Topic



Fig 1. HESAI LiDAR – Pandar XT model

In this posting, HESAI LiDAR which is one of the most widely used LiDARs will be mainly focused.
Environment : (1) Ubuntu 16.04 + ROS kinetic (2) Ubuntu 18.04 + ROS melodic (3) Ubuntu 20.04 + ROS noetic




1. Ethernet IP Setup

LiDAR most often communicates over Ethernet.
It is important to enable Ethernet communication between the HESAI LiDAR sensor and PC over Ethernet before building with the ROS driver.

[Hesai LiDAR fixed IP : 192.168.1.201]
So for ethernet communication between LiDAR and PC, your PC IP should be assigned to 192.168.1.xx band.
Please connect LiDAR as follows.

Fig 2. Example of Hesai LiDAR – PC connection

You can check your PC IP with following command,

$ ifconfig

Fig 3. ‘ifconfig’ results on terminal. Before assigning IP.

As you can see from above, there are three network devices : (1) enp4s0 (2) lo (3) wlo1
* lo means local ethernet network and wlo means Wifi network.
For LiDAR communication, you should assign IP on enp4s0 (ethernet network device).
(The name of the device may be different depending on your environment.)

Your PC ehternet IP should be assigned with 192.168.1.xx.
You can change your IP with following commands,

$ sudo ip add flush dev enp4s0
$ sudo ip link set enp4s0 up
$ sudo ip addr add 192.168.1.77/24 dev enp4s0

* The above is and example for 77 and /24 means subnetmask 255.255.255.0 .

Fig 4. ‘ifconfig’ results on terminal. After assigning IP.

After assigning IP, you can check communication with Hesai LiDAR by ‘ping’ command as follows.

Fig 5. ‘ping’ results, which shows good communication with HESAI LiDAR


2. Hesai LiDAR ROS Package Build

Support models : PandarQT/Pandar64/Pandar40P/Pandar20A/Pandar20B/Pandar40M/PandarXT
Support OS : (1) Ubuntu 16.04 + ROS kinetic (2) Ubuntu 18.04 + ROS melodic (3) Ubuntu 20.04 + ROS noetic

$ sudo apt install libpcap-dev libyaml-cpp-dev
$ sudo apt-get update
$ sudo apt-get install python-catkin-tools
$ mkdir -p rosworkspace/src
$ cd rosworkspace/src
$ git clone https://github.com/HesaiTechnology/HesaiLidar_General_ROS.git --recursive

$ cd .. 
$ catkin_make -DCMAKE_BUILD_TYPE=Release



3. Run Hesai LiDAR ROS Launch and Results

$ source devel/setup.bash
for PandarQT
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="PandarQT" frame_id:="PandarQT"
for Pandar64
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="Pandar64" frame_id:="Pandar64"
for Pandar20A
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="Pandar20A" frame_id:="Pandar20A"
for Pandar20B
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="Pandar20B" frame_id:="Pandar20B"
for Pandar40P
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="Pandar40P" frame_id:="Pandar40P"
for Pandar40M
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="Pandar40M" frame_id:="Pandar40M"
for PandarXT-32
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="PandarXT-32" frame_id:="PandarXT-32"
for PandarXT-16
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="PandarXT-16" frame_id:="PandarXT-16"
for PandarXTM
$ roslaunch hesai_lidar hesai_lidar.launch lidar_type:="PandarXTM" frame_id:="PandarXTM"

Fig 6. HESAI LiDAR ROS launch results


Now, open rviz with following command in new terminal.

$ rviz
  1. Add-ByTopic – PointCloud
  2. Global Options – FixedFrame – PandarXT-32

Fig 7. Check HESAI LiDAR ROS Topic with RVIZ


Enjoy your Hesai LiDAR with ROS !


[Reference]
(1)https://github.com/HesaiTechnology/HesaiLidar_General_ROS





1 thought on “Hesai LiDAR ROS Build and Receive Topic”

Leave a Comment