Commit f83522b5 authored by Bryan Cazabonne's avatar Bryan Cazabonne

Fixed Spotbug warnings.

parent 9f559b95
Pipeline #678 passed with stages
in 2 minutes and 4 seconds
......@@ -705,21 +705,19 @@ public abstract class AbstractOrbitDetermination<T extends IntegratedPropagatorB
// These covariances are derived from the deltas between initial and reference orbits
// Initial cartesian covariance matrix and process noise matrix
final RealMatrix cartesianOrbitalP = (kalmanData.getCartesianOrbitalP()) != null ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalP()) : null;
final RealMatrix cartesianOrbitalQ = (kalmanData.getCartesianOrbitalQ()) != null ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalQ()) : null;
final RealMatrix cartesianOrbitalP = MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalP());
final RealMatrix cartesianOrbitalQ = MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalQ());
// Initial propagation covariance matrix and process noise matrix
final RealMatrix propagationP = (kalmanData.getPropagationP()) != null ?
final RealMatrix propagationP = (kalmanData.getPropagationP().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getPropagationP()) : null;
final RealMatrix propagationQ = (kalmanData.getPropagationQ()) != null ?
final RealMatrix propagationQ = (kalmanData.getPropagationQ().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getPropagationQ()) : null;
// Initial measurement covariance matrix and process noise matrix
final RealMatrix measurementP = (kalmanData.getMeasurementP()) != null ?
final RealMatrix measurementP = (kalmanData.getMeasurementP().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getMeasurementP()) : null;
final RealMatrix measurementQ = (kalmanData.getMeasurementQ()) != null ?
final RealMatrix measurementQ = (kalmanData.getMeasurementQ().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getMeasurementQ()) : null;
// Orbital covariance matrix initialization
......@@ -1291,7 +1289,7 @@ public abstract class AbstractOrbitDetermination<T extends IntegratedPropagatorB
// spacecraft data
final TutorialSpacecraft spacecraft = inputData.getSpacecraft();
final Vector3D offset;
if (spacecraft.getAntennaOffset() != null) {
if (spacecraft.getAntennaOffset().length != 0) {
final double[] antennaOffset = spacecraft.getAntennaOffset();
offset = new Vector3D(antennaOffset);
} else {
......
......@@ -678,21 +678,19 @@ public abstract class AbstractOrbitDeterminationEngine<T extends IntegratedPropa
// These covariances are derived from the deltas between initial and reference orbits
// Initial cartesian covariance matrix and process noise matrix
final RealMatrix cartesianOrbitalP = (kalmanData.getCartesianOrbitalP()) != null ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalP()) : null;
final RealMatrix cartesianOrbitalQ = (kalmanData.getCartesianOrbitalQ()) != null ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalQ()) : null;
final RealMatrix cartesianOrbitalP = MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalP());
final RealMatrix cartesianOrbitalQ = MatrixUtils.createRealDiagonalMatrix(kalmanData.getCartesianOrbitalQ());
// Initial propagation covariance matrix and process noise matrix
final RealMatrix propagationP = (kalmanData.getPropagationP()) != null ?
final RealMatrix propagationP = (kalmanData.getPropagationP().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getPropagationP()) : null;
final RealMatrix propagationQ = (kalmanData.getPropagationQ()) != null ?
final RealMatrix propagationQ = (kalmanData.getPropagationQ().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getPropagationQ()) : null;
// Initial measurement covariance matrix and process noise matrix
final RealMatrix measurementP = (kalmanData.getMeasurementP()) != null ?
final RealMatrix measurementP = (kalmanData.getMeasurementP().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getMeasurementP()) : null;
final RealMatrix measurementQ = (kalmanData.getMeasurementQ()) != null ?
final RealMatrix measurementQ = (kalmanData.getMeasurementQ().length) != 0 ?
MatrixUtils.createRealDiagonalMatrix(kalmanData.getMeasurementQ()) : null;
// Orbital covariance matrix initialization
......@@ -1264,7 +1262,7 @@ public abstract class AbstractOrbitDeterminationEngine<T extends IntegratedPropa
// spacecraft data
final TutorialSpacecraft spacecraft = inputData.getSpacecraft();
final Vector3D offset;
if (spacecraft.getAntennaOffset() != null) {
if (spacecraft.getAntennaOffset().length != 0) {
final double[] antennaOffset = spacecraft.getAntennaOffset();
offset = new Vector3D(antennaOffset);
} else {
......
......@@ -177,38 +177,40 @@ public class KalmanOrbitDeterminationObserver implements KalmanObserver {
final double DPcorr = Vector3D.distance(predictedP, estimatedP);
final double DVcorr = Vector3D.distance(predictedV, estimatedV);
final StringBuffer buffer = new StringBuffer();
line = String.format(Locale.US, lineFormat,
currentNumber, currentDate.toString(),
currentDate.durationFrom(t0), currentStatus.toString(),
measType, stationName,
DPcorr, DVcorr);
buffer.append(line);
// Handle parameters printing (value and error)
int jPar = 0;
final RealMatrix Pest = estimation.getPhysicalEstimatedCovarianceMatrix();
// Orbital drivers
for (DelegatingDriver driver : estimation.getEstimatedOrbitalParameters().getDrivers()) {
line += String.format(Locale.US, PAR_VAL, driver.getValue());
line += String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar)));
buffer.append(String.format(Locale.US, PAR_VAL, driver.getValue()));
buffer.append(String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar))));
jPar++;
}
// Propagation drivers
for (DelegatingDriver driver : estimation.getEstimatedPropagationParameters().getDrivers()) {
line += String.format(Locale.US, PAR_VAL, driver.getValue());
line += String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar)));
buffer.append(line += String.format(Locale.US, PAR_VAL, driver.getValue()));
buffer.append(line += String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar))));
jPar++;
}
// Measurements drivers
for (DelegatingDriver driver : estimation.getEstimatedMeasurementsParameters().getDrivers()) {
line += String.format(Locale.US, PAR_VAL, driver.getValue());
line += String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar)));
buffer.append(line += String.format(Locale.US, PAR_VAL, driver.getValue()));
buffer.append(line += String.format(Locale.US, PAR_COV, FastMath.sqrt(Pest.getEntry(jPar, jPar))));
jPar++;
}
// Print the line
System.out.println(line);
System.out.println(buffer.toString());
if (logStream != null) {
logStream.format(line);
logStream.format(buffer.toString());
}
}
......
......@@ -24,6 +24,7 @@ import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.ode.events.Action;
import org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator;
import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
import org.hipparchus.util.FastMath;
import org.orekit.attitudes.Attitude;
import org.orekit.attitudes.InertialProvider;
import org.orekit.bodies.CR3BPFactory;
......@@ -279,7 +280,7 @@ public class PropagationInCR3BP {
public void handleStep(final SpacecraftState currentState, final boolean isLast) {
try {
// Time is normalized with tDim/(2*pi) in CR3BP computation
final double duration = compteur * outputStep * tDim / 2 / 3.14;
final double duration = compteur * outputStep * tDim / 2 / FastMath.PI;
compteur++;
// Current unnormalized propagation date
......
......@@ -40,12 +40,20 @@ public class TutorialEstimatedParameter {
/** Flag for the parameter estimation. */
private boolean isEstimated;
/**
* Constructor.
*/
public TutorialEstimatedParameter() {
// initialise empty array
this.values = new double[0];
}
/**
* Get the initial, minimum and maximum value of the parameter.
* @return an array containing the initial, minimum and maximum value of the parameter
*/
public double[] getValues() {
return values;
return values.clone();
}
/**
......@@ -53,7 +61,7 @@ public class TutorialEstimatedParameter {
* @param values array containing the initial, minimum and maximum value of the parameter
*/
public void setValues(final double[] values) {
this.values = values;
this.values = values.clone();
}
/**
......
......@@ -416,6 +416,15 @@ public class TutorialForceModel {
/** Flag for acceleration coefficients estimation. */
private boolean isEstimated;
/**
* Constructor.
*/
public TutorialPolynomialAcceleration() {
// initialise empty array
this.directions = new double[0];
this.coefficients = new double[0];
}
/**
* Get the prefix to use for parameter drivers.
* @return the prefix to use for parameter drivers
......@@ -437,7 +446,7 @@ public class TutorialForceModel {
* @return the acceleration direction in defining frame (X, Y, Z)
*/
public double[] getDirections() {
return directions;
return directions.clone();
}
/**
......@@ -445,7 +454,7 @@ public class TutorialForceModel {
* @param directions acceleration direction in defining frame (X, Y, Z)
*/
public void setDirections(final double[] directions) {
this.directions = directions;
this.directions = directions.clone();
}
/**
......@@ -453,7 +462,7 @@ public class TutorialForceModel {
* @return the array of acceleration coefficients
*/
public double[] getCoefficients() {
return coefficients;
return coefficients.clone();
}
/**
......@@ -461,7 +470,7 @@ public class TutorialForceModel {
* @param coefficients array of acceleration coefficients
*/
public void setCoefficients(final double[] coefficients) {
this.coefficients = coefficients;
this.coefficients = coefficients.clone();
}
/**
......
......@@ -48,12 +48,25 @@ public class TutorialKalman {
/** Initial diagonal elements of the measurement process noise matrix. */
private double[] measurementQ;
/**
* Constructor.
*/
public TutorialKalman() {
// initialise empty array
this.cartesianOrbitalP = new double[0];
this.cartesianOrbitalQ = new double[0];
this.propagationP = new double[0];
this.propagationQ = new double[0];
this.measurementP = new double[0];
this.measurementQ = new double[0];
}
/**
* Get the initial diagonal elements of the cartesian covariance matrix.
* @return the initial diagonal elements of the cartesian covariance matrix
*/
public double[] getCartesianOrbitalP() {
return cartesianOrbitalP;
return cartesianOrbitalP.clone();
}
/**
......@@ -61,7 +74,7 @@ public class TutorialKalman {
* @param cartesianOrbitalP initial diagonal elements of the cartesian covariance matrix
*/
public void setCartesianOrbitalP(final double[] cartesianOrbitalP) {
this.cartesianOrbitalP = cartesianOrbitalP;
this.cartesianOrbitalP = cartesianOrbitalP.clone();
}
/**
......@@ -69,7 +82,7 @@ public class TutorialKalman {
* @return the initial diagonal elements of the cartesian process noise matrix
*/
public double[] getCartesianOrbitalQ() {
return cartesianOrbitalQ;
return cartesianOrbitalQ.clone();
}
/**
......@@ -77,7 +90,7 @@ public class TutorialKalman {
* @param cartesianOrbitalQ initial diagonal elements of the cartesian process noise matrix
*/
public void setCartesianOrbitalQ(final double[] cartesianOrbitalQ) {
this.cartesianOrbitalQ = cartesianOrbitalQ;
this.cartesianOrbitalQ = cartesianOrbitalQ.clone();
}
/**
......@@ -85,7 +98,7 @@ public class TutorialKalman {
* @return the initial diagonal elements of the propagation covariance matrix
*/
public double[] getPropagationP() {
return propagationP;
return propagationP.clone();
}
/**
......@@ -93,7 +106,7 @@ public class TutorialKalman {
* @param propagationP initial diagonal elements of the propagation covariance matrix
*/
public void setPropagationP(final double[] propagationP) {
this.propagationP = propagationP;
this.propagationP = propagationP.clone();
}
/**
......@@ -101,7 +114,7 @@ public class TutorialKalman {
* @return the initial diagonal elements of the propagation process noise matrix
*/
public double[] getPropagationQ() {
return propagationQ;
return propagationQ.clone();
}
/**
......@@ -109,7 +122,7 @@ public class TutorialKalman {
* @param propagationQ initial diagonal elements of the propagation process noise matrix
*/
public void setPropagationQ(final double[] propagationQ) {
this.propagationQ = propagationQ;
this.propagationQ = propagationQ.clone();
}
/**
......@@ -117,7 +130,7 @@ public class TutorialKalman {
* @return the initial diagonal elements of the measurement covariance matrix
*/
public double[] getMeasurementP() {
return measurementP;
return measurementP.clone();
}
/**
......@@ -125,7 +138,7 @@ public class TutorialKalman {
* @param measurementP initial diagonal elements of the measurement covariance matrix
*/
public void setMeasurementP(final double[] measurementP) {
this.measurementP = measurementP;
this.measurementP = measurementP.clone();
}
/**
......@@ -133,7 +146,7 @@ public class TutorialKalman {
* @return the initial diagonal elements of the measurement process noise matrix
*/
public double[] getMeasurementQ() {
return measurementQ;
return measurementQ.clone();
}
/**
......@@ -141,7 +154,7 @@ public class TutorialKalman {
* @param measurementQ initial diagonal elements of the measurement process noise matrix
*/
public void setMeasurementQ(final double[] measurementQ) {
this.measurementQ = measurementQ;
this.measurementQ = measurementQ.clone();
}
}
......@@ -43,6 +43,14 @@ public class TutorialSpacecraft {
/** Estimated On-board range bias. */
private TutorialEstimatedParameter bias;
/**
* Constructor.
*/
public TutorialSpacecraft() {
// initialise empty array
antennaOffset = new double[0];
}
/**
* Get the spacecraft mass.
* @return the spacecraft mass (kg)
......@@ -96,7 +104,7 @@ public class TutorialSpacecraft {
* @return the coordinates of the on-board antenna phase center in spacecraft frame [X, Y, Z].
*/
public double[] getAntennaOffset() {
return antennaOffset;
return antennaOffset.clone();
}
/**
......@@ -104,7 +112,7 @@ public class TutorialSpacecraft {
* @param antennaOffset coordinates of the on-board antenna phase center in spacecraft frame [X, Y, Z]
*/
public void setAntennaOffset(final double[] antennaOffset) {
this.antennaOffset = antennaOffset;
this.antennaOffset = antennaOffset.clone();
}
/**
......
......@@ -60,6 +60,14 @@ public class TutorialStation {
/** Estimated position/velocity measurement bias for the ground station. */
private TutorialEstimatedParameter pvBias;
/**
* Constructor.
*/
public TutorialStation() {
// initialise empty array
this.coordinates = new double[0];
}
/**
* Get the station name.
* @return the station name
......@@ -84,7 +92,7 @@ public class TutorialStation {
* @return the array containing the station coordinates.
*/
public double[] getCoordinates() {
return coordinates;
return coordinates.clone();
}
/**
......@@ -95,7 +103,7 @@ public class TutorialStation {
* @param coordinates array containing the station coordinates.
*/
public void setCoordinates(final double[] coordinates) {
this.coordinates = coordinates;
this.coordinates = coordinates.clone();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment