0% found this document useful (0 votes)
304 views9 pages

Unitree LiDAR Setup Manual

This manual provides detailed instructions for setting up the Unitree LiDAR system on Ubuntu 20.04 with ROS Noetic, covering installation, configuration, and data visualization. It includes prerequisites, step-by-step guidance for installation, and troubleshooting tips for common issues. By following this guide, users will be able to effectively capture and analyze point cloud data using the LiDAR system.

Uploaded by

miraameera.3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
304 views9 pages

Unitree LiDAR Setup Manual

This manual provides detailed instructions for setting up the Unitree LiDAR system on Ubuntu 20.04 with ROS Noetic, covering installation, configuration, and data visualization. It includes prerequisites, step-by-step guidance for installation, and troubleshooting tips for common issues. By following this guide, users will be able to effectively capture and analyze point cloud data using the LiDAR system.

Uploaded by

miraameera.3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

atkin

Unitree LiDAR Setup Manual


For Ubuntu 20.04 with ROS Noetic

Introduction
This guide provides step-by-step instructions to set up and use the Unitree LiDAR system on
Ubuntu 20.04 with ROS Noetic. It includes details on installation, configuration,
visualization using RViz, and troubleshooting. By the end, you’ll have a fully functioning
LiDAR system capable of capturing and analyzing point cloud data.

Prerequisites
Hardware Requirements

• Unitree LiDAR sensor with USB connection.


• A host system running Ubuntu 20.04 (e.g., native installation or VM).

Software Requirements

• ROS Noetic.
• Basic understanding of Linux commands and ROS concepts.

Step-by-Step Instructions
1. Install ROS Noetic

ROS Noetic is essential for working with the Unitree LiDAR in Ubuntu 20.04. Follow these
steps to install it:

Add ROS Repositories

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc)


main" > /etc/apt/sources.list.d/ros-latest.list'

Add ROS Keys

sudo apt update


sudo apt install curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc |
sudo apt-key add -

Install ROS Desktop-Full

sudo apt update


sudo apt install ros-noetic-desktop-full

Initialize rosdep

sudo apt install python3-rosdep


sudo rosdep init
rosdep update

Set ROS Environment Variables

Add ROS setup to your .bashrc:

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc


source ~/.bashrc

Install Additional Tools

Install useful tools for handling point clouds and other features:

sudo apt install python3-rosinstall python3-rosinstall-generator python3-


wstool build-essential ros-noetic-pcl-ros

2. Clone and Build the Unitree LiDAR SDK

Clone the Repository

git clone https://github.com/unitreerobotics/unilidar_sdk.git


~/unitree_lidar_sdk

Build the SDK

Navigate to the SDK directory and build it:

cd ~/unitree_lidar_sdk/unitree_lidar_sdk
mkdir build
cd build
cmake ..
make -j$(nproc)

Build the ROS Package

cd ~/unitree_lidar_sdk/unitree_lidar_ros
catkin_make

Source the ROS Workspace


source ~/unitree_lidar_sdk/unitree_lidar_ros/devel/setup.bash

3. Configure the LiDAR

Create or Locate config.yaml

Navigate to the config directory:

cd ~/unitree_lidar_sdk/unitree_lidar_ros/config
nano config.yaml

Add the Configuration

Add the following lines to the config.yaml file:

# Serial Port Configuration


port: "/dev/ttyUSB0"

# Point Cloud Topic


cloud_topic: "unilidar/cloud"
cloud_frame: "unilidar_lidar"

# IMU Topic (if available)


imu_topic: "unilidar/imu"
imu_frame: "unilidar_imu"

Save and exit (Ctrl+O, Ctrl+X).

4. Verify Serial Port Access

Check Serial Port

Ensure the LiDAR is connected and detected:

ls /dev/ttyUSB*

Grant Serial Port Permissions

Add your user to the dialout group for serial port access:

sudo usermod -a -G dialout $USER

Log out and log back in for the changes to take effect.

Temporary Permissions (Optional)

For immediate access without restarting:

sudo chmod 666 /dev/ttyUSB0


5. Launch the LiDAR Node

Start the LiDAR node to publish point cloud data:

roslaunch unitree_lidar_ros run.launch

6. Visualize Data in RViz

Open RViz

Launch RViz from the terminal:

rviz

Set Up Visualization

1. Set Fixed Frame:


o Go to Global Options > Fixed Frame and set it to unilidar_lidar.
2. Add a PointCloud2 Display:
o Click Add > By Display Type > PointCloud2.
o Set the topic to /unilidar/cloud.
3. Customize Display:
o Adjust point size, alpha (transparency), and color settings.
4. Add Axes:
o Add an Axes display for coordinate orientation.
5. Add a Grid:
o Use a Grid display as a reference plane.
7. Record and Save Data

Record Data Using rosbag

To save the point cloud data:

