Loading tests/Fixtures.h +27 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,33 @@ class FrameSensorModel : public ::testing::Test { } }; class OrbitalFrameSensorModel : public ::testing::Test { protected: csm::Isd isd; UsgsAstroFrameSensorModel *sensorModel; void SetUp() override { sensorModel = NULL; isd.setFilename("data/orbitalFramer.img"); UsgsAstroPlugin frameCameraPlugin; csm::Model *model = frameCameraPlugin.constructModelFromISD( isd, "USGS_ASTRO_FRAME_SENSOR_MODEL"); sensorModel = dynamic_cast<UsgsAstroFrameSensorModel *>(model); ASSERT_NE(sensorModel, nullptr); } void TearDown() override { if (sensorModel) { delete sensorModel; sensorModel = NULL; } } }; class FrameIsdTest : public ::testing::Test { protected: csm::Isd isd; Loading tests/FrameCameraTests.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,29 @@ TEST_F(FrameSensorModel, getImageIdentifier) { EXPECT_EQ("simpleFramerISD", sensorModel->getImageIdentifier()); } TEST_F(OrbitalFrameSensorModel, Center) { csm::ImageCoord imagePt(8.0, 8.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_DOUBLE_EQ(groundPt.x, 1000000.0); EXPECT_DOUBLE_EQ(groundPt.y, 0); EXPECT_DOUBLE_EQ(groundPt.z, 0); } TEST_F(OrbitalFrameSensorModel, GroundPartials) { csm::EcefCoord groundPt(1000000.0, 0.0, 0.0); std::vector<double> partials = sensorModel->computeGroundPartials(groundPt); // Pixels are 100m // lines are increasing z and samples are increasing y in body fixed // lines partials should be 0 except for the z partial which should be 1/100 // sample partials should be 0 except for the y partial which should be 1/100 EXPECT_DOUBLE_EQ(partials[0], 0.0); EXPECT_DOUBLE_EQ(partials[1], 0.0); EXPECT_DOUBLE_EQ(partials[2], 1 / 100.0); EXPECT_DOUBLE_EQ(partials[3], 0.0); EXPECT_DOUBLE_EQ(partials[4], 1 / 100.0); EXPECT_DOUBLE_EQ(partials[5], 0.0); } // Focal Length Tests: TEST_F(FrameStateTest, FL500_OffBody4) { Loading tests/data/orbitalFramer.json 0 → 100644 +59 −0 Original line number Diff line number Diff line { "name_model" : "USGS_ASTRO_FRAME_SENSOR_MODEL", "name_platform" : "TEST_PLATFORM", "name_sensor" : "TEST_SENSOR", "center_ephemeris_time": 1000.0, "detector_sample_summing": 1, "detector_line_summing": 1, "focal2pixel_lines": [0.0, 10.0, 0.0], "focal2pixel_samples": [0.0, 0.0, 10.0], "focal_length_model": { "focal_length": 50 }, "image_lines": 16, "image_samples": 16, "detector_center" : { "line" : 8.0, "sample" : 8.0 }, "optical_distortion": { "radial": { "coefficients": [0.0, 0.0, 0.0] } }, "radii": { "semimajor": 1000, "semiminor": 1000, "unit":"km" }, "reference_height": { "maxheight": 1000, "minheight": -1000, "unit": "m" }, "sensor_position": { "unit": "km", "positions": [ [1050.0, 0.0, 0.0] ], "velocities": [ [ 0.0, 0.0, -1.0] ] }, "sensor_orientation": { "quaternions": [ [0.0, -0.707106781186547, 0, 0.707106781186547] ] }, "starting_detector_line": 0, "starting_detector_sample": 0, "sun_position": { "positions": [ [100.0, 100.0, 0.0] ], "velocities": [ [0.0, 0.0, 0.0] ], "unit": "m" } } Loading
tests/Fixtures.h +27 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,33 @@ class FrameSensorModel : public ::testing::Test { } }; class OrbitalFrameSensorModel : public ::testing::Test { protected: csm::Isd isd; UsgsAstroFrameSensorModel *sensorModel; void SetUp() override { sensorModel = NULL; isd.setFilename("data/orbitalFramer.img"); UsgsAstroPlugin frameCameraPlugin; csm::Model *model = frameCameraPlugin.constructModelFromISD( isd, "USGS_ASTRO_FRAME_SENSOR_MODEL"); sensorModel = dynamic_cast<UsgsAstroFrameSensorModel *>(model); ASSERT_NE(sensorModel, nullptr); } void TearDown() override { if (sensorModel) { delete sensorModel; sensorModel = NULL; } } }; class FrameIsdTest : public ::testing::Test { protected: csm::Isd isd; Loading
tests/FrameCameraTests.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,29 @@ TEST_F(FrameSensorModel, getImageIdentifier) { EXPECT_EQ("simpleFramerISD", sensorModel->getImageIdentifier()); } TEST_F(OrbitalFrameSensorModel, Center) { csm::ImageCoord imagePt(8.0, 8.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); EXPECT_DOUBLE_EQ(groundPt.x, 1000000.0); EXPECT_DOUBLE_EQ(groundPt.y, 0); EXPECT_DOUBLE_EQ(groundPt.z, 0); } TEST_F(OrbitalFrameSensorModel, GroundPartials) { csm::EcefCoord groundPt(1000000.0, 0.0, 0.0); std::vector<double> partials = sensorModel->computeGroundPartials(groundPt); // Pixels are 100m // lines are increasing z and samples are increasing y in body fixed // lines partials should be 0 except for the z partial which should be 1/100 // sample partials should be 0 except for the y partial which should be 1/100 EXPECT_DOUBLE_EQ(partials[0], 0.0); EXPECT_DOUBLE_EQ(partials[1], 0.0); EXPECT_DOUBLE_EQ(partials[2], 1 / 100.0); EXPECT_DOUBLE_EQ(partials[3], 0.0); EXPECT_DOUBLE_EQ(partials[4], 1 / 100.0); EXPECT_DOUBLE_EQ(partials[5], 0.0); } // Focal Length Tests: TEST_F(FrameStateTest, FL500_OffBody4) { Loading
tests/data/orbitalFramer.json 0 → 100644 +59 −0 Original line number Diff line number Diff line { "name_model" : "USGS_ASTRO_FRAME_SENSOR_MODEL", "name_platform" : "TEST_PLATFORM", "name_sensor" : "TEST_SENSOR", "center_ephemeris_time": 1000.0, "detector_sample_summing": 1, "detector_line_summing": 1, "focal2pixel_lines": [0.0, 10.0, 0.0], "focal2pixel_samples": [0.0, 0.0, 10.0], "focal_length_model": { "focal_length": 50 }, "image_lines": 16, "image_samples": 16, "detector_center" : { "line" : 8.0, "sample" : 8.0 }, "optical_distortion": { "radial": { "coefficients": [0.0, 0.0, 0.0] } }, "radii": { "semimajor": 1000, "semiminor": 1000, "unit":"km" }, "reference_height": { "maxheight": 1000, "minheight": -1000, "unit": "m" }, "sensor_position": { "unit": "km", "positions": [ [1050.0, 0.0, 0.0] ], "velocities": [ [ 0.0, 0.0, -1.0] ] }, "sensor_orientation": { "quaternions": [ [0.0, -0.707106781186547, 0, 0.707106781186547] ] }, "starting_detector_line": 0, "starting_detector_sample": 0, "sun_position": { "positions": [ [100.0, 100.0, 0.0] ], "velocities": [ [0.0, 0.0, 0.0] ], "unit": "m" } }