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

Added debug dump for direct location.

parent 6a5324fa
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.orekit.bodies.GeodeticPoint;
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.rugged.intersection.IntersectionAlgorithm;
......@@ -197,6 +198,9 @@ public class Rugged {
final GeodeticPoint[] gp = new GeodeticPoint[sensor.getNbPixels()];
for (int i = 0; i < sensor.getNbPixels(); ++i) {
DumpManager.dumpDirectLocation(date, sensor.getPosition(), sensor.getLos(date, i),
lightTimeCorrection, aberrationOfLightCorrection);
final Vector3D obsLInert = scToInert.transformVector(sensor.getLos(date, i));
final Vector3D lInert;
if (aberrationOfLightCorrection) {
......@@ -260,6 +264,8 @@ public class Rugged {
public GeodeticPoint directLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los)
throws RuggedException {
DumpManager.dumpDirectLocation(date, position, los, lightTimeCorrection, aberrationOfLightCorrection);
// compute the approximate transform between spacecraft and observed body
final Transform scToInert = scToBody.getScToInertial(date);
final Transform inertToBody = scToBody.getInertialToBody(date);
......
......@@ -23,10 +23,15 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
import org.orekit.errors.OrekitException;
import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.DateTimeComponents;
import org.orekit.time.TimeScalesFactory;
/**
* Dump data class.
......@@ -117,6 +122,26 @@ class Dump {
}
}
/** Dump a direct location computation.
* @param date computation date
* @param date date of the location
* @param position pixel position in spacecraft frame
* @param los normalized line-of-sight in spacecraft frame
* @param lightTimeCorrection flag for light time correction
* @param aberrationOfLightCorrection flag for aberration of light correction
* @exception RuggedException if date cannot be converted to UTC
*/
public void dumpDirectLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los,
final boolean lightTimeCorrection, final boolean aberrationOfLightCorrection)
throws RuggedException {
writer.format(Locale.US,
"direct location: date = %s position = %22.15e %22.15e %22.15e los = %22.15e %22.15e %22.15e ligthTime = %b aberration = %b%n",
highAccuracyDate(date),
position.getX(), position.getY(), position.getZ(),
los.getX(), los.getY(), los.getZ(),
lightTimeCorrection, aberrationOfLightCorrection);
}
/** Get tile data.
* @param tile tile to which the cell belongs
* @return index of the tile
......@@ -137,6 +162,23 @@ class Dump {
}
/** Convert a date to string with high accuracy.
* @param date computation date
* @return converted date
* @exception RuggedException if date cannot be converted to UTC
*/
private String highAccuracyDate(final AbsoluteDate date)
throws RuggedException {
try {
final DateTimeComponents dt = date.getComponents(TimeScalesFactory.getUTC());
return String.format(Locale.US, "%04d-%02d-%02dT%02d:%02d:%017.14fZ",
dt.getDate().getYear(), dt.getDate().getMonth(), dt.getDate().getDay(),
dt.getTime().getHour(), dt.getTime().getMinute(), dt.getTime().getSecond());
} catch (OrekitException oe) {
throw new RuggedException(oe, oe.getSpecifier(), oe.getParts());
}
}
/** Deactivate dump.
*/
public void deactivate() {
......
......@@ -20,9 +20,11 @@ import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.rugged.api.AlgorithmId;
import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
import org.orekit.time.AbsoluteDate;
/**
* Class managing debug dumps.
......@@ -125,4 +127,21 @@ public class DumpManager {
}
}
/** Dump a direct location computation.
* @param date computation date
* @param date date of the location
* @param position pixel position in spacecraft frame
* @param los normalized line-of-sight in spacecraft frame
* @param lightTimeCorrection flag for light time correction
* @param aberrationOfLightCorrection flag for aberration of light correction
* @exception RuggedException if date cannot be converted to UTC
*/
public static void dumpDirectLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los,
final boolean lightTimeCorrection, final boolean aberrationOfLightCorrection)
throws RuggedException {
if (isActive()) {
DUMP.get().dumpDirectLocation(date, position, los, lightTimeCorrection, aberrationOfLightCorrection);
}
}
}
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