DOC#:01.13.000101 X2 DEVELOPMENT MANUAL www.ydlidar.com Shenzhen EAI Technology Co.,Ltd.
CONTENTS 1 WORKING MECHANISM ......................................................................... 1 2 SAMPLING AND RANGING ..................................................................... 1 3 POWER-ON INFORMATION ................................................................... 2 4 DATA PROTOCOL .................................................................................... 2 5 MOTOR SPEED CONTROL...................................................................... 5 6 REVISE .............
1 WORKING MECHANISM After the X2 is powered on, the system automatically starts ranging. The following is the working process of the X2 system workflow: System power-up Start ranging Output data FIG 1 YDLIDAR X2 WORKFLOW 2 SAMPLING AND RANGING After power on, the system will automatically start ranging, and at the same time it will output to the serial port a message data to start scanning: A5 5A 05 00 00 40 81.
3 POWER-ON INFORMATION After power-on, the system will output power-on information once, and will feedback the device model, firmware version and hardware version, as well as the factory serial number of the device. The response message is: A5 5A 14 Start sign 00 00 00 Length ‥‥ 04 Mode Type code Content FIG 3 YDLIDAR X2 DEVICE INFORMATION MESSAGE According to the protocol analysis: response length = 0x00000014, response mode = 0x0, type code = 0x04.
CHART 2 SCAN COMMAND RESPONSE CONTENT DATA STRUCTURE DESCRIPTION Content Name Description PH(2B) Packet header CT(1B) Package type LSN(1B) Sample quantity 2B in length, fixed at 0x55AA, low in front, high in back Indicates the type of the current packet, CT[bit(0)]=1 means the beginning of a lap of data, CT[bit(0)]=0 means point cloud data packet, CT[bit(7:1)] is reserve bit Indicates the number of sampling points contained in the current packet.
Starting angle solution formula:AngleFSA = Rshiftbit(FSA,1) 64 Ang_q2[6:0] Ang_q2[14:7] Rshiftbit(LSA,1) End angle solution formula:AngleLSA = 64 Intermediate angle solution formula: 𝐴𝑛𝑔𝑙𝑒𝑖 = diff(Angle) LSN−1 ∗ ( 𝑖 − 1 ) + 𝐴𝑛𝑔𝑙𝑒𝐹𝑆𝐴 C LSB MSB FIG 6 ANGLE DATA STRUCTURE SCHEMATIC (𝑖 = 2,3, … , 𝐿𝑆𝑁 − 1) 𝑅𝑠ℎ𝑖𝑓𝑡𝑏𝑖𝑡(𝑑𝑎𝑡𝑎, 1)means shifting the data to the right by one bit.
The check code uses a two-byte exclusive OR to verify the current data packet. The check code itself does not participate in XOR operations, and the XOR order is not strictly in byte order. The XOR sequence is as shown in the figure. Therefore, the check code solution formula is: CS= 𝑋𝑂𝑅1𝑒𝑛 (𝐶𝑖 ) 𝑖 =1,2,…,end FIG 7 CS XOR SEQUENCE XOR𝑒𝑛𝑑 indicates the XOR of the element from subscript 1 to end. However, XOR satisfies the 1 exchange law, and the actual solution may not need to follow the XOR sequence.
6 REVISE Date Version Content 2019-04-24 1.0 Compose a first draft 2021-07-30 1.