35 #include <gtest/gtest.h> 44 static const float eps = 1e-6;
52 snapshot_.time_increment = 1.0;
53 snapshot_.readings_per_scan = 4;
54 snapshot_.num_scans = 3;
55 snapshot_.scan_start.resize(3);
71 #define EXPECT_ROSTIME_NEAR(a, b) \ 72 EXPECT_NEAR( (a-b).toSec(), 0.0, eps) \ 73 << "Times don't match: #a: " << a.toSec() << " " << "#b: " << b.toSec() 78 features_.image_points.resize(1);
79 features_.image_points[0].x = .5;
80 features_.image_points[0].y = 1.5;
81 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
90 features_.image_points.resize(1);
91 features_.image_points[0].x = .5;
92 features_.image_points[0].y = 0.01;
93 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
98 features_.image_points[0].y = -0.01;
99 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
100 EXPECT_FALSE(success);
102 features_.image_points[0].y = 2.01;
103 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
104 EXPECT_FALSE(success);
110 features_.image_points.clear();
111 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
112 EXPECT_TRUE(success);
120 features_.image_points.resize(3);
121 features_.image_points[0].x = .5;
122 features_.image_points[0].y = .5;
123 features_.image_points[1].x = 3.5;
124 features_.image_points[1].y = .5;
125 features_.image_points[2].x = 3.5;
126 features_.image_points[2].y = 1.5;
128 success = LaserIntervalCalc::computeInterval(snapshot_, features_, interval_);
129 EXPECT_TRUE(success);
134 int main(
int argc,
char **argv)
136 testing::InitGoogleTest(&argc, argv);
137 return RUN_ALL_TESTS();
#define EXPECT_ROSTIME_NEAR(a, b)
int main(int argc, char **argv)
TEST_F(LaserIntervalCalcTest, easy_single_point)
calibration_msgs::CalibrationPattern features_
calibration_msgs::Interval interval_
calibration_msgs::DenseLaserSnapshot snapshot_