Skip to content
Snippets Groups Projects
Commit 623d2017 authored by Gabriele Serafini's avatar Gabriele Serafini
Browse files

Update IodGibbs.java

When there's more than a revolution between first and third observation, sometimes this method returned the corrected orbit but percurred in the wrong sense. So I added a control before the return.
parent 171d013e
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,26 @@ public class IodGibbs {
final AbsoluteDate date = date2;
// compute the equivalent Keplerian orbit
return new KeplerianOrbit(pv, frame, date, mu);
KeplerianOrbit orbit = new KeplerianOrbit(pv, frame, date, mu);
//define the reverse orbit
final PVCoordinates pv2 = new PVCoordinates(r2, vlEci.scalarMultiply(-1));
KeplerianOrbit orbit2 =new KeplerianOrbit(pv2, frame, date, mu);
//check which orbit is correct
Vector3D estP3 = orbit.shiftedBy(date3.durationFrom(date2)).
getPVCoordinates().getPosition();
double dist = estP3.subtract(r3).getNorm();
Vector3D estP3_2 = orbit2.shiftedBy(date3.durationFrom(date2)).
getPVCoordinates().getPosition();
double dist2 = estP3_2.subtract(r3).getNorm();
if(dist <= dist2){
return orbit;
} else {
return orbit2;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment