Skip to content
Snippets Groups Projects
Commit b57cabe9 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Added dump for observation transforms.

parent 5defbd6f
No related branches found
No related tags found
No related merge requests found
......@@ -24,11 +24,14 @@ import java.util.Locale;
import java.util.TimeZone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Transform;
import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
import org.orekit.rugged.utils.SpacecraftToObservedBody;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.DateTimeComponents;
import org.orekit.time.TimeScalesFactory;
......@@ -51,6 +54,9 @@ class Dump {
/** Flag for dumped ellipsoid. */
private boolean ellipsoidDumped;
/** Flags for dumped observation transforms. */
private boolean[] tranformsDumped;
/** Simple constructor.
* @param writer writer to the dump file
*/
......@@ -59,6 +65,7 @@ class Dump {
this.tiles = new ArrayList<DumpedTileData>();
this.algorithmDumped = false;
this.ellipsoidDumped = false;
this.tranformsDumped = null;
dumpHeader();
}
......@@ -142,6 +149,38 @@ class Dump {
lightTimeCorrection, aberrationOfLightCorrection);
}
/** Dump an observation transform transform.
* @param scToBody provider for observation
* @param index index of the transform
* @param transform transform
* @exception RuggedException if reference date cannot be converted to UTC
*/
public void dumpTransform(final SpacecraftToObservedBody scToBody,
final int index, final Transform transform)
throws RuggedException {
if (tranformsDumped == null) {
final AbsoluteDate minDate = scToBody.getMinDate();
final AbsoluteDate maxDate = scToBody.getMaxDate();
final double tStep = scToBody.getTStep();
final int n = 1 + (int) FastMath.rint(maxDate.durationFrom(minDate) / tStep);
writer.format(Locale.US,
"spacecraft to observed body: min date = %s max date = %s tStep = %22.15e inertial frame = %s body frame = %s%n",
highAccuracyDate(minDate), highAccuracyDate(maxDate), tStep,
scToBody.getInertialFrameName(), scToBody.getBodyFrameName());
tranformsDumped = new boolean[n];
}
if (!tranformsDumped[index]) {
writer.format(Locale.US,
"transform: index = %d r = %22.15e %22.15e %22.15e %22.15e Ω = %22.15e %22.15e %22.15e ΩDot = %22.15e %22.15e %22.15e%n",
index,
transform.getRotation().getQ0(), transform.getRotation().getQ1(),
transform.getRotation().getQ2(), transform.getRotation().getQ2(),
transform.getRotationRate().getX(), transform.getRotationRate().getY(), transform.getRotationRate().getZ(),
transform.getRotationAcceleration().getX(), transform.getRotationAcceleration().getY(), transform.getRotationAcceleration().getZ());
tranformsDumped[index] = true;
}
}
/** Get tile data.
* @param tile tile to which the cell belongs
* @return index of the tile
......
......@@ -21,9 +21,11 @@ import java.io.IOException;
import java.io.PrintWriter;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.frames.Transform;
import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
import org.orekit.rugged.utils.SpacecraftToObservedBody;
import org.orekit.time.AbsoluteDate;
/**
......@@ -144,4 +146,18 @@ public class DumpManager {
}
}
/** Dump an observation transform transform.
* @param scToBody provider for observation
* @param index index of the transform
* @param transform transform
* @exception RuggedException if reference date cannot be converted to UTC
*/
public static void dumpTransform(final SpacecraftToObservedBody scToBody,
final int index, final Transform transform)
throws RuggedException {
if (isActive()) {
DUMP.get().dumpTransform(scToBody, index, transform);
}
}
}
......@@ -24,6 +24,7 @@ import org.apache.commons.math3.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.Transform;
import org.orekit.rugged.errors.DumpManager;
import org.orekit.rugged.errors.RuggedException;
import org.orekit.rugged.errors.RuggedMessages;
import org.orekit.time.AbsoluteDate;
......@@ -270,6 +271,10 @@ public class SpacecraftToObservedBody implements Serializable {
final double s = date.durationFrom(list.get(0).getDate()) / tStep;
final int index = FastMath.max(0, FastMath.min(list.size() - 1, (int) FastMath.rint(s)));
// we always dump the body to inertial transform, regardless of the one really asked for
DumpManager.dumpTransform(this, index, bodyToInertial.get(index));
final Transform close = list.get(index);
return close.shiftedBy(date.durationFrom(close.getDate()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment