diff --git a/doc/YDLidar-SDK-Communication-Protocol.html b/doc/YDLidar-SDK-Communication-Protocol.html index 32a77cb..9063eb8 100644 --- a/doc/YDLidar-SDK-Communication-Protocol.html +++ b/doc/YDLidar-SDK-Communication-Protocol.html @@ -289,6 +289,7 @@

Package Format

Zero resolution

Start data packet: (CT & 0x01) = 0x01, LSN = 1, Si = 1.
+scan frequency: When it was a zero packet, The Lidar Scan frequency: SF = (CT >> 1) / 10.f; The Calculated frequency is the Lidar real-time frequency of the previous frame. If SF is non-zero, the protocol has real-time frequency.
For the analysis of the specific values of distance and angle, see the analysis of distance and angle.

Distance analysis:

@@ -361,7 +362,7 @@

First level analysis:

if(DistanceiDistance_{i} == 0) {
AngCorrectiAngCorrect_{i} = 0;
} else {
-AngCorrecti=atan(21.8155.3Distancei155.3Distancei)AngCorrect_{i} = atan(21.8 * \frac{155.3 - Distance_{i}}{155.3*Distance_{i}})
+AngCorrecti=atan(21.8155.3Distancei155.3Distancei)(180/3.1415926)AngCorrect_{i} = atan(21.8 * \frac{155.3 - Distance_{i}}{155.3*Distance_{i}}) * (180/3.1415926);
}

In the data packet, the 4th to 8th bytes are 28 E5 6F BD 79, so LSN = 0x28 = 40(dec), FSA = 0x6FE5, LSA = 0x79BD, and bring in the first-level solution formula, and get:
AngleFSA=223.78°Angle_{FSA} = 223.78^{°}
@@ -380,7 +381,7 @@

First level analysis:

for(int i = 0; i < LSN; i++) {
     if(Distance[i] > 0) {
         double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i]));
-        Angle[i] += AngCorrect;
+        Angle[i] += AngCorrect * 180 / M_PI;//degree
     }
     if(Angle[i] >= 360) {
         Angle[i] -= 360;
@@ -494,7 +495,7 @@ 

Code

Angle[i] = i * Angle_Diff/ (LSN- 1) + Angle_FSA; if(Distance[i] > 0) { double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i])); - Angle[i] = Angle[i] + AngCorrect; + Angle[i] = Angle[i] + AngCorrect * 180 / M_PI; } if(Angle[i] >= 360) { Angle[i] -= 360; @@ -562,7 +563,7 @@

Code

Angle[i] = i * Angle_Diff/ (LSN- 1) + Angle_FSA; if(Distance[i] > 0) { double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i])); - Angle[i] = Angle[i] + AngCorrect; + Angle[i] = Angle[i] + AngCorrect * 180 / M_PI; } } } diff --git a/doc/YDLidar-SDK-Communication-Protocol.md b/doc/YDLidar-SDK-Communication-Protocol.md index 06c4247..08a2b7f 100644 --- a/doc/YDLidar-SDK-Communication-Protocol.md +++ b/doc/YDLidar-SDK-Communication-Protocol.md @@ -105,7 +105,7 @@ AngCorrect is the angle correction value, and its calculation formula is as foll if($Distance_{i}$ == 0) { $AngCorrect_{i}$ = 0; } else { - $AngCorrect_{i} = atan(21.8 * \frac{155.3 - Distance_{i}}{155.3*Distance_{i}})$ + $AngCorrect_{i} = atan(21.8 * \frac{155.3 - Distance_{i}}{155.3*Distance_{i}}) * (180/3.1415926)$; } In the data packet, the 4th to 8th bytes are `28 E5 6F BD 79`, so `LSN = 0x28 = 40(dec)`, `FSA = 0x6FE5`, `LSA = 0x79BD`, and bring in the first-level solution formula, and get: @@ -127,7 +127,7 @@ Similarly, $Angle_{i}(2,3, \ldots,LSN-1)$, can be obtained sequentially. for(int i = 0; i < LSN; i++) { if(Distance[i] > 0) { double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i])); - Angle[i] += AngCorrect; + Angle[i] += AngCorrect * 180 / M_PI;//degree } if(Angle[i] >= 360) { Angle[i] -= 360; @@ -250,7 +250,7 @@ if(check_code == CS) { Angle[i] = i * Angle_Diff/ (LSN- 1) + Angle_FSA; if(Distance[i] > 0) { double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i])); - Angle[i] = Angle[i] + AngCorrect; + Angle[i] = Angle[i] + AngCorrect * 180 / M_PI; } if(Angle[i] >= 360) { Angle[i] -= 360; @@ -324,7 +324,7 @@ if(check_code == CS) { Angle[i] = i * Angle_Diff/ (LSN- 1) + Angle_FSA; if(Distance[i] > 0) { double AngCorrect = atan(21.8 * (155.3 - Distance[i]) / (155.3 * Distance[i])); - Angle[i] = Angle[i] + AngCorrect; + Angle[i] = Angle[i] + AngCorrect * 180 / M_PI; } } } diff --git a/doc/YDLidar-SDK-Communication-Protocol.pdf b/doc/YDLidar-SDK-Communication-Protocol.pdf index 99e2d15..d13958e 100644 Binary files a/doc/YDLidar-SDK-Communication-Protocol.pdf and b/doc/YDLidar-SDK-Communication-Protocol.pdf differ