35 #include <gtest/gtest.h> 42 static const float eps = 1e-6;
48 for (
unsigned int i=0; i<N; i++)
66 cache_.setMaxSize(1000);
69 snapshot_.time_increment = 1;
70 snapshot_.readings_per_scan = 3;
71 snapshot_.num_scans = 4;
72 snapshot_.scan_start.resize(4);
76 snapshot_.scan_start[3] =
ros::Time(50.5);
79 success =imager_.update(snapshot_, cache_,
ros::Duration(2,0));
82 image0_ = imager_.getJointImage(0);
83 image1_ = imager_.getJointImage(1);
94 float imageAt(IplImage* image,
int row,
int col,
int channel)
96 return *(((
float*)(image->imageData + row*image->widthStep)) + image->nChannels*col + channel);
101 EXPECT_NEAR(
imageAt(image0_, 0, 0, 0), 5,
eps);
102 EXPECT_NEAR(
imageAt(image0_, 1, 0, 0), 100,
eps);
103 EXPECT_NEAR(
imageAt(image0_, 2, 0, 0), 350,
eps);
104 EXPECT_NEAR(
imageAt(image0_, 0, 2, 0), 25,
eps);
105 EXPECT_NEAR(
imageAt(image0_, 3, 2, 0), 525,
eps);
107 EXPECT_NEAR(
imageAt(image1_, 0, 0, 0), 50,
eps);
108 EXPECT_NEAR(
imageAt(image1_, 3, 2, 0), 5250,
eps);
114 EXPECT_NEAR(
imageAt(image0_, 0, 0, 1), 10,
eps);
115 EXPECT_NEAR(
imageAt(image0_, 0, 1, 1), 10,
eps);
116 EXPECT_NEAR(
imageAt(image0_, 0, 2, 1), 10,
eps);
117 EXPECT_NEAR(
imageAt(image0_, 3, 0, 1), 10,
eps);
118 EXPECT_NEAR(
imageAt(image0_, 3, 1, 1), 10,
eps);
119 EXPECT_NEAR(
imageAt(image0_, 3, 2, 1), 10,
eps);
121 EXPECT_NEAR(
imageAt(image1_, 0, 0, 1), 100,
eps);
122 EXPECT_NEAR(
imageAt(image1_, 0, 1, 1), 100,
eps);
123 EXPECT_NEAR(
imageAt(image1_, 0, 2, 1), 100,
eps);
124 EXPECT_NEAR(
imageAt(image1_, 3, 0, 1), 100,
eps);
125 EXPECT_NEAR(
imageAt(image1_, 3, 1, 1), 100,
eps);
126 EXPECT_NEAR(
imageAt(image1_, 3, 2, 1), 100,
eps);
129 int main(
int argc,
char **argv){
130 testing::InitGoogleTest(&argc, argv);
131 return RUN_ALL_TESTS();
settlerlib::SortedDeque< joint_states_settler::DeflatedJointStates > DeflatedDeque
void populateCache(DeflatedDeque &cache, const ros::Time &start, const unsigned int N)
int main(int argc, char **argv)
std::vector< double > channels_
float imageAt(IplImage *image, int row, int col, int channel)
calibration_msgs::DenseLaserSnapshot snapshot_
TEST_F(JointImager_EasyTests, positions)