Remove store.rollAcceleration and store.lateralPitchAcceleration. That data is in store.AccelerationData
This commit is contained in:
parent
e346969c24
commit
e0ebef261c
@ -257,9 +257,6 @@ public abstract class AbstractSimulationStepper implements SimulationStepper {
|
|||||||
public double dragForce = Double.NaN;
|
public double dragForce = Double.NaN;
|
||||||
public double lateralPitchRate = Double.NaN;
|
public double lateralPitchRate = Double.NaN;
|
||||||
|
|
||||||
public double rollAcceleration = Double.NaN;
|
|
||||||
public double lateralPitchAcceleration = Double.NaN;
|
|
||||||
|
|
||||||
public Rotation2D thetaRotation;
|
public Rotation2D thetaRotation;
|
||||||
|
|
||||||
void storeData(SimulationStatus status) {
|
void storeData(SimulationStatus status) {
|
||||||
|
@ -57,7 +57,7 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
// private static final double MAX_ROLL_STEP_ANGLE = 8.32 * Math.PI/180;
|
// private static final double MAX_ROLL_STEP_ANGLE = 8.32 * Math.PI/180;
|
||||||
|
|
||||||
private static final double MAX_ROLL_RATE_CHANGE = 2 * Math.PI / 180;
|
private static final double MAX_ROLL_RATE_CHANGE = 2 * Math.PI / 180;
|
||||||
private static final double MAX_PITCH_CHANGE = 4 * Math.PI / 180;
|
private static final double MAX_PITCH_YAW_CHANGE = 4 * Math.PI / 180;
|
||||||
|
|
||||||
private Random random;
|
private Random random;
|
||||||
DataStore store = new DataStore();
|
DataStore store = new DataStore();
|
||||||
@ -133,8 +133,10 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
dt[1] = maxTimeStep;
|
dt[1] = maxTimeStep;
|
||||||
dt[2] = status.getSimulationConditions().getMaximumAngleStep() / store.lateralPitchRate;
|
dt[2] = status.getSimulationConditions().getMaximumAngleStep() / store.lateralPitchRate;
|
||||||
dt[3] = Math.abs(MAX_ROLL_STEP_ANGLE / store.flightConditions.getRollRate());
|
dt[3] = Math.abs(MAX_ROLL_STEP_ANGLE / store.flightConditions.getRollRate());
|
||||||
dt[4] = Math.abs(MAX_ROLL_RATE_CHANGE / store.rollAcceleration);
|
dt[4] = Math.abs(MAX_ROLL_RATE_CHANGE / store.accelerationData.getRotationalAccelerationRC().z);
|
||||||
dt[5] = Math.abs(MAX_PITCH_CHANGE / store.lateralPitchAcceleration);
|
dt[5] = Math.abs(MAX_PITCH_YAW_CHANGE /
|
||||||
|
MathUtil.max(Math.abs(store.accelerationData.getRotationalAccelerationRC().x),
|
||||||
|
Math.abs(store.accelerationData.getRotationalAccelerationRC().y)));
|
||||||
if (!status.isLaunchRodCleared()) {
|
if (!status.isLaunchRodCleared()) {
|
||||||
dt[0] /= 5.0;
|
dt[0] /= 5.0;
|
||||||
dt[6] = status.getSimulationConditions().getLaunchRodLength() / k1.v.length() / 10;
|
dt[6] = status.getSimulationConditions().getLaunchRodLength() / k1.v.length() / 10;
|
||||||
@ -354,8 +356,6 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
|
|
||||||
linearAcceleration = store.launchRodDirection.multiply(linearAcceleration.dot(store.launchRodDirection));
|
linearAcceleration = store.launchRodDirection.multiply(linearAcceleration.dot(store.launchRodDirection));
|
||||||
angularAcceleration = Coordinate.NUL;
|
angularAcceleration = Coordinate.NUL;
|
||||||
store.rollAcceleration = 0;
|
|
||||||
store.lateralPitchAcceleration = 0;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -368,21 +368,15 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
double momY = Cm * dynP * refArea * refLength;
|
double momY = Cm * dynP * refArea * refLength;
|
||||||
double momZ = store.forces.getCroll() * dynP * refArea * refLength;
|
double momZ = store.forces.getCroll() * dynP * refArea * refLength;
|
||||||
|
|
||||||
// Compute acceleration in rocket coordinates
|
// Compute angular acceleration in rocket coordinates
|
||||||
angularAcceleration = new Coordinate(momX / store.rocketMass.getLongitudinalInertia(),
|
angularAcceleration = new Coordinate(momX / store.rocketMass.getLongitudinalInertia(),
|
||||||
momY / store.rocketMass.getLongitudinalInertia(),
|
momY / store.rocketMass.getLongitudinalInertia(),
|
||||||
momZ / store.rocketMass.getRotationalInertia());
|
momZ / store.rocketMass.getRotationalInertia());
|
||||||
|
|
||||||
store.rollAcceleration = angularAcceleration.z;
|
|
||||||
// TODO: LOW: This should be hypot, but does it matter?
|
|
||||||
store.lateralPitchAcceleration = MathUtil.max(Math.abs(angularAcceleration.x),
|
|
||||||
Math.abs(angularAcceleration.y));
|
|
||||||
|
|
||||||
angularAcceleration = store.thetaRotation.rotateZ(angularAcceleration);
|
angularAcceleration = store.thetaRotation.rotateZ(angularAcceleration);
|
||||||
|
|
||||||
// Convert to world coordinates
|
// Convert to world coordinates
|
||||||
angularAcceleration = status.getRocketOrientationQuaternion().rotate(angularAcceleration);
|
angularAcceleration = status.getRocketOrientationQuaternion().rotate(angularAcceleration);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AccelerationData(null, null, linearAcceleration, angularAcceleration, status.getRocketOrientationQuaternion());
|
return new AccelerationData(null, null, linearAcceleration, angularAcceleration, status.getRocketOrientationQuaternion());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user