YDLIDAR G4 User manual

YDLIDAR G4
USER MANUAL
Doc#:01.13.000009

www.ydlidar.com Copyright 2015-2019 YDLIDAR
1 / 12
Contents
YDLIDAR G4 DEVELOPMENT KIT.................................................................................................................. 2
Development kit......................................................................................................................................... 2
USAGE UNDER WINDOWS.............................................................................................................................3
Device connection...................................................................................................................................... 3
Driver Installation........................................................................................................................................4
Evaluation software usage......................................................................................................................... 6
LINUX ROS OPERATION............................................................................................................................... 11
Document description............................................................................................................................. 11
Device connection....................................................................................................................................11
ROS Driver Installation............................................................................................................................. 11
RVIZ installation........................................................................................................................................12
RVIZ Check the scan results.................................................................................................................... 12
Modify the scan angle problem.............................................................................................................. 12
USE CAUTION................................................................................................................................................. 12
Ambient temperature.............................................................................................................................. 12
Ambient lighting.......................................................................................................................................12
Power demand......................................................................................................................................... 13

www.ydlidar.com Copyright 2015-2019 YDLIDAR
2 / 12
YDLIDAR G4 DEVELOPMENT KIT
The development kit of YDLIDAR G4 (hereafter abbreviated as G4) is an accessory tool provided to
facilitate the performance evaluation and early rapid development of the G4. Through the G4
development kit, and with the matching evaluation software, you can observe point cloud data
scanned by G4 on your environment or development on the SDK.
Development kit
The G4 development kit has the following components:
G4 Lidar
USB Type-C
USB Adapter board
FIG 1 YDLIDAR G4 DEVELOPMENT KIT
Item
Qty
Description
G4 Lidar
1
Standard version of the G4 Lidar. The G4 has an integrated motor drive for motor
control.
USB Type-C
cable
1
Use with USB adapter board to connect G4 and PC. USB cable is both a power
supply cable and a data cable.
USB adapter board
1
This component can realize USB to UART function, facilitating G4, PC fast
interconnection.
At the same time, support serial port DTR signal to G4 motor stop control.
A USB Type-C Power Interface (PWR) for auxiliary power supply is also
provided.
Note: USB adapter board has two USB Type-C interfaces: USB_DATA, USB_PWR.
USB_DATA: Data-powered multiplex interface. In most cases, this interface can be used to meet power and
communication requirements.
USB_PWR: Auxiliary power supply interface. The USB interface of some development platforms has weak
current drive capability. At this time, auxiliary power supply can be used.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
3 / 12
USAGE UNDER WINDOWS
Device connection
When G4 is evaluated and developed under windows, G4 and PC need to be interconnected. The
specific process is as follows:
FIG 2 YDLIDAR G4DEVICE CONNECTION STEP 1
FIG 3 YDLIDAR G4DEVICE CONNECTION STEP 2
Connect the adapter board with G4 first,then connect the USB cable to the USB port of the
adapter board and the PC. Note that the Type-C interface of the USB cable is connected to the
USB_DATA of the USB interface board, and the idle mode is used after G4 is powered on. The
motor does not rotate.
Part of the development platform or PC USB interface drive current is weak, G4 need to access the
+5 V auxiliary power supply, otherwise the Lidar works abnormally.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
4 / 12
Driver Installation
FIG 4 YDLIDAR G4 AUXILIARY POWER SUPPLY
To evaluate and develop the G4 under Windows, you need to install the serial port driver of the USB
adapter board. The USB adapter board of this kit adopts CP2102 chip to realize serial port (UART)
to USB signal conversion. Its driver can be downloaded from our official website or downloaded
from the official website of Silicon Labs.
http://ydlidar.com/
http://cn.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
After decompressing the driver package, run the CP2102's Windows driver installation file (exe file
under CP210x_VCP_Windows). Please select the 32-bit version (x86) or 64-bit version (x64)
installation program according to the version of the windows operating system.
FIG 5 YDLIDAR G4 DRIVER VERSION SELECTION
Development
Platform
5V Power
Supply

