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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
6af0cfae
Commit
6af0cfae
authored
4 years ago
by
Jesse Mapel
Committed by
Jesse Mapel
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated ls to re-interp states
parent
da685687
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/UsgsAstroLsSensorModel.cpp
+42
-35
42 additions, 35 deletions
src/UsgsAstroLsSensorModel.cpp
tests/LineScanCameraTests.cpp
+2
-2
2 additions, 2 deletions
tests/LineScanCameraTests.cpp
tests/data/orbitalLineScan.json
+19
-19
19 additions, 19 deletions
tests/data/orbitalLineScan.json
with
63 additions
and
56 deletions
src/UsgsAstroLsSensorModel.cpp
+
42
−
35
View file @
6af0cfae
...
...
@@ -2286,17 +2286,50 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(
state
[
"m_referencePointXyz"
]
=
std
::
vector
<
double
>
(
3
,
0.0
);
MESSAGE_LOG
(
"m_referencePointXyz: {} "
,
state
[
"m_referencePointXyz"
].
dump
())
// Sun position and velocity are required for getIlluminationDirection
// Sun position and sensor position use the same times so compute that now
ale
::
States
inst_state
=
ale
::
getInstrumentPosition
(
jsonIsd
);
std
::
vector
<
double
>
ephemTime
=
inst_state
.
getTimes
();
double
startTime
=
ephemTime
.
front
();
double
stopTime
=
ephemTime
.
back
();
// Force at least 25 nodes to help with lagrange interpolation
// These also have to be equally spaced for lagrange interpolation
if
(
ephemTime
.
size
()
<
25
)
{
ephemTime
.
resize
(
25
);
}
double
timeStep
=
(
stopTime
-
startTime
)
/
(
ephemTime
.
size
()
-
1
);
for
(
size_t
i
=
0
;
i
<
ephemTime
.
size
();
i
++
)
{
ephemTime
[
i
]
=
startTime
+
i
*
timeStep
;
}
try
{
state
[
"m_dtEphem"
]
=
timeStep
;
MESSAGE_LOG
(
"m_dtEphem: {} "
,
state
[
"m_dtEphem"
].
dump
())
}
catch
(...)
{
parsingWarnings
->
push_back
(
csm
::
Warning
(
csm
::
Warning
::
DATA_NOT_AVAILABLE
,
"dt_ephemeris not in ISD"
,
"UsgsAstroFrameSensorModel::constructStateFromIsd()"
));
MESSAGE_LOG
(
"m_dtEphem not in ISD"
)
}
try
{
state
[
"m_t0Ephem"
]
=
startTime
-
ale
::
getCenterTime
(
jsonIsd
);
MESSAGE_LOG
(
"t0_ephemeris: {}"
,
state
[
"m_t0Ephem"
].
dump
())
}
catch
(...)
{
parsingWarnings
->
push_back
(
csm
::
Warning
(
csm
::
Warning
::
DATA_NOT_AVAILABLE
,
"t0_ephemeris not in ISD"
,
"UsgsAstroFrameSensorModel::constructStateFromIsd()"
));
MESSAGE_LOG
(
"t0_ephemeris not in ISD"
)
}
ale
::
States
sunState
=
ale
::
getSunPosition
(
jsonIsd
);
std
::
vector
<
ale
::
State
>
sunStates
=
sunState
.
getStates
();
std
::
vector
<
double
>
ephemTime
=
sunState
.
getTimes
();
ale
::
Orientations
j2000_to_target
=
ale
::
getBodyRotation
(
jsonIsd
);
ale
::
State
rotatedSunState
;
ale
::
State
interpSunState
,
rotatedSunState
;
std
::
vector
<
double
>
sunPositions
=
{};
std
::
vector
<
double
>
sunVelocities
=
{};
for
(
int
i
=
0
;
i
<
ephemTime
.
size
();
i
++
)
{
rotatedSunState
=
j2000_to_target
.
rotateStateAt
(
ephemTime
[
i
],
sunStates
[
i
]);
interpSunState
=
sunState
.
getState
(
ephemTime
[
i
],
ale
::
SPLINE
);
rotatedSunState
=
j2000_to_target
.
rotateStateAt
(
ephemTime
[
i
],
interpSunState
);
// ALE operates in Km and we want m
sunPositions
.
push_back
(
rotatedSunState
.
position
.
x
*
1000
);
sunPositions
.
push_back
(
rotatedSunState
.
position
.
y
*
1000
);
...
...
@@ -2363,41 +2396,17 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(
state
[
"m_detectorSampleOrigin"
].
dump
(),
state
[
"m_detectorLineOrigin"
].
dump
())
ale
::
States
inst_state
=
ale
::
getInstrumentPosition
(
jsonIsd
);
// These are exlusive to LineScanners, leave them here for now.
ephemTime
=
inst_state
.
getTimes
();
try
{
state
[
"m_dtEphem"
]
=
(
ephemTime
[
ephemTime
.
size
()
-
1
]
-
ephemTime
[
0
])
/
(
ephemTime
.
size
()
-
1
);
MESSAGE_LOG
(
"m_dtEphem: {} "
,
state
[
"m_dtEphem"
].
dump
())
}
catch
(...)
{
parsingWarnings
->
push_back
(
csm
::
Warning
(
csm
::
Warning
::
DATA_NOT_AVAILABLE
,
"dt_ephemeris not in ISD"
,
"UsgsAstroFrameSensorModel::constructStateFromIsd()"
));
MESSAGE_LOG
(
"m_dtEphem not in ISD"
)
}
try
{
state
[
"m_t0Ephem"
]
=
ephemTime
[
0
]
-
ale
::
getCenterTime
(
jsonIsd
);
MESSAGE_LOG
(
"t0_ephemeris: {}"
,
state
[
"m_t0Ephem"
].
dump
())
}
catch
(...)
{
parsingWarnings
->
push_back
(
csm
::
Warning
(
csm
::
Warning
::
DATA_NOT_AVAILABLE
,
"t0_ephemeris not in ISD"
,
"UsgsAstroFrameSensorModel::constructStateFromIsd()"
));
MESSAGE_LOG
(
"t0_ephemeris not in ISD"
)
}
ale
::
Orientations
j2000_to_sensor
=
ale
::
getInstrumentPointing
(
jsonIsd
);
ephemTime
=
inst_state
.
getTimes
();
std
::
vector
<
ale
::
State
>
instStates
=
inst_state
.
getStates
();
ale
::
State
rotatedInstState
;
ale
::
State
rotatedInstStateInv
;
ale
::
State
interpInstState
,
rotatedInstState
;
std
::
vector
<
double
>
positions
=
{};
std
::
vector
<
double
>
velocities
=
{};
for
(
int
i
=
0
;
i
<
ephemTime
.
size
();
i
++
)
{
interpInstState
=
inst_state
.
getState
(
ephemTime
[
i
],
ale
::
SPLINE
);
rotatedInstState
=
j2000_to_target
.
rotateStateAt
(
ephemTime
[
i
],
instState
s
[
i
]
,
ale
::
SLERP
);
j2000_to_target
.
rotateStateAt
(
ephemTime
[
i
],
in
terpIn
stState
,
ale
::
SLERP
);
// ALE operates in Km and we want m
positions
.
push_back
(
rotatedInstState
.
position
.
x
*
1000
);
positions
.
push_back
(
rotatedInstState
.
position
.
y
*
1000
);
...
...
@@ -2562,10 +2571,8 @@ csm::EcefVector UsgsAstroLsSensorModel::getSunPosition(
// If there are multiple positions, use Lagrange interpolation
if
((
numSunPositions
/
3
)
>
1
)
{
double
sunPos
[
3
];
double
endTime
=
m_t0Ephem
+
(
m_dtEphem
*
((
m_numPositions
/
3
)));
double
sun_dtEphem
=
(
endTime
-
m_t0Ephem
)
/
(
numSunPositions
/
3
);
lagrangeInterp
(
numSunPositions
/
3
,
&
m_sunPosition
[
0
],
m_t0Ephem
,
sun
_dtEphem
,
imageTime
,
3
,
8
,
sunPos
);
m
_dtEphem
,
imageTime
,
3
,
8
,
sunPos
);
sunPosition
.
x
=
sunPos
[
0
];
sunPosition
.
y
=
sunPos
[
1
];
sunPosition
.
z
=
sunPos
[
2
];
...
...
This diff is collapsed.
Click to expand it.
tests/LineScanCameraTests.cpp
+
2
−
2
View file @
6af0cfae
...
...
@@ -192,9 +192,9 @@ TEST_F(OrbitalLineScanSensorModel, getSunPositionStationary) {
TEST_F
(
OrbitalLineScanSensorModel
,
Center
)
{
csm
::
ImageCoord
imagePt
(
8.5
,
8.0
);
csm
::
EcefCoord
groundPt
=
sensorModel
->
imageToGround
(
imagePt
,
0.0
);
EXPECT_NEAR
(
groundPt
.
x
,
999999.670
4
04
88799
,
1e-9
);
EXPECT_NEAR
(
groundPt
.
x
,
999999.67004
351015
,
1e-9
);
EXPECT_NEAR
(
groundPt
.
y
,
0.0
,
1e-9
);
EXPECT_NEAR
(
groundPt
.
z
,
-
81
1.90523782723039
,
1e-9
);
EXPECT_NEAR
(
groundPt
.
z
,
-
81
2.35021438796923
,
1e-9
);
}
TEST_F
(
OrbitalLineScanSensorModel
,
Inversion
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/data/orbitalLineScan.json
+
19
−
19
View file @
6af0cfae
...
...
@@ -61,22 +61,22 @@
[
1049.99892857
,
0.0
,
-1.49999949
]
],
"velocities"
:
[
[
-0.0
,
0.0
,
-1050
.
0
],
[
-0.1
,
0.0
,
-1049
.
99999524
],
[
-0.2
,
0.0
,
-1049
.
99998095
],
[
-0.3
,
0.0
,
-1049
.
99995714
],
[
-0.39999999
,
0.0
,
-1049
.
99992381
],
[
-0.49999998
,
0.0
,
-1049
.
99988095
],
[
-0.59999997
,
0.0
,
-1049
.
99982857
],
[
-0.69999995
,
0.0
,
-1049
.
99976667
],
[
-0.79999992
,
0.0
,
-1049
.
99969524
],
[
-0.89999989
,
0.0
,
-1049
.
99961429
],
[
-0.99999985
,
0.0
,
-1049
.
99952381
],
[
-1.0999998
,
0.0
,
-1049
.
99942381
],
[
-1.19999974
,
0.0
,
-1049
.
99931429
],
[
-1.29999967
,
0.0
,
-1049
.
99919524
],
[
-1.39999959
,
0.0
,
-1049
.
99906667
],
[
-1.49999949
,
0.0
,
-1049
.
99892857
]
[
-0.0
,
0.0
,
-1
.
0500
],
[
-0.1
,
0.0
,
-1
.
04999999524
],
[
-0.2
,
0.0
,
-1
.
04999998095
],
[
-0.3
,
0.0
,
-1
.
04999995714
],
[
-0.39999999
,
0.0
,
-1
.
04999992381
],
[
-0.49999998
,
0.0
,
-1
.
04999988095
],
[
-0.59999997
,
0.0
,
-1
.
04999982857
],
[
-0.69999995
,
0.0
,
-1
.
04999976667
],
[
-0.79999992
,
0.0
,
-1
.
04999969524
],
[
-0.89999989
,
0.0
,
-1
.
04999961429
],
[
-0.99999985
,
0.0
,
-1
.
04999952381
],
[
-1.0999998
,
0.0
,
-1
.
04999942381
],
[
-1.19999974
,
0.0
,
-1
.
04999931429
],
[
-1.29999967
,
0.0
,
-1
.
04999919524
],
[
-1.39999959
,
0.0
,
-1
.
04999906667
],
[
-1.49999949
,
0.0
,
-1
.
04999892857
]
],
"ephemeris_times"
:
[
999.2
,
...
...
@@ -225,9 +225,9 @@
],
"velocities"
:
[
[
0.125
,
0.125
,
0.125
],
[
0.125
,
0.125
,
0.12
],
[
0.125
,
0.125
,
0.12
],
[
0.125
,
0.125
,
0.12
]
[
0.125
,
0.125
,
0.12
5
],
[
0.125
,
0.125
,
0.12
5
],
[
0.125
,
0.125
,
0.12
5
]
],
"ephemeris_times"
:
[
999.2
,
...
...
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