@@ -125,6 +125,29 @@ public Matrix4x4 GetLidarOriginTransfrom()
125
125
{
126
126
return Matrix4x4 . Translate ( laserArray . centerOfMeasurementLinearOffsetMm / 1000.0f ) ;
127
127
}
128
+
129
+ /// <summary>
130
+ /// Validates if the configuration is the same as the default configuration for the given model.
131
+ /// Parameters that can be modified in the real-world LiDARs are omitted from the comparison.
132
+ /// </summary>
133
+ public virtual bool ValidateWithModel ( LidarModel model )
134
+ {
135
+ return ValidateWithModel ( LidarConfigurationLibrary . ByModel [ model ] ( ) ) ;
136
+ }
137
+
138
+ // Need to create separate method with gold config parameter for derived classes.
139
+ // In some cases (e.g. in `HesaiPandar128E4XLidarConfiguration`) gold must be configured additionally.
140
+ protected bool ValidateWithModel ( BaseLidarConfiguration gold )
141
+ {
142
+ return laserArrayCycleTime == gold . laserArrayCycleTime &&
143
+ beamDivergence == gold . beamDivergence &&
144
+ noiseParams . Equals ( gold . noiseParams ) &&
145
+ laserArray . Equals ( gold . laserArray ) ;
146
+ // Omitted values
147
+ // horizontalResolution == gold.horizontalResolution
148
+ // minHAngle == gold.minHAngle
149
+ // maxHAngle == gold.maxHAngle
150
+ }
128
151
}
129
152
130
153
/// <summary>
@@ -151,6 +174,15 @@ public override Vector2[] GetRayRanges()
151
174
{
152
175
return new Vector2 [ 1 ] { new Vector2 ( minRange , maxRange ) } ;
153
176
}
177
+
178
+ public override bool ValidateWithModel ( LidarModel model )
179
+ {
180
+ var gold = LidarConfigurationLibrary . ByModel [ model ] ( ) ;
181
+ return base . ValidateWithModel ( gold ) &&
182
+ gold is UniformRangeLidarConfiguration goldTyped &&
183
+ minRange == goldTyped . minRange &&
184
+ maxRange == goldTyped . maxRange ;
185
+ }
154
186
}
155
187
156
188
/// <summary>
@@ -183,6 +215,13 @@ public override Vector2[] GetRayRanges()
183
215
}
184
216
return rayRanges ;
185
217
}
218
+
219
+ public override bool ValidateWithModel ( LidarModel model )
220
+ {
221
+ var gold = LidarConfigurationLibrary . ByModel [ model ] ( ) ;
222
+ return base . ValidateWithModel ( gold ) &&
223
+ gold is HesaiAT128LidarConfiguration ;
224
+ }
186
225
}
187
226
188
227
/// <summary>
@@ -222,6 +261,13 @@ public override Matrix4x4[] GetRayPoses()
222
261
}
223
262
return rayPoses ;
224
263
}
264
+
265
+ public override bool ValidateWithModel ( LidarModel model )
266
+ {
267
+ var gold = LidarConfigurationLibrary . ByModel [ model ] ( ) ;
268
+ return base . ValidateWithModel ( gold ) &&
269
+ gold is HesaiQT128C2XLidarConfiguration ;
270
+ }
225
271
}
226
272
227
273
/// <summary>
@@ -281,5 +327,20 @@ public override Matrix4x4[] GetRayPoses()
281
327
}
282
328
return rayPoses ;
283
329
}
330
+
331
+ public override bool ValidateWithModel ( LidarModel model )
332
+ {
333
+ var gold = LidarConfigurationLibrary . ByModel [ model ] ( ) as HesaiPandar128E4XLidarConfiguration ;
334
+ if ( gold == null )
335
+ {
336
+ return false ;
337
+ }
338
+
339
+ // Set the same high resolution mode flag to the gold config
340
+ // Laser array changes for standard and high resolution mode
341
+ gold . highResolutionModeEnabled = highResolutionModeEnabled ;
342
+
343
+ return base . ValidateWithModel ( gold ) ;
344
+ }
284
345
}
285
346
}
0 commit comments