Skip to content
Snippets Groups Projects
Commit b692b610 authored by Guylaine Prat's avatar Guylaine Prat
Browse files

Cleanup and add javadoc

parent 78fdb487
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ import org.orekit.utils.ParameterDriver;
* @author Guylaine Prat
* @since 2.0
*/
abstract class OptimizationProblemBuilder {
abstract class OptimizationProblemBuilder {
/** Margin used in parameters estimation for the inverse location lines range. */
protected static final int ESTIMATION_LINE_RANGE_MARGIN = 100;
......
......@@ -195,7 +195,7 @@ public class SensorToSensorMapping {
/** Add a mapping between two sensor pixels (A and B) and corresponding distance between the LOS.
* @param pixelA sensor pixel A
* @param pixelB sensor pixel B corresponding to the sensor pixel A (by direct then inverse location)
* @param losDistance distance between both line of sight
* @param losDistance distance between the two lines of sight
*/
public void addMapping(final SensorPixel pixelA, final SensorPixel pixelB, final Double losDistance) {
......@@ -203,12 +203,12 @@ public class SensorToSensorMapping {
losDistances.add(losDistance);
}
/** Add a mapping between two sensor pixels (A and B) and corresponding distance between the LOS.
* and the central body distance constraint associated with pixel A
/** Add a mapping between two sensor pixels (A and B) and corresponding distance between the LOS
* and the central body distance constraint associated with pixel A.
* @param pixelA sensor pixel A
* @param pixelB sensor pixel B corresponding to the sensor pixel A (by direct then inverse location)
* @param losDistance distance between both line of sight
* @param bodyDistance distance between central body and pixel A
* @param losDistance distance between the two lines of sight
* @param bodyDistance elevation to central body
*/
public void addMapping(final SensorPixel pixelA, final SensorPixel pixelB,
final Double losDistance, final Double bodyDistance) {
......
......@@ -47,8 +47,8 @@ public interface LOSTransform {
* These polynomials can be used for example to model thermo-elastic effects.
* </p>
* @param index los pixel index
* @param date date
* @param los line-of-sight to transform
* @param date date
* @param generator generator to use for building {@link DerivativeStructure} instances
* @return line of sight, and its first partial derivatives with respect to the parameters
*/
......
......@@ -69,9 +69,6 @@ public class GroundRefining extends Refining {
/** Sensor name */
private static String sensorName;
/** Rugged instance */
private static Rugged rugged;
/** Main function
*/
......@@ -143,12 +140,12 @@ public class GroundRefining extends Refining {
ruggedBuilder.setName("Rugged_refining");
rugged = ruggedBuilder.build();
Rugged rugged = ruggedBuilder.build();
// Compute ground sample distance (GSD)
// ------------------------------------
double [] gsd = refining.computeGSD(lineSensor);
double [] gsd = refining.computeGSD(rugged, lineSensor);
System.out.format("GSD - X: %2.2f Y: %2.2f **** %n", gsd[0], gsd[1]);
// Initialize disruptions:
......@@ -246,7 +243,7 @@ public class GroundRefining extends Refining {
* @param LineSensor line sensor
* @return the GSD
*/
private double[] computeGSD(final LineSensor lineSensor) throws RuggedException {
private double[] computeGSD(final Rugged rugged, final LineSensor lineSensor) throws RuggedException {
// Get number of line
int dimension = pleiadesViewingModel.getDimension();
......
......@@ -18,7 +18,6 @@ package fr.cs.examples.refiningPleiades;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
......@@ -78,12 +77,6 @@ public class InterRefining extends Refining {
/** Sensor name A corresponding to viewing model B */
private static String sensorNameB;
/** RuggedA's instance */
private static Rugged ruggedA;
/** RuggedB's instance */
private static Rugged ruggedB;
/** Main function
*/
......@@ -158,7 +151,7 @@ public class InterRefining extends Refining {
ruggedBuilderA.setName("RuggedA");
ruggedA = ruggedBuilderA.build();
Rugged ruggedA = ruggedBuilderA.build();
System.out.format("\n**** Build Pleiades viewing model B and its orbit definition **** %n");
......@@ -206,11 +199,11 @@ public class InterRefining extends Refining {
ruggedBuilderB.setName("RuggedB");
ruggedB = ruggedBuilderB.build();
Rugged ruggedB = ruggedBuilderB.build();
// Compute distance between LOS
// -----------------------------
double distance = refining.computeDistanceBetweenLOS(lineSensorA, lineSensorB);
double distance = refining.computeDistanceBetweenLOS(ruggedA, lineSensorA, ruggedB, lineSensorB);
System.out.format("distance %f meters %n",distance);
......@@ -282,9 +275,10 @@ public class InterRefining extends Refining {
System.out.format("\n**** Start optimization **** %n");
final int maxIterations = 100;
final double convergenceThreshold = 1.e-7;
List<Rugged> ruggedList = Arrays.asList(ruggedA, ruggedB);
refining.optimization(maxIterations, convergenceThreshold,
measurements.getObservables(), refining.getRuggeds());
measurements.getObservables(), ruggedList);
// Check estimated values
// ----------------------
......@@ -330,7 +324,8 @@ public class InterRefining extends Refining {
* @param lineSensorB line sensor B
* @return GSD
*/
private double computeDistanceBetweenLOS(final LineSensor lineSensorA, final LineSensor lineSensorB) throws RuggedException {
private double computeDistanceBetweenLOS(final Rugged ruggedA, final LineSensor lineSensorA,
final Rugged ruggedB, final LineSensor lineSensorB) throws RuggedException {
// Get number of line of sensors
int dimensionA = pleiadesViewingModelA.getDimension();
......@@ -375,12 +370,4 @@ public class InterRefining extends Refining {
return distance;
}
/**
* @return the ruggedList
*/
public Collection<Rugged> getRuggeds() {
List<Rugged> ruggedList = Arrays.asList(ruggedA, ruggedB);
return ruggedList;
}
}
......@@ -68,24 +68,22 @@ public class Refining {
final double rollValue, final double pitchValue, final double factorValue)
throws OrekitException, RuggedException {
final String commonFactorName = "factor";
rugged.
getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(sensorName+"_roll")).
filter(driver -> driver.getName().equals(sensorName + rollSuffix)).
findFirst().get().setValue(rollValue);
rugged.
getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(sensorName+"_pitch")).
filter(driver -> driver.getName().equals(sensorName + pitchSuffix)).
findFirst().get().setValue(pitchValue);
rugged.
getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(commonFactorName)).
filter(driver -> driver.getName().equals(factorName)).
findFirst().get().setValue(factorValue);
}
......@@ -269,13 +267,11 @@ public class Refining {
*/
public void resetModel(final Rugged rugged, final String sensorName, final boolean isSelected) throws RuggedException {
final String commonFactorName = "factor";
rugged.
getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(sensorName+"_roll")
|| driver.getName().equals(sensorName+"_pitch")).
filter(driver -> driver.getName().equals(sensorName + rollSuffix)
|| driver.getName().equals(sensorName + pitchSuffix)).
forEach(driver -> {
try {
driver.setSelected(true);
......@@ -288,7 +284,7 @@ public class Refining {
rugged.
getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(commonFactorName)).
filter(driver -> driver.getName().equals(factorName)).
forEach(driver -> {
try {
driver.setSelected(isSelected);
......@@ -366,12 +362,10 @@ public class Refining {
final double rollValue, final double pitchValue, final double factorValue)
throws RuggedException {
final String commonFactorName = "factor";
// Estimate Roll
double estimatedRoll = rugged.getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(sensorName+"_roll")).
filter(driver -> driver.getName().equals(sensorName + rollSuffix)).
findFirst().get().getValue();
double rollError = (estimatedRoll - rollValue);
......@@ -380,7 +374,7 @@ public class Refining {
// Estimate pitch
double estimatedPitch = rugged.getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(sensorName+"_pitch")).
filter(driver -> driver.getName().equals(sensorName + pitchSuffix)).
findFirst().get().getValue();
double pitchError = (estimatedPitch - pitchValue);
......@@ -389,10 +383,31 @@ public class Refining {
// Estimate scale factor
double estimatedFactor = rugged.getLineSensor(sensorName).
getParametersDrivers().
filter(driver -> driver.getName().equals(commonFactorName)).
filter(driver -> driver.getName().equals(factorName)).
findFirst().get().getValue();
double factorError = (estimatedFactor - factorValue);
System.out.format("Estimated factor: %3.5f\tfactor error: %3.6e %n", estimatedFactor, factorError);
}
/**
* Part of the name of parameter drivers
*/
static final String rollSuffix = "_roll";
static final String pitchSuffix = "_pitch";
static final String factorName = "factor";
public static String getRollsuffix() {
return rollSuffix;
}
public static String getPitchsuffix() {
return pitchSuffix;
}
public static String getFactorname() {
return factorName;
}
}
......@@ -86,13 +86,13 @@ public class OrbitModel {
/** Reference date. */
private AbsoluteDate refDate;
/** Simple constructor.
/** Default constructor.
*/
public OrbitModel() {
userDefinedLOFTransform = false;
}
/** TODO GP add comments
/** Generate satellite ephemeris.
*/
public static void addSatellitePV(final TimeScale gps, final Frame eme2000, final Frame itrf,
final List<TimeStampedPVCoordinates> satellitePVList,
......@@ -111,7 +111,7 @@ public class OrbitModel {
satellitePVList.add(new TimeStampedPVCoordinates(ephemerisDate, pEME2000, vEME2000, Vector3D.ZERO));
}
/** TODO GP add comments
/** Generate satellite attitude.
*/
public void addSatelliteQ(final TimeScale gps,
final List<TimeStampedAngularCoordinates> satelliteQList,
......@@ -125,7 +125,9 @@ public class OrbitModel {
satelliteQList.add(pair);
}
/** TODO GP add comments
/** Create an Earth.
* @return the Earth as the WGS84 ellipsoid
* @throws OrekitException
*/
public BodyShape createEarth() throws OrekitException {
......@@ -134,14 +136,19 @@ public class OrbitModel {
FramesFactory.getITRF(IERSConventions.IERS_2010, true));
}
/** TODO GP add comments
/** Created a gravity field.
* @return normalized spherical harmonics coefficients
* @throws OrekitException
*/
public NormalizedSphericalHarmonicsProvider createGravityField() throws OrekitException {
return GravityFieldFactory.getNormalizedProvider(12, 12);
}
/** TODO GP add comments
/** Create an orbit at a chosen date.
* @param mu Earth gravitational constant
* @return the orbit
* @throws OrekitException
*/
public Orbit createOrbit(final double mu, final AbsoluteDate date) throws OrekitException {
......@@ -170,7 +177,7 @@ public class OrbitModel {
mu);
}
/** TODO GP add comments
/** Set the Local Orbital Frame characteristics.
*/
public void setLOFTransform(final double[] rollPoly, final double[] pitchPoly,
final double[] yawPoly, final AbsoluteDate date) {
......@@ -182,7 +189,7 @@ public class OrbitModel {
this.refDate = date;
}
/** TODO GP add comments
/** Recompute the polynom coefficients with shift.
*/
private double getPoly(final double[] poly, final double shift) {
......@@ -193,7 +200,7 @@ public class OrbitModel {
return val;
}
/** TODO GP add comments
/** Get the offset.
*/
private Rotation getOffset(final BodyShape earth, final Orbit orbit, final double shift)
throws OrekitException {
......@@ -217,7 +224,7 @@ public class OrbitModel {
return offsetProper;
}
/** TODO GP add comments
/** Create the attitude provider.
*/
public AttitudeProvider createAttitudeProvider(final BodyShape earth, final Orbit orbit)
throws OrekitException {
......@@ -243,7 +250,7 @@ public class OrbitModel {
}
}
/** TODO GP add comments
/** Create the orbit propagator.
*/
public Propagator createPropagator(final BodyShape earth,
final NormalizedSphericalHarmonicsProvider gravityField,
......@@ -277,7 +284,7 @@ public class OrbitModel {
return numericalPropagator;
}
/** TODO GP add comments
/** Generate the orbit.
*/
public List<TimeStampedPVCoordinates> orbitToPV(final Orbit orbit, final BodyShape earth,
final AbsoluteDate minDate, final AbsoluteDate maxDate,
......@@ -301,7 +308,7 @@ public class OrbitModel {
return list;
}
/** TODO GP add comments
/** Generate the attitude.
*/
public List<TimeStampedAngularCoordinates> orbitToQ(final Orbit orbit, final BodyShape earth,
final AbsoluteDate minDate, final AbsoluteDate maxDate,
......
......@@ -32,6 +32,9 @@ import org.orekit.rugged.los.TimeDependentLOS;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import fr.cs.examples.refiningPleiades.Refining;
import org.orekit.rugged.linesensor.LinearLineDatation;
import org.orekit.rugged.linesensor.LineDatation;
import org.orekit.rugged.linesensor.LineSensor;
......@@ -44,16 +47,16 @@ import org.orekit.errors.OrekitException;
* the aim of this class is to simulate PHR sensor.
* @author Jonathan Guinet
* @author Lucie Labat-Allee
* @author Guylaine Prat
* @since 2.0
*/
public class PleiadesViewingModel {
/** intrinsic Pleiades parameters. */
private double fov = 1.65; // 20km - alt 694km
// Number of line of the sensor
private int dimension = 40000;
/** Pleiades parameters. */
private static final double FOV = 1.65; // 20km - alt 694km
private static final int DIMENSION = 40000;
private static final double LINE_PERIOD = 1.e-4;
private double angle;
private LineSensor lineSensor;
......@@ -61,8 +64,6 @@ public class PleiadesViewingModel {
private String sensorName;
private final double linePeriod = 1e-4;
/** Simple constructor.
* <p>
......@@ -111,13 +112,13 @@ public class PleiadesViewingModel {
final LOSBuilder losBuilder = rawLOS(new Rotation(Vector3D.PLUS_I,
FastMath.toRadians(this.angle),
RotationConvention.VECTOR_OPERATOR).applyTo(Vector3D.PLUS_K),
Vector3D.PLUS_I, FastMath.toRadians(fov / 2), dimension);
Vector3D.PLUS_I, FastMath.toRadians(FOV / 2), DIMENSION);
losBuilder.addTransform(new FixedRotation(sensorName + "_roll", Vector3D.MINUS_I, 0.00));
losBuilder.addTransform(new FixedRotation(sensorName + "_pitch", Vector3D.MINUS_J, 0.00));
losBuilder.addTransform(new FixedRotation(sensorName + Refining.getRollsuffix(), Vector3D.MINUS_I, 0.00));
losBuilder.addTransform(new FixedRotation(sensorName + Refining.getPitchsuffix(), Vector3D.MINUS_J, 0.00));
// factor is a common parameters shared between all Pleiades models
losBuilder.addTransform(new FixedZHomothety("factor", 1.0));
losBuilder.addTransform(new FixedZHomothety(Refining.getFactorname(), 1.0));
return losBuilder.build();
}
......@@ -142,7 +143,7 @@ public class PleiadesViewingModel {
/** TODO GP add comments
*/
public AbsoluteDate getMaxDate() throws RuggedException {
return lineSensor.getDate(dimension);
return lineSensor.getDate(DIMENSION);
}
/** TODO GP add comments
......@@ -161,7 +162,7 @@ public class PleiadesViewingModel {
* @return the number of lines of the sensor
*/
public int getDimension() {
return dimension;
return DIMENSION;
}
/** TODO GP add comments
......@@ -176,10 +177,10 @@ public int getDimension() {
// TODO build complex los
final TimeDependentLOS lineOfSight = buildLOS();
final double rate = 1 / linePeriod;
final double rate = 1. / LINE_PERIOD;
// linear datation model: at reference time we get the middle line, and the rate is one line every 1.5ms
final LineDatation lineDatation = new LinearLineDatation(getDatationReference(), dimension / 2, rate);
final LineDatation lineDatation = new LinearLineDatation(getDatationReference(), DIMENSION / 2, rate);
lineSensor = new LineSensor(sensorName, lineDatation, msiOffset, lineOfSight);
}
......
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