Merge branch 'unstable' into fix-1728
This commit is contained in:
commit
0cc805b185
@ -13,6 +13,8 @@ import net.sf.openrocket.util.Quaternion;
|
|||||||
|
|
||||||
public abstract class AbstractSimulationStepper implements SimulationStepper {
|
public abstract class AbstractSimulationStepper implements SimulationStepper {
|
||||||
|
|
||||||
|
protected static final double MIN_TIME_STEP = 0.001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the atmospheric conditions, allowing listeners to override.
|
* Compute the atmospheric conditions, allowing listeners to override.
|
||||||
*
|
*
|
||||||
|
@ -73,10 +73,12 @@ public class BasicLandingStepper extends AbstractSimulationStepper {
|
|||||||
double timeStep = RECOVERY_TIME_STEP;
|
double timeStep = RECOVERY_TIME_STEP;
|
||||||
|
|
||||||
// adjust based on change in acceleration (ie jerk)
|
// adjust based on change in acceleration (ie jerk)
|
||||||
final double jerk = linearAcceleration.sub(status.getRocketAcceleration()).multiply(1.0/status.getPreviousTimeStep()).length();
|
final double jerk = Math.abs(linearAcceleration.sub(status.getRocketAcceleration()).multiply(1.0/status.getPreviousTimeStep()).length());
|
||||||
if (jerk > MathUtil.EPSILON) {
|
if (jerk > MathUtil.EPSILON) {
|
||||||
timeStep = Math.min(timeStep, 1.0/jerk);
|
timeStep = Math.min(timeStep, 1.0/jerk);
|
||||||
}
|
}
|
||||||
|
// but don't let it get *too* small
|
||||||
|
timeStep = Math.max(timeStep, MIN_TIME_STEP);
|
||||||
|
|
||||||
// Perform Euler integration
|
// Perform Euler integration
|
||||||
Coordinate newPosition = status.getRocketPosition().add(status.getRocketVelocity().multiply(timeStep)).
|
Coordinate newPosition = status.getRocketPosition().add(status.getRocketVelocity().multiply(timeStep)).
|
||||||
|
@ -58,9 +58,6 @@ public class RK4SimulationStepper extends AbstractSimulationStepper {
|
|||||||
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_CHANGE = 4 * Math.PI / 180;
|
||||||
|
|
||||||
private static final double MIN_TIME_STEP = 0.001;
|
|
||||||
|
|
||||||
|
|
||||||
private Random random;
|
private Random random;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user