|
|
|
|
@ -211,23 +211,33 @@ testManeuverStep(const ManeuverNode& maneuver,
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
applyManeuver(GameOrbit* orbit) |
|
|
|
|
applyManeuver(GameOrbit* orbit, double previous_true_anomaly) |
|
|
|
|
{ |
|
|
|
|
LOGF(Debug, "applying maneuver\n"); |
|
|
|
|
const ManeuverNode& node = orbit->maneuver; |
|
|
|
|
TwoBodySystem& sys = orbit->system; |
|
|
|
|
|
|
|
|
|
LOGF(Debug, "applying maneuver,\n" |
|
|
|
|
"theta: %f\n," |
|
|
|
|
"dv: %f,\n" |
|
|
|
|
"sat.theta: %f,\n" |
|
|
|
|
"previous theta: %f\n", |
|
|
|
|
node.true_anomaly, |
|
|
|
|
node.impulse_delta_v, |
|
|
|
|
sys.sat.theta, |
|
|
|
|
previous_true_anomaly); |
|
|
|
|
|
|
|
|
|
// FIXME: assuming prograde impulse vector
|
|
|
|
|
assert(orbit->maneuver.impulse_type == ImpulseType::PROGRADE); |
|
|
|
|
assert(node.impulse_type == ImpulseType::PROGRADE); |
|
|
|
|
|
|
|
|
|
// re-calculate state vectors at the maneuver node
|
|
|
|
|
TwoBodySystem& sys = orbit->system; |
|
|
|
|
double theta = orbit->maneuver.true_anomaly; |
|
|
|
|
double theta = node.true_anomaly; |
|
|
|
|
double mu = sys.body.mu; |
|
|
|
|
double r = orbitGetRadialDistance(sys.ep.e, sys.ep.p, theta); |
|
|
|
|
double v = orbitGetVelocity(sys.epsilon, mu, r); |
|
|
|
|
double gamma = orbitGetFlightPathAngle(sys.ep.e, theta); |
|
|
|
|
|
|
|
|
|
// calculate new satellite state vectors
|
|
|
|
|
v += orbit->maneuver.impulse_delta_v; // prograde only
|
|
|
|
|
v += node.impulse_delta_v; // prograde only
|
|
|
|
|
|
|
|
|
|
// get new angular momentum and specific orbital energy
|
|
|
|
|
double h = orbitGetAngularMomentumFromStateVectors(r, v, gamma); |
|
|
|
|
|