Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Usgscsm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
41a67770
Commit
41a67770
authored
6 years ago
by
Kaj Williams
Browse files
Options
Downloads
Patches
Plain Diff
initial frame tests
parent
963e250a
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
tests/CMakeLists.txt
+1
-1
1 addition, 1 deletion
tests/CMakeLists.txt
tests/FrameCameraTests.cpp
+77
-0
77 additions, 0 deletions
tests/FrameCameraTests.cpp
tests/TestMain.cpp
+6
-0
6 additions, 0 deletions
tests/TestMain.cpp
tests/data/simpleFramerISD.json
+1
-1
1 addition, 1 deletion
tests/data/simpleFramerISD.json
with
85 additions
and
2 deletions
tests/CMakeLists.txt
+
1
−
1
View file @
41a67770
cmake_minimum_required
(
VERSION 3.10
)
# Link runCSMCameraModelTests with what we want to test and the GTest and pthread library
add_executable
(
runCSMCameraModelTests TestyMcTestFace.cpp
)
add_executable
(
runCSMCameraModelTests TestyMcTestFace.cpp
FrameCameraTests.cpp
)
target_link_libraries
(
runCSMCameraModelTests usgscsm
${
GTEST_LIBRARIES
}
${
GTEST_MAIN_LIBRARIES
}
pthread
)
gtest_discover_tests
(
runCSMCameraModelTests WORKING_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/tests
)
This diff is collapsed.
Click to expand it.
tests/FrameCameraTests.cpp
0 → 100644
+
77
−
0
View file @
41a67770
#include
"UsgsAstroFramePlugin.h"
#include
"UsgsAstroFrameSensorModel.h"
#include
<json.hpp>
#include
<sstream>
#include
<fstream>
#include
<gtest/gtest.h>
using
json
=
nlohmann
::
json
;
class
FrameSensorModel
:
public
::
testing
::
Test
{
protected:
UsgsAstroFrameSensorModel
*
sensorModel
;
void
SetUp
()
override
{
sensorModel
=
NULL
;
std
::
ifstream
isdFile
(
"data/simpleFramerISD.json"
);
json
jsonIsd
=
json
::
parse
(
isdFile
);
csm
::
Isd
isd
;
for
(
json
::
iterator
it
=
jsonIsd
.
begin
();
it
!=
jsonIsd
.
end
();
++
it
)
{
json
jsonValue
=
it
.
value
();
if
(
jsonValue
.
size
()
>
1
)
{
for
(
int
i
=
0
;
i
<
jsonValue
.
size
();
i
++
)
{
isd
.
addParam
(
it
.
key
(),
jsonValue
[
i
].
dump
());
}
}
else
{
isd
.
addParam
(
it
.
key
(),
jsonValue
.
dump
());
}
}
isdFile
.
close
();
UsgsAstroFramePlugin
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
;
}
}
};
TEST_F
(
FrameSensorModel
,
Center
)
{
csm
::
ImageCoord
imagePt
(
7.5
,
7.5
);
csm
::
EcefCoord
groundPt
=
sensorModel
->
imageToGround
(
imagePt
,
0.0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
x
,
10.0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
y
,
0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
z
,
0
);
}
TEST_F
(
FrameSensorModel
,
OffBody
)
{
csm
::
ImageCoord
imagePt
(
0.0
,
15.0
);
csm
::
EcefCoord
groundPt
=
sensorModel
->
imageToGround
(
imagePt
,
0.0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
x
,
0.44979759
);
EXPECT_DOUBLE_EQ
(
groundPt
.
y
,
-
14.99325304
);
EXPECT_DOUBLE_EQ
(
groundPt
.
z
,
14.99325304
);
}
TEST_F
(
FrameSensorModel
,
SlightlyOffCenter
)
{
csm
::
ImageCoord
imagePt
(
6.5
,
7.5
);
csm
::
EcefCoord
groundPt
=
sensorModel
->
imageToGround
(
imagePt
,
0.0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
x
,
9.80194018
);
EXPECT_DOUBLE_EQ
(
groundPt
.
y
,
0
);
EXPECT_DOUBLE_EQ
(
groundPt
.
z
,
1.98039612
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/TestMain.cpp
0 → 100644
+
6
−
0
View file @
41a67770
#include
"gtest/gtest.h"
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/data/simpleFramerISD.json
+
1
−
1
View file @
41a67770
...
...
@@ -12,7 +12,7 @@
"focal_length"
:
50
,
"focal_length_epsilon"
:
1.0
,
"ifov"
:
6.0
,
"model_name"
:
"U
sgsAstroFramePluginCSM
"
,
"model_name"
:
"U
SGS_ASTRO_FRAME_SENSOR_MODEL
"
,
"spacecraft_name"
:
"TEST_CRAFT"
,
"instrument_id"
:
"TEST_SENSOR"
,
"target_name"
:
"TEST_BALL"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment