From b2ae4b316d1a8afabcc288f5ae62cdc0be853352 Mon Sep 17 00:00:00 2001 From: Jesse Mapel <jmapel@usgs.gov> Date: Fri, 12 Apr 2019 10:27:38 -0700 Subject: [PATCH] Added ground partials test and orbital framer ISD --- tests/Fixtures.h | 27 ++++++++++++++++ tests/FrameCameraTests.cpp | 23 ++++++++++++++ tests/data/orbitalFramer.json | 59 +++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 tests/data/orbitalFramer.json diff --git a/tests/Fixtures.h b/tests/Fixtures.h index a020188..afc6959 100644 --- a/tests/Fixtures.h +++ b/tests/Fixtures.h @@ -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; diff --git a/tests/FrameCameraTests.cpp b/tests/FrameCameraTests.cpp index 20ad76d..35f953e 100644 --- a/tests/FrameCameraTests.cpp +++ b/tests/FrameCameraTests.cpp @@ -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) { diff --git a/tests/data/orbitalFramer.json b/tests/data/orbitalFramer.json new file mode 100644 index 0000000..1ee3130 --- /dev/null +++ b/tests/data/orbitalFramer.json @@ -0,0 +1,59 @@ +{ + "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" + } +} -- GitLab