Skip to content
Snippets Groups Projects
Unverified Commit 52649bc0 authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Added more LS tests (#207)

parent ab7ed6f1
No related branches found
No related tags found
No related merge requests found
...@@ -200,6 +200,33 @@ class ConstAngularVelocityLineScanSensorModel : public ::testing::Test { ...@@ -200,6 +200,33 @@ class ConstAngularVelocityLineScanSensorModel : public ::testing::Test {
} }
}; };
class OrbitalLineScanSensorModel : public ::testing::Test {
protected:
csm::Isd isd;
UsgsAstroLsSensorModel *sensorModel;
void SetUp() override {
sensorModel = NULL;
isd.setFilename("data/orbitalLineScan.img");
UsgsAstroPlugin cameraPlugin;
csm::Model *model = cameraPlugin.constructModelFromISD(
isd,
"USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL");
sensorModel = dynamic_cast<UsgsAstroLsSensorModel *>(model);
ASSERT_NE(sensorModel, nullptr);
}
void TearDown() override {
if (sensorModel) {
delete sensorModel;
sensorModel = NULL;
}
}
};
#endif #endif
...@@ -121,3 +121,60 @@ TEST_F(ConstVelocityLineScanSensorModel, calculateAttitudeCorrection) { ...@@ -121,3 +121,60 @@ TEST_F(ConstVelocityLineScanSensorModel, calculateAttitudeCorrection) {
EXPECT_NEAR(attCorr[7], 0, 1e-8); EXPECT_NEAR(attCorr[7], 0, 1e-8);
EXPECT_NEAR(attCorr[8], 0, 1e-8); EXPECT_NEAR(attCorr[8], 0, 1e-8);
} }
TEST_F(OrbitalLineScanSensorModel, Center) {
csm::ImageCoord imagePt(8.5, 8.0);
csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0);
EXPECT_DOUBLE_EQ(groundPt.x, 999999.680000017);
EXPECT_DOUBLE_EQ(groundPt.y, 0.0);
EXPECT_DOUBLE_EQ(groundPt.z, -799.99991466668735);
}
TEST_F(OrbitalLineScanSensorModel, Inversion) {
for (double line = 0.5; line < 16; line++) {
csm::ImageCoord imagePt(line, 8);
csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0);
csm::ImageCoord imageReprojPt = sensorModel->groundToImage(groundPt);
// groundToImage has a default precision of 0.001m and each pixel is 100m
// so we should be within 0.1 pixels
EXPECT_NEAR(imagePt.line, imageReprojPt.line, 0.1);
EXPECT_NEAR(imagePt.samp, imageReprojPt.samp, 0.1);
}
}
TEST_F(OrbitalLineScanSensorModel, ImageToGroundHeight) {
csm::ImageCoord imagePt(8.5, 8);
csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 100.0);
double height = sqrt(groundPt.x*groundPt.x +
groundPt.y*groundPt.y +
groundPt.z*groundPt.z);
EXPECT_DOUBLE_EQ(height, 1000100);
}
TEST_F(OrbitalLineScanSensorModel, InversionHeight) {
for (double line = 0.5; line < 16; line++) {
csm::ImageCoord imagePt(line, 8);
csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 100.0);
csm::ImageCoord imageReprojPt = sensorModel->groundToImage(groundPt);
// groundToImage has a default precision of 0.001m and each pixel is 100m
// so we should be within 0.1 pixels
EXPECT_NEAR(imagePt.line, imageReprojPt.line, 0.1);
EXPECT_NEAR(imagePt.samp, imageReprojPt.samp, 0.1);
}
}
TEST_F(OrbitalLineScanSensorModel, InversionReallyHigh) {
for (double line = 0.5; line < 16; line++) {
csm::ImageCoord imagePt(line, 8);
csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 49000.0);
csm::ImageCoord imageReprojPt = sensorModel->groundToImage(groundPt);
// groundToImage has a default precision of 0.001m and each pixel is 2m
// so we should be within 0.002 pixels
EXPECT_NEAR(imagePt.line, imageReprojPt.line, 0.002);
EXPECT_NEAR(imagePt.samp, imageReprojPt.samp, 0.002);
}
}
{
"name_model" : "USGS_ASTRO_LINE_SCANNER_SENSOR_MODEL",
"name_platform" : "TEST_PLATFORM",
"name_sensor" : "TEST_SENSOR",
"center_ephemeris_time": 1000.0,
"starting_ephemeris_time": 999.2,
"line_scan_rate": [
[0.5, -0.8, 0.1]
],
"detector_sample_summing": 1,
"detector_line_summing": 1,
"t0_ephemeris": -0.8,
"dt_ephemeris": 0.1,
"t0_quaternion": -0.8,
"dt_quaternion": 0.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" : 0.5,
"sample" : 8.0
},
"interpolation_method": "lagrange",
"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],
[1049.99999475, 0.0, -0.104999999825],
[1049.9999790000002, 0.0, -0.2099999986],
[1049.9999527500004, 0.0, -0.3149999952750001],
[1049.9999160000013, 0.0, -0.4199999888000002],
[1049.9998687500029, 0.0, -0.5249999781250003],
[1049.9998110000056, 0.0, -0.6299999622000008],
[1049.9997427500105, 0.0, -0.7349999399750016],
[1049.999664000018, 0.0, -0.839999910400003],
[1049.9995747500286, 0.0, -0.9449998724250054],
[1049.999475000044, 0.0, -1.049999825000009],
[1049.999364750064, 0.0, -1.1549997670750143],
[1049.9992440000908, 0.0, -1.259999697600022],
[1049.9991127501248, 0.0, -1.3649996155250328],
[1049.9989710001682, 0.0, -1.4699995198000473],
[1049.9988187502213, 0.0, -1.5749994093750666]
],
"velocities": [
[ 0.0, 0.0, -1.0],
[-0.0000999999998333, 0.0, -0.999999995],
[-0.0001999999986667, 0.0, -0.9999999800000001],
[-0.0002999999955, 0.0, -0.9999999550000004],
[-0.0003999999893333, 0.0, -0.9999999200000013],
[-0.0004999999791667, 0.0, -0.9999998750000026],
[-0.000599999964, 0.0, -0.9999998200000054],
[-0.0006999999428333, 0.0, -0.9999997550000099],
[-0.0007999999146667, 0.0, -0.999999680000017],
[-0.0008999998785, 0.0, -0.9999995950000273],
[-0.0009999998333333, 0.0, -0.9999995000000418],
[-0.0010999997781667, 0.0, -0.999999395000061],
[-0.001199999712, 0.0, -0.9999992800000864],
[-0.0012999996338334, 0.0, -0.9999991550001189],
[-0.0013999995426667, 0.0, -0.9999990200001602],
[-0.0014999994375001, 0.0, -0.9999988750002108]
]
},
"sensor_orientation": {
"quaternions": [
[0.0, 0.707106781186547, 0, 0.707106781186547],
[0.0, 0.70707142496362, 0, -0.707142135641709],
[0.0, 0.707036066973013, 0, -0.707177488329014],
[0.0, 0.707000707214816, 0, -0.707212839248377],
[0.0, 0.706965345689117, 0, -0.707248188399706],
[0.0, 0.706929982396005, 0, -0.707283535782916],
[0.0, 0.706894617335569, 0, -0.707318881397917],
[0.0, 0.706859250507895, 0, -0.70735422524462],
[0.0, 0.706823881913074, 0, -0.707389567322938],
[0.0, 0.706788511551192, 0, -0.707424907632782],
[0.0, 0.70675313942234, 0, -0.707460246174064],
[0.0, 0.706717765526604, 0, -0.707495582946695],
[0.0, 0.706682389864075, 0, -0.707530917950587],
[0.0, 0.706647012434839, 0, -0.707566251185652],
[0.0, 0.706611633238985, 0, -0.707601582651801],
[0.0, 0.706576252276603, 0, -0.707636912348946]
]
},
"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"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment