Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rugged-MOD
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
youngcle
Rugged-MOD
Commits
0ef29fc5
Commit
0ef29fc5
authored
7 years ago
by
Guylaine Prat
Browse files
Options
Downloads
Patches
Plain Diff
Add Junit tests for Rugged class.
parent
77060fa4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/org/orekit/rugged/api/RuggedTest.java
+50
-37
50 additions, 37 deletions
src/test/java/org/orekit/rugged/api/RuggedTest.java
src/test/java/org/orekit/rugged/utils/RefiningTest.java
+10
-6
10 additions, 6 deletions
src/test/java/org/orekit/rugged/utils/RefiningTest.java
with
60 additions
and
43 deletions
src/test/java/org/orekit/rugged/api/RuggedTest.java
+
50
−
37
View file @
0ef29fc5
...
...
@@ -1377,59 +1377,72 @@ public class RuggedTest {
@Test
public
void
testDistanceBetweenLOS
()
throws
RuggedException
{
// Disruption to apply to roll, pitch (deg) and factor
final
double
rollValueA
=
0.004
;
final
double
pitchValueA
=
0.0008
;
final
double
factorValueA
=
1.000000001
;
final
double
pitchValueB
=
-
0.0008
;
RefiningTest
refiningTest
=
new
RefiningTest
();
refiningTest
.
InitRefiningTest
();
refiningTest
.
InitRefiningTest
(
rollValueA
,
pitchValueA
,
factorValueA
,
pitchValueB
);
final
SensorPixel
realPixelA
=
new
SensorPixel
(
2005.015883575199
,
18004.968656395424
);
final
SensorPixel
realPixelB
=
new
SensorPixel
(
4798.487736488162
,
13952.2195710654
);
double
[]
distancesBetweenLOS
=
refiningTest
.
computeDistancesBetweenLOS
(
realPixelA
,
realPixelB
);
double
expectedDistanceBetweenLOS
=
1.432402353
5733088
;
// 3.9004125582817846
double
expectedDistanceToTheGround
=
6367488.1100
70567
;
// 6368020.030898279
double
expectedDistanceBetweenLOS
=
1.432402353
4834665
;
double
expectedDistanceToTheGround
=
6367488.1100
62852
;
Assert
.
assertEquals
(
expectedDistanceBetweenLOS
,
distancesBetweenLOS
[
0
],
1
.
e
-
2
);
Assert
.
assertEquals
(
expectedDistanceToTheGround
,
distancesBetweenLOS
[
1
],
5
.
e
-
1
);
}
Assert
.
assertEquals
(
expectedDistanceBetweenLOS
,
distancesBetweenLOS
[
0
],
1
.
e
-
10
);
Assert
.
assertEquals
(
expectedDistanceToTheGround
,
distancesBetweenLOS
[
1
],
1
.
e
-
5
);
}
@Test
public
void
testDistanceBetweenLOSDerivatives
()
throws
RuggedException
,
NoSuchMethodException
,
SecurityException
,
IllegalAccessException
,
IllegalArgumentException
,
InvocationTargetException
{
RefiningTest
refiningTest
=
new
RefiningTest
();
refiningTest
.
InitRefiningTest
();
// Disruption to apply to roll, pitch (deg) and factor
final
double
rollValueA
=
0.004
;
final
double
pitchValueA
=
0.0008
;
final
double
factorValueA
=
1.000000001
;
final
double
pitchValueB
=
-
0.0008
;
RefiningTest
refiningTest
=
new
RefiningTest
();
refiningTest
.
InitRefiningTest
(
rollValueA
,
pitchValueA
,
factorValueA
,
pitchValueB
);
final
SensorPixel
realPixelA
=
new
SensorPixel
(
2005.015883575199
,
18004.968656395424
);
final
SensorPixel
realPixelB
=
new
SensorPixel
(
4798.487736488162
,
13952.2195710654
);
double
losDistance
=
1.4324023534834665
;
double
earthDistance
=
6367488.110062852
;
final
SensorPixel
realPixelA
=
new
SensorPixel
(
2005.015883575199
,
18004.968656395424
);
final
SensorPixel
realPixelB
=
new
SensorPixel
(
4798.487736488162
,
13952.2195710654
);
DerivativeStructure
[]
distancesBetweenLOSwithDS
=
refiningTest
.
computeDistancesBetweenLOSDerivatives
(
realPixelA
,
realPixelB
,
losDistance
,
earthDistance
);
// Expected distances between LOS and to the ground
double
expectedDistanceBetweenLOS
=
1.4324023534834665
;
double
expectedDistanceToTheGround
=
6367488.110062852
;
// Minimum distance between LOS
DerivativeStructure
dMin
=
distancesBetweenLOSwithDS
[
0
];
// [1.4324023534834665, 153938.2318141503, 679398.14124085, -12779.33148208561, -191388.29547926865, -669127.0811123198]
// Minimum distance to the ground
DerivativeStructure
dCentralBody
=
distancesBetweenLOSwithDS
[
1
];
// [6367488.110062852, 7018752.447074092, -1578384.972353925, -589929.2355500134, -6850070.113251391, 1958371.974455633]
System
.
out
.
println
(
dMin
.
getValue
());
System
.
out
.
println
(
dMin
.
getReal
());
for
(
int
i
=
0
;
i
<
dMin
.
getAllDerivatives
().
length
;
i
++)
{
System
.
out
.
println
(
"i = "
+
i
+
" : "
+
dMin
.
getAllDerivatives
()[
i
]);
}
System
.
out
.
println
(
dMin
.
getFreeParameters
());
System
.
out
.
println
(
dMin
.
getOrder
());
// int[] orders = {0,0,0,0};
// System.out.println(dMin.getPartialDerivative(orders));
System
.
out
.
println
(
dCentralBody
.
getValue
());
System
.
out
.
println
(
dCentralBody
.
getReal
());
for
(
int
i
=
0
;
i
<
dCentralBody
.
getAllDerivatives
().
length
;
i
++)
{
System
.
out
.
println
(
"i = "
+
i
+
" : "
+
dCentralBody
.
getAllDerivatives
()[
i
]);
}
System
.
out
.
println
(
dCentralBody
.
getFreeParameters
());
System
.
out
.
println
(
dCentralBody
.
getOrder
());
// Expected derivatives for
// minimum distance between LOS
double
[]
expectedDminDerivatives
=
{
1.4324023534834665
,
153938.2318141503
,
679398.14124085
,
-
12779.33148208561
,
-
191388.29547926865
,
-
669127.0811123198
}
;
// minimum distance to the ground
double
[]
expectedDcentralBodyDerivatives
=
{
6367488.110062852
,
7018752.447074092
,
-
1578384.972353925
,
-
589929.2355500134
,
-
6850070.113251391
,
1958371.974455633
};
DerivativeStructure
[]
distancesBetweenLOSwithDS
=
refiningTest
.
computeDistancesBetweenLOSDerivatives
(
realPixelA
,
realPixelB
,
expectedDistanceBetweenLOS
,
expectedDistanceToTheGround
);
// Minimum distance between LOS
DerivativeStructure
dMin
=
distancesBetweenLOSwithDS
[
0
];
// Minimum distance to the ground
DerivativeStructure
dCentralBody
=
distancesBetweenLOSwithDS
[
1
];
Assert
.
assertEquals
(
expectedDistanceBetweenLOS
,
dMin
.
getValue
(),
1
.
e
-
10
);
Assert
.
assertEquals
(
expectedDistanceToTheGround
,
dCentralBody
.
getValue
()
,
1
.
e
-
5
);
for
(
int
i
=
0
;
i
<
dMin
.
getAllDerivatives
().
length
;
i
++)
{
Assert
.
assertEquals
(
expectedDminDerivatives
[
i
],
dMin
.
getAllDerivatives
()[
i
],
1
.
e
-
10
);
}
for
(
int
i
=
0
;
i
<
dCentralBody
.
getAllDerivatives
().
length
;
i
++)
{
Assert
.
assertEquals
(
expectedDcentralBodyDerivatives
[
i
],
dCentralBody
.
getAllDerivatives
()[
i
],
1
.
e
-
10
);
}
}
@Before
public
void
setUp
()
throws
OrekitException
,
URISyntaxException
{
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/orekit/rugged/utils/RefiningTest.java
+
10
−
6
View file @
0ef29fc5
...
...
@@ -99,9 +99,13 @@ public class RefiningTest {
/** Initialize refining tests
* @param rollDisruptionA disruption to apply to roll angle for sensor A (deg)
* @param pitchDisruptionA disruption to apply to pitch angle for sensor A (deg)
* @param factorDisruptionA disruption to apply to homothety factor for sensor A
* @param pitchDisruptionB disruption to apply to pitch angle for sensor B (deg)
* @throws RuggedException
*/
public
void
InitRefiningTest
()
throws
RuggedException
{
public
void
InitRefiningTest
(
double
rollDisruptionA
,
double
pitchDisruptionA
,
double
factorDisruptionA
,
double
pitchDisruptionB
)
throws
RuggedException
{
try
{
String
path
=
getClass
().
getClassLoader
().
getResource
(
"orekit-data"
).
toURI
().
getPath
();
...
...
@@ -207,10 +211,10 @@ public class RefiningTest {
// Initialize disruptions:
// -----------------------
// Introduce rotations around instrument axes (roll and pitch angles, scale factor)
final
double
rollValueA
=
FastMath
.
toRadians
(
0.004
);
final
double
pitchValueA
=
FastMath
.
toRadians
(
0.0008
);
final
double
pitchValueB
=
FastMath
.
toRadians
(
-
0.0008
);
final
double
factorValue
=
1.000000001
;
final
double
rollValueA
=
FastMath
.
toRadians
(
rollDisruptionA
);
final
double
pitchValueA
=
FastMath
.
toRadians
(
pitchDisruptionA
);
final
double
pitchValueB
=
FastMath
.
toRadians
(
pitchDisruptionB
);
final
double
factorValue
A
=
factorDisruptionA
;
// Select parameters to adjust
setSelectedRoll
(
ruggedA
,
sensorNameA
);
...
...
@@ -224,7 +228,7 @@ public class RefiningTest {
// Apply disruptions on physical model (acquisition A)
applyDisruptionsRoll
(
ruggedA
,
sensorNameA
,
rollValueA
);
applyDisruptionsPitch
(
ruggedA
,
sensorNameA
,
pitchValueA
);
applyDisruptionsFactor
(
ruggedA
,
sensorNameA
,
factorValue
);
applyDisruptionsFactor
(
ruggedA
,
sensorNameA
,
factorValue
A
);
// Apply disruptions on physical model (acquisition B)
applyDisruptionsPitch
(
ruggedB
,
sensorNameB
,
pitchValueB
);
...
...
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