Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Orekit
Orekit
Commits
de9a4c94
Commit
de9a4c94
authored
Apr 26, 2022
by
Bryan Cazabonne
Browse files
Merge remote-tracking branch 'forkLouis/Issue-786' into pre-release
parents
ff3ac734
b87636ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/orekit/orbits/Orbit.java
View file @
de9a4c94
...
...
@@ -163,23 +163,26 @@ public abstract class Orbit
*/
protected
static
boolean
hasNonKeplerianAcceleration
(
final
PVCoordinates
pva
,
final
double
mu
)
{
final
Vector3D
a
=
pva
.
getAcceleration
();
if
(
a
==
null
)
{
return
false
;
}
final
Vector3D
p
=
pva
.
getPosition
();
final
double
r2
=
p
.
getNormSq
();
final
double
r
=
FastMath
.
sqrt
(
r2
);
final
Vector3D
keplerianAcceleration
=
new
Vector3D
(-
mu
/
(
r
*
r2
),
p
);
if
(
a
.
getNorm
()
>
1.0
e
-
9
*
keplerianAcceleration
.
getNorm
())
{
// Check if acceleration is null or relatively close to 0 compared to the keplerain acceleration
final
Vector3D
a
=
pva
.
getAcceleration
();
if
(
a
==
null
||
a
.
getNorm
()
<
1
e
-
9
*
keplerianAcceleration
.
getNorm
())
{
return
false
;
}
final
Vector3D
nonKeplerianAcceleration
=
a
.
subtract
(
keplerianAcceleration
);
if
(
nonKeplerianAcceleration
.
getNorm
()
>
1
e
-
9
*
keplerianAcceleration
.
getNorm
())
{
// we have a relevant acceleration, we can compute derivatives
return
true
;
}
else
{
// the provided acceleration is either too small to be reliable (probably even 0), or NaN
return
false
;
}
}
/** Get the orbit type.
...
...
src/test/java/org/orekit/orbits/FieldCartesianOrbitTest.java
View file @
de9a4c94
...
...
@@ -599,9 +599,8 @@ public class FieldCartesianOrbitTest {
FieldVector3D
<
T
>
velocity
=
new
FieldVector3D
<>(
zero
.
add
(-
500.0
),
zero
.
add
(
8000.0
),
zero
.
add
(
1000.0
));
T
r2
=
position
.
getNormSq
();
T
r
=
r2
.
sqrt
();
FieldPVCoordinates
<
T
>
pvCoordinates
=
new
FieldPVCoordinates
<>(
position
,
velocity
,
new
FieldVector3D
<>(
r
.
multiply
(
r2
).
reciprocal
().
multiply
(-
mu
),
position
));
FieldVector3D
<
T
>
acceleration
=
new
FieldVector3D
<>(
r
.
multiply
(
r2
).
reciprocal
().
multiply
(-
mu
).
add
(
0.1
),
position
);
FieldPVCoordinates
<
T
>
pvCoordinates
=
new
FieldPVCoordinates
<>(
position
,
velocity
,
acceleration
);
FieldCartesianOrbit
<
T
>
fieldOrbit
=
new
FieldCartesianOrbit
<>(
pvCoordinates
,
FramesFactory
.
getEME2000
(),
date
,
zero
.
add
(
mu
));
CartesianOrbit
orbit
=
fieldOrbit
.
toOrbit
();
Assert
.
assertTrue
(
orbit
.
hasDerivatives
());
...
...
src/test/java/org/orekit/orbits/KeplerianOrbitTest.java
View file @
de9a4c94
...
...
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.function.Function
;
import
org.hamcrest.CoreMatchers
;
import
org.hamcrest.MatcherAssert
;
import
org.hipparchus.analysis.UnivariateFunction
;
import
org.hipparchus.analysis.differentiation.DSFactory
;
...
...
@@ -1661,6 +1662,29 @@ public class KeplerianOrbitTest {
Assert
.
assertEquals
(
0.0
,
normalized2
.
getTrueAnomalyDot
()
-
withDerivatives
.
getTrueAnomalyDot
(),
1.0
e
-
10
);
}
@Test
public
void
testKeplerianToPvToKeplerian
()
{
// setup
Frame
eci
=
FramesFactory
.
getGCRF
();
AbsoluteDate
date
=
AbsoluteDate
.
ARBITRARY_EPOCH
;
double
mu
=
Constants
.
EGM96_EARTH_MU
;
KeplerianOrbit
orbit
=
new
KeplerianOrbit
(
6878
e3
,
0
,
0
,
0
,
0
,
0
,
PositionAngle
.
TRUE
,
eci
,
date
,
mu
);
// action
KeplerianOrbit
pvOrbit
=
new
KeplerianOrbit
(
orbit
.
getPVCoordinates
(),
eci
,
mu
);
// verify
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getA
(),
pvOrbit
.
shiftedBy
(
1
).
getA
(),
1
e
-
6
);
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getE
(),
pvOrbit
.
shiftedBy
(
1
).
getE
(),
1
e
-
14
);
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getI
(),
pvOrbit
.
shiftedBy
(
1
).
getI
(),
1
e
-
10
);
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getPerigeeArgument
(),
pvOrbit
.
shiftedBy
(
1
).
getPerigeeArgument
(),
1
e
-
10
);
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getRightAscensionOfAscendingNode
(),
pvOrbit
.
shiftedBy
(
1
).
getRightAscensionOfAscendingNode
(),
1
e
-
10
);
Assert
.
assertEquals
(
orbit
.
shiftedBy
(
1
).
getTrueAnomaly
(),
pvOrbit
.
shiftedBy
(
1
).
getTrueAnomaly
(),
1
e
-
10
);
}
@Before
public
void
setUp
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment