13
13
// limitations under the License. Reserved.
14
14
15
15
#include < math.h>
16
+ #include < cmath>
16
17
#include < memory>
17
18
#include < string>
18
19
#include < vector>
@@ -384,6 +385,7 @@ TEST(NodeHybridTest, basic_get_closest_angular_bin_test)
384
385
385
386
{
386
387
motion_table.bin_size = 3.1415926 ;
388
+ motion_table.num_angle_quantization = 2 ;
387
389
double test_theta = 3.1415926 ;
388
390
unsigned int expected_angular_bin = 1 ;
389
391
unsigned int calculated_angular_bin = motion_table.getClosestAngularBin (test_theta);
@@ -392,17 +394,28 @@ TEST(NodeHybridTest, basic_get_closest_angular_bin_test)
392
394
393
395
{
394
396
motion_table.bin_size = M_PI;
397
+ motion_table.num_angle_quantization = 2 ;
395
398
double test_theta = M_PI;
396
- unsigned int expected_angular_bin = 1 ;
399
+ unsigned int expected_angular_bin = 0 ;
397
400
unsigned int calculated_angular_bin = motion_table.getClosestAngularBin (test_theta);
398
401
EXPECT_EQ (expected_angular_bin, calculated_angular_bin);
399
402
}
400
403
401
404
{
402
405
motion_table.bin_size = M_PI;
406
+ motion_table.num_angle_quantization = 2 ;
403
407
float test_theta = M_PI;
404
408
unsigned int expected_angular_bin = 1 ;
405
409
unsigned int calculated_angular_bin = motion_table.getClosestAngularBin (test_theta);
406
410
EXPECT_EQ (expected_angular_bin, calculated_angular_bin);
407
411
}
412
+
413
+ {
414
+ motion_table.bin_size = 0.0872664675 ;
415
+ motion_table.num_angle_quantization = 72 ;
416
+ double test_theta = 6.28318526567925 ;
417
+ unsigned int expected_angular_bin = 71 ;
418
+ unsigned int calculated_angular_bin = motion_table.getClosestAngularBin (test_theta);
419
+ EXPECT_EQ (expected_angular_bin, calculated_angular_bin);
420
+ }
408
421
}
0 commit comments