rosbag record /unilidar/cloud

The .bag file will be saved in your working directory.

Convert to .pcd Files

Save point clouds in .pcd format:

rosrun pcl_ros pointcloud_to_pcd input:=/unilidar/cloud


_prefix:=/home/$USER/pointcloud_

Files are saved in /home/$USER/.

Interacting with RViz


Key Features in RViz

Configure Displays

• Set the Fixed Frame to unilidar_lidar.


• Add PointCloud2, Axes, and Grid displays.

Use Tools

• Move Camera: Rotate and shift the view.


• Measure Distances: Measure distances between points in the cloud.

Save Configurations

Save your setup for future use:

File > Save Config

Plugins and Filters

• Use plugins to extend functionality.


• Apply filters to focus on specific data points.
Capturing and Saving PLY Files
After visualizing the point cloud data in RViz, you can capture and save the data in .ply
format for further processing. Follow the steps below:

1. Prerequisites

Ensure the following packages are installed on your Ubuntu system:

bash
Copy code
sudo apt-get install ros-noetic-pcl-ros pcl-tools

2. Capturing Point Cloud Data

You can capture point cloud data using the rosbag tool or save it directly in .pcd format.

• Option 1: Using rosbag To record the point cloud data being published on the
/unilidar/cloud topic:

bash
Copy code
rosbag record /unilidar/cloud

This will create a .bag file in your working directory containing the recorded data.

• Option 2: Saving in PCD Format Use the pointcloud_to_pcd node to save the
point cloud data directly in .pcd format:

bash
Copy code
rosrun pcl_ros pointcloud_to_pcd input:=/unilidar/cloud
_prefix:=/home/$USER/pointcloud_

The .pcd files will be saved in /home/$USER/ with the prefix pointcloud_.

3. Converting PCD to PLY Format

Once you have the .pcd files, you can convert them to .ply format using either a command-
line tool or a Python script.

• Option 1: Using Command-Line Tool Convert a single .pcd file to .ply:

bash
Copy code
pcl_pcd2ply input.pcd output.ply

Replace input.pcd and output.ply with your actual file names.


• Option 2: Using Python Install Python bindings for PCL if not already installed:

bash
Copy code
pip install open3d

Then, use the following Python script:

python
Copy code
import open3d as o3d

# Load the .pcd file


pcd = o3d.io.read_point_cloud("input.pcd")

# Save as .ply
o3d.io.write_point_cloud("output.ply", pcd)

Replace "input.pcd" with the path to your .pcd file and "output.ply" with the
desired output file name.

4. Automating PLY File Generation

For continuous data capture and .ply generation:

1. Write a ROS node that subscribes to the /unilidar/cloud topic.


2. Convert the incoming point cloud data and save it as .ply files in real-time.

Example ROS Python Node:

python
Copy code
import rospy
from sensor_msgs.msg import PointCloud2
import open3d as o3d
import sensor_msgs.point_cloud2 as pc2

def callback(msg):
# Convert ROS PointCloud2 message to a numpy array
points = list(pc2.read_points(msg, field_names=("x", "y", "z"),
skip_nans=True))

# Create an Open3D point cloud


pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(points)

# Save as a PLY file


o3d.io.write_point_cloud("output.ply", pcd)

rospy.init_node('ply_saver')
rospy.Subscriber('/unilidar/cloud', PointCloud2, callback)
rospy.spin()
Additional Notes

• .ply files are widely supported and can be opened in 3D visualization tools such as
MeshLab, Blender, or Open3D.
• Ensure to manage file sizes as .ply files can grow large depending on the density of
the point cloud.

This section should seamlessly integrate into your existing document. Let me know if you
need further modifications!

Troubleshooting
Permission Denied for Serial Port

• Error Message:

serial::IOException: Permission denied

• Fix:
1. Ensure the correct port (/dev/ttyUSB0) is specified.
2. Add your user to the dialout group:

sudo usermod -a -G dialout $USER

3. Apply temporary permissions:

bash
Copy code
sudo chmod 666 /dev/ttyUSB0

RViz Shows "No TF Data"

• Error: Amber warning in RViz saying "No TF data."


• Fix:
1. Ensure the Fixed Frame matches cloud_frame in config.yaml.
2. Check if the /tf topic is being published:

rostopic echo /tf

No Data in /unilidar/cloud

• Fix:
1. Verify the topic is active:

rostopic list
2. Inspect the topic:

rostopic echo /unilidar/cloud

ROS Node Keeps Restarting

• Fix:
1. Check serial port permissions.
2. Ensure no other processes are using /dev/ttyUSB0:

sudo fuser -k /dev/ttyUSB0

Conclusion
This comprehensive manual ensures you can set up and use the Unitree LiDAR with ROS
Noetic, visualize data in RViz, and store it for later analysis. Enjoy exploring your
environment with the power of LiDAR!

You might also like