From 6591b094acd215bec470db0e3ce7e5e096a3c71d Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Thu, 16 Jun 2022 16:04:19 -0400 Subject: [PATCH] add more detailed logging to applyManeuver() --- src/game.cpp | 22 ++++++++++++++++------ src/game.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index fed9c46..534e9c8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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); diff --git a/src/game.h b/src/game.h index b69a390..1a3f3e2 100644 --- a/src/game.h +++ b/src/game.h @@ -98,4 +98,4 @@ bool testManeuverStep(const ManeuverNode& maneuver, double previous_theta, double next_theta); -void applyManeuver(GameOrbit* orbit); +void applyManeuver(GameOrbit* orbit, double previous_true_anomaly);