www.ydlidar.com Copyright 2015-2019 YDLIDAR
5 / 12
Double-click the exe file and follow the prompts to install it.
FIG 6 YDLIDAR G4 DRIVER IS INSTALLING
After the installation is complete, you can right-click on My Computer and select Properties. On the
Open System screen, select Device Manager from the left menu to access the Device Manager.
Expand [Port] to see the serial port name corresponding to the identified USB adapter, that is, the
driver installation is successful. The following figure shows COM3. (Note that the port must be
checked in case of G4 and PC interconnection).
Note:Users can also choose Type-C on G4 to get started quickly.Connect the PC and G4 directly
with Type-C data cable and download the vcp serial port driver of G4 on the www.ydlidar.com.
After that,start the PCV to scan the map and observe the data.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
6 / 12
FIG 7 YDLIDAR G4 DRIVE INSTALLATION CHECK
Evaluation software usage
YDLIDAR provides Point Cloud Viewer, a point cloud data visualization software for G4 real-time
scanning. Users can intuitively observe the G4 scanning effect chart. GDL real-time point cloud data
and real-time scanning frequency are provided on YDLIDAR. At the same time, the version
information of G4 can be read, and the scan data can be saved offline to an external file for further
analysis.
Before using the YDLIDAR software, make sure that the G4 USB adapter board serial port driver is
installed successfully, and interconnect the G4 with the USB port of the PC. Run the evaluation
software: PointCloudViewer.exe, select the corresponding serial port number and model number.
FIG 8 YDLIDAR G4 EVALUATION SOFTWARE

www.ydlidar.com Copyright 2015-2019 YDLIDAR
7/12
Note: The Lidar does not turn on the heartbeat function by default. This function needs to send the scan
command continuously to make it work normally. If the scanning frequency is stopped, the Lidar will stop
scanning. Currently, G4 and F4 are compatible with this function, and X4 and X4 are not compatible.
If the connection is correct, you will see the following screen:
Start Scanning
Click to start scanning and display the environment point cloud.
Clicking to stop it,as shown below:

www.ydlidar.com Copyright 2015-2019 YDLIDAR
8/12
FIGURE10 LIDAR SCANNING POINT CLOUD DISPLAY
System Settings
Click System Settings and the following settings box will pop up:
FIGURE 11 CLIENT SETTINGS BOX
As shown in the figure, you can configure and detect the Lidar on this setup page, as well as Lidar
firmware upgrade, client software upgrade, etc.
Save Data
During Lidar scanning,click ,Save the point cloud data as prompted.The system will save the
point cloud information scanned in a circle according to the following format.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
9/12
FIGURE 12 POINT CLOUD DATA SAVE FORMAT
Scanning direction
The scanning direction (rotation direction) of the lidar can be adjusted by clicking . When
the lidar is in the scanning state, you need to click the scan control again after switching the
scanning direction.
Scanning frequency
is used to adjust the scanning frequency (motor speed) of the lidar. Click any one of them,
the system will pop up the frequency setting bar, which can be adjusted automatically according to
the demand. When the lidar is in the scanning state, you need to click the scan control again after
adjusting the scanning frequency.
Ranging frequency
is used to switch the Lidar's ranging frequency. The X4 supports 4K, 8K, and 9K ranging
frequency switching. Other versions of the Lidar do not support this function, and the click is
invalid. When the Lidar is in the scanning state, you need to click the scanning control again after
switching the ranging frequency.
Angle Calibration
During the mechanical assembly of the Lidar, the user may have a deviation in the zero angle.
In this case, the angle calibration function of the client can be used to calibrate according to
actual needs. The specific operations are as follows:

www.ydlidar.com Copyright 2015-2019 YDLIDAR
10 /
12
(1) Unlock calibration function
Click the unlock control , the system will pop up the login box, the default password is eaibot.
The effect of these controls will change after unlocking.
(2) setting the baseline
Click and the system will provide a baseline of the appropriate size as a reference for the
adjustment.
(3) Adjusting the angle
Click to adjust the angle to the appropriate position.
(4) save configuration
After the adjustment is completed, click the system will automatically save the
calibration parameters, and the calibration will take effect after saving.
(5) Lock calibration function
After the calibration is saved, click again to lock the function to prevent misoperation. these
controls will return to normal functionality after being locked.
Note: During the firmware upgrade process, keep the Lidar power supply,communication as well as network
normal.Do not plug or unplug the serial port .
Software upgrade
The client software will be version-changed and users can update to the latest version for a better
experience.
Click System Settings and select Update, as shown below:
FIGURE 13 SYSTEM UPDATE PAGE

