Unilidar SDK User Manual - v1.0
Unilidar SDK User Manual - v1.0
2023.05
Unitree Lidar
目录
Preface 2
Uniliar SDK
Introduction 3
Dependency 3
Configure 3
Build 4
Run 4
Version History 7
Uniliar ROS
Introduction 8
Dependency 8
Configuration 8
Build 9
Run 9
YAML configuration file description 11
Version History 12
Uniliar ROS2
Introduction 13
Dependency 13
Configuration 13
Build 14
Run 14
launch.py configuration file description 15
Version History 16
Preface
This repository is a SDK for [Unitree L1 LiDAR](https://www.unitree.com/LiDAR).
You can use the code interfaces in this repository to obtain point cloud data and
IMU data measured in our lidar, as well as configure related parameters.
·Introduction
Unilidar SDK is a cmake package, which is specially used for running ‘Unitree LiDAR
L1’.
The functions that this package can provide includes:
Parse the raw data transmitted from the lidar hardware, and convert it into
pointcloud and IMU data
Get the pointcloud data
Get the IMU data
The output pointcloud defaultly uses a self-defined data type so that this SDK
doesn't rely too much on external dependencies. In other case,
If you are used to use [Point Cloud Library](https://pointclouds.org/), you can use
the header `unitree_lidar_sdk_pcl.h` to transform our pointcloud to PCL format;
If you wish to directly use a [ROS](https://www.ros.org/) package, you are also
able to utilize our ROS pacakge for this lidar.
·Dependency
We have verified that this package can successfully run under this environment:
Ubuntu 20.04
·Configure
Connect your lidar to your computer with a USB cable, then confirm your serial port
name for lidar:
```
$ ls /dev/ttyUSB*
/dev/ttyUSB0
```
The default serial port name is '/dev/ttyUSB0' .
If it is not the default one, you need to modify the configuration parameter in `ex-
ample_lidar.cpp`.
·Run
Directly run the example:
```
../bin/example_lidar
```
The output is like this:
```
$ ../bin/example_lidar
Here, we print the first 10 points of the pointcloud message and the quaternion of
the IMU message.
The meanings of each variable are as follows:
Dirty Percentage: The dirt percentage of the lidar. If the dirt percentage is high,
clean the radar optical window.
stamp: the timestamp of the data, in seconds.
id: the identifier of the data.
Notice:
In Ubuntu, accessing a serial port device requires the appropriate permissions. If
your C++ program does not have sufficient permissions to access the serial port
device, you will get a **"Permission denied"** error.
To solve this error, you can use the following command to add the current user to
the dialout group:
```
sudo usermod -a -G dialout $USER
```
After adding the user to the dialout group, you need to log out and log back in
for the changes to take effect.
Parse the raw data transmitted from the lidar hardware, and convert it into
pointcloud and IMU data
Publish the pointcloud data to a ROS topic
Publish the IMU data to a ROS topic
In addition, we provide a yaml file to configure the relevant parameters of the
lidar.
·Dependency
The dependencies include 'PCL' and 'ROS'.
We have verified that this package can successfully run under this environment:
Ubuntu 20.04
ROS noetic
PCL-1.10
unitree_lidar_sdk
You are suggested to configure an environment like this to run this package.
·Configuration
Connect your lidar to your computer with a USB cable, then confirm your serial port
name for lidar:
```
$ ls /dev/ttyUSB*
/dev/ttyUSB0
```
The default serial port name is '/dev/ttyUSB0' .
If it is not the default one, you need to modify the configuration in ‘unitree_li-
dar_ros/config/config.yaml’ and change the ‘port’name to yours. For example:
```
# Serial Port
port: "/dev/ttyYourUSBPortName"
``` 2023 Unitree Robotics. All rights reserved. 8
You can leave other parameters in the configuration file with their default value.
If you have special needs such as changing the cloud topic name or IMU topic
name, you are allowed to configure them in the configuration file as well.
The defalut cloud topic and its frame name is:
- topic: "unilidar/cloud"
- frame: "unilidar_lidar"
The defalut IMU topic and its frame name is:
- topic: "unilidar/imu"
- frame: "unilidar_imu"
·Build
You can just build this ROS package as follows:
```
git clone https://github.com/unitreerobotics/unilidar_sdk.git
```
- Compile:
```
cd unilidar_sdk/unitree_lidar_ros
catkin_make
```
The compiled content will be saved in the unilidar_sdk/unitree_lidar_ros/devel.
·Run
Then you need to source this ROS packege environment and then directly run the
launch file:
```
source devel/setup.bash
ros launch unitree_lidar_ros run.launch
```
You can change the 'Fixed Frame' to the imu frame 'unilidar_imu' ,so that you can
view the IMU quaternion vector:
port:The serial port number for connecting the LiDAR to the computer is /dev/t-
tyUSB0 by default.
rotate_yaw_bias:The fixed offset angle in degrees that may exist during the in-
stallation of the LiDAR. This parameter is used to calibrate the orientation of the
point cloud data, and its default value is 0.
range_scale:The range scaling factor of the LiDAR, which is used to calibrate the
ranging accuracy of the LiDAR. Its default value is 0.001.
range_bias:The range offset of the LiDAR, which is used to calibrate the ranging
accuracy of the LiDAR. Its default value is 0.
range_max:The maximum range of the LiDAR, measured in meters, with a de-
fault value of 50.
range_min:The minimum range of the LiDAR, measured in meters, with a default
value of 0.
cloud_frame:The name of the coordinate system for the point cloud data, with a
default value of 'unilidar_lidar'.
cloud_topic:The ROS topic name for the point cloud data, with a default value of
'unilidar/cloud'.
cloud_scan_num:The number of laser ring IDs for the point cloud data, with a de-
fault value of 18.
imu_frame:The name of the coordinate system for the IMU data, with a default
value of 'unilidar_imu'.
imu_topic:The ROS topic name for the IMU data, with a default value of 'unili-
dar/imu'.
v1.0.1(2023.05.05)
v1.0.2(2023.05.12)
v1.0.3(2023.05.30)
Parse the raw data transmitted from the lidar hardware, and convert it into
pointcloud and IMU data
Publish the pointcloud data to a ROS topic
Publish the IMU data to a ROS topic
In addition, you can configure the relevant parameters of the lidar in the
`launch.py`.
·Dependency
The dependencies include 'PCL' and 'ROS2'.
We have verified that this package can successfully run under this environment:
Ubuntu 20.04
ROS2 foxy
PCL-1.10
unitree_lidar_sdk
You are suggested to configure an environment like this to run this package.
·Configuration
Connect your lidar to your computer with a USB cable, then confirm your serial port
name for lidar:
```
$ ls /dev/ttyUSB*
/dev/ttyUSB0
```
The default serial port name is '/dev/ttyUSB0' .
If it is not the default one, you need to modify the configuration in `unitree_li-
dar_ros2/launch/launch.py` and change the `port` parameter to yours. For example:
```
{'port': '/dev/ttyUSB0'},
```
If you have special needs such as changing the cloud topic name or IMU topic
name, you are allowed to configure them in the configuration file as well.
- topic: "unilidar/cloud"
- frame: "unilidar_lidar"
- topic: "unilidar/imu"
- frame: "unilidar_imu"
·Build
You can just build this ROS2 package as follows:
```
git clone https://github.com/unitreerobotics/unilidar_sdk.git
```
- Compile:
```
cd unilidar_sdk/unitree_lidar_ros2
catkin_make
```
The compiled content will be saved in the unilidar_sdk/unitree_lidar_ros2/devel.
·Run
Then you need to source this ROS2 packege environment and then directly run the
launch file:
```
source install/setup.bash
ros2 launch unitree_lidar_ros2 launch.py
```
To visualize our cloud in Rviz2, you need to run:
```
rviz2 -d src/unitree_lidar_ros2/rviz/view.rviz
```
In the Rviz window, you will see our lidar pointcloud like this:
2023 Unitree Robotics. All rights reserved. 14
You can change the 'Fixed Frame' to the imu frame 'unilidar_imu' ,so that you can
view the IMU quaternion vector.
port:The serial port number for connecting the LiDAR to the computer is /dev/t-
tyUSB0 by default.
rotate_yaw_bias:The fixed offset angle in degrees that may exist during the in-
stallation of the LiDAR. This parameter is used to calibrate the orientation of the
point cloud data, and its default value is 0.
range_scale:The range scaling factor of the LiDAR, which is used to calibrate the
ranging accuracy of the LiDAR. Its default value is 0.001.
range_bias:The range offset of the LiDAR, which is used to calibrate the ranging
accuracy of the LiDAR. Its default value is 0.
range_max:The maximum range of the LiDAR, measured in meters, with a de-
fault value of 50.
range_min:The minimum range of the LiDAR, measured in meters, with a default
value of 0.
cloud_frame:The name of the coordinate system for the point cloud data, with a
default value of 'unilidar_lidar'.
cloud_topic:The ROS topic name for the point cloud data, with a default value of
'unilidar/cloud'.
2023 Unitree Robotics. All rights reserved. 15
cloud_scan_num:The number of laser ring IDs for the point cloud data, with a de-
fault value of 18.
imu_frame:The name of the coordinate system for the IMU data, with a default
value of 'unilidar_imu'.
imu_topic:The ROS topic name for the IMU data, with a default value of 'unili-
dar/imu'.
·Version History
v1.0.0(2023.05.30)
You can check the latest version of the "User Manual" on the official website of Unitree.
https://www.unitree.com/en/download