www.ydlidar.com Copyright 2015-2019 YDLIDAR
11 / 14
$ mkdir -p ~/ydlidar_ws/src
$ cd ~/ydlidar_ws
$ catkin_make
$ echo "source ~/ydlidar_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
$ cd ~/ydlidar_ws/src/ydlidar/startup
$ sudo chmod +x initenv.sh
$ sudo sh initenv.sh
Select the configuration as shown above, click ‘check for updates’, if there is no new version, the
system will prompt no update; when there is a new version, the software version information will be
filled in the information box, click to update the client software.
LINUX ROS OPERATION
Because there are many Linux versions, this article only uses Ubuntu 16.04, Kinetic version
ROS as an example.
Document description
Download the latest ROS driver package for YDLIDAR X4 on GitHub
https://github.com/YDLIDAR/ydlidar/tree/G4;
Device connection
Under Linux, the X4 and PC interconnect processes are consistent with those under
Windows. See Device Connection under Window.
ROS Driver Installation
Before doing the following, make sure that the Kinetic version ROS environment is
installed correctly.
(1) Use the command to create the ydlidar_ws workspace and copy the ROS driver
package ydlidar in the X4 package to the ydlidar_ws/src directory. Switch to the
ydlidar_ws workspace and compile again.
(2) After the compilation is complete, add the ydlidar environment variable to the
~/.bashrc file and make it effective.
(3) Add a device alias /dev/ydlidar to the X4 serial port.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
12 / 14
$ sudo apt-get update
$ roscd ydlidar/launch
$ vim lidar.launch
RVIZ installation
(1)Online installation
$ sudo apt-get install python-serial ros-kinetic-serial g++ vim \
ros-kinetic-turtlebot-rviz-launchers
(2)If there is a problem with the installation, update the source cache and reinstall it.
RVIZ Check the scan results
Run the launch file and open rviz to view the X4 scan results, as shown in the following figure:
FIG14 YDLIDAR X4 RVIZ
Modify the scan angle problem
The scanning data seen by running the launch file is displayed by default with 360- degree
data. To modify the display range, you need to modify the configuration parameters in the
launch file. The specific operation is as follows:
(1) Go to X4.launch's directory and use vim to edit X4.launch. The contents are as shown
in the figure:

www.ydlidar.com Copyright 2015-2019 YDLIDAR
12 / 13
0°
FIG 15 LIDAR.LAUNCH FILE
(2) The X4 lidar coordinates follow the right-hand rule within ROS, with an angle range of
[-180, 180]. "angle_min" is the start angle, and "angle_max" is the end angle.
The specific scope needs to be modified according to actual use.
+90°-90°
±180°
USE CAUTION
Ambient temperature
When the working environment temperature of G4 is too high or too low, it will affect the accuracy
of the distance measuring system. It may also damage the structure of the scanning system and
reduce the life of the G4 lidar. Avoid use in high temperature (>50 degrees Celsius) and low
temperature (<0 degrees Celsius) conditions.
Ambient lighting
The ideal working environment for the G4 is indoor, indoor lighting (including no light) will not
affect the G4 work. However, avoid using a strong light source (such as a high-power laser) to
directly illuminate the G4's vision system.

www.ydlidar.com Copyright 2015-2019 YDLIDAR
13 / 13
If you need to use it outdoors, please avoid that the G4's vision system is directly facing the sun. This
may cause permanent damage to the vision system's sensor chip, thus invalidating the distance
measurement.
Please note that the G4 standard version is subject to interference in outdoor strong sunlight
reflection environments.
Power demand
During the development process, since the drive current of the USB interface of each platform or the
USB interface of the computer may be too low to drive the G4, the external power supply of the +4V
to the G4 needs to be provided through the USB_PWR interface of the USB interface board. It is not
recommended to use mobile phone power bank because the voltage ripple of some brands of power
bank is too large.
Table of contents
Other YDLIDAR Scanner manuals