diff --git a/ksp_plugin/interface_vessel.cpp b/ksp_plugin/interface_vessel.cpp index f234137da2..fbd6d50fb1 100644 --- a/ksp_plugin/interface_vessel.cpp +++ b/ksp_plugin/interface_vessel.cpp @@ -196,25 +196,5 @@ XYZ __cdecl principia__VesselVelocity(Plugin const* const plugin, return m.Return(ToXYZ(plugin->VesselVelocity(vessel_guid))); } -void __cdecl principia__SetAngularMomentumConservation( - bool const conserve_angular_momentum) { - journal::Method m( - {conserve_angular_momentum}); - ksp_plugin::PileUp::conserve_angular_momentum = conserve_angular_momentum; - return m.Return(); -} - -char const* __cdecl principia__VesselGetPileUpTrace( - Plugin const* const plugin, - char const* const vessel_guid) { - journal::Method m({plugin, vessel_guid}); - CHECK_NOTNULL(plugin); - char const* trace; - plugin->GetVessel(vessel_guid)->ForSomePart([&trace](ksp_plugin::Part& part) { - trace = part.containing_pile_up()->trace.data(); - }); - return m.Return(trace); -} - } // namespace interface } // namespace principia diff --git a/ksp_plugin/pile_up.cpp b/ksp_plugin/pile_up.cpp index 47870b8b2f..daf782831b 100644 --- a/ksp_plugin/pile_up.cpp +++ b/ksp_plugin/pile_up.cpp @@ -509,9 +509,7 @@ void PileUp::DeformPileUpIfNeeded(Instant const& t) { t, {NonRotatingPileUp::origin, NonRotatingPileUp::unmoving}); RigidMotion const rotational_correction = - conserve_angular_momentum - ? actual_pile_up_motion * apparent_pile_up_motion.Inverse() - : RigidMotion::Identity(); + actual_pile_up_motion * apparent_pile_up_motion.Inverse(); RigidMotion const correction = rotational_correction * apparent_system.LinearMotion().Inverse(); @@ -531,43 +529,6 @@ void PileUp::DeformPileUpIfNeeded(Instant const& t) { actual_rigid_motion.rigid_transformation()); } apparent_part_rigid_motion_.clear(); - -#if 0 - std::stringstream s; - Angle const α = - rotational_correction.orthogonal_map().AsRotation().RotationAngle(); - AngularVelocity const ω_apparent = - apparent_pile_up_motion.angular_velocity_of_to_frame(); - AngularVelocity const ω_actual = - actual_pile_up_motion.angular_velocity_of_to_frame(); - constexpr AngularFrequency rpm = 2 * π * Radian / quantities::si::Minute; - s << "|Lap|: " << apparent_angular_momentum.Norm() << "\n" - << "|Lac|: " << angular_momentum_.Norm() << "\n" - << "|Lap-Lac|: " - << (angular_momentum_ - Identity()( - apparent_angular_momentum)) - .Norm() - << "\n" - << "|Lap|-|Lac|: " - << angular_momentum_.Norm() - apparent_angular_momentum.Norm() << "\n" - << u8"∡Lap, Lac: " - << geometry::AngleBetween(angular_momentum_, - Identity()( - apparent_angular_momentum)) / - quantities::si::Degree - << u8"°\n" - << u8"α: " << α / quantities::si::Degree << u8"°\n" - << u8"|ωap|: " << ω_apparent.Norm() / rpm << " rpm\n" - << u8"|ωac|: " << ω_actual.Norm() / rpm << " rpm\n" - << u8"|ωac|-|ωap|: " << (ω_actual.Norm() - ω_apparent.Norm()) / rpm - << " rpm\n" - << u8"∡ωac, ωap: " - << geometry::AngleBetween(ω_actual, ω_apparent) / quantities::si::Degree - << u8"°\n" - << "reference part: " << reference_part->ShortDebugString() << "\n" - << u8"|ωref|: " << reference_part_proper_ω / rpm << " rpm\n"; - trace = s.str(); -#endif } Status PileUp::AdvanceTime(Instant const& t) { @@ -692,8 +653,6 @@ PileUpFuture::PileUpFuture(not_null const pile_up, : pile_up(pile_up), future(std::move(future)) {} -bool PileUp::conserve_angular_momentum = true; - } // namespace internal_pile_up } // namespace ksp_plugin } // namespace principia diff --git a/ksp_plugin/pile_up.hpp b/ksp_plugin/pile_up.hpp index a64e1121fc..bf98a5ec38 100644 --- a/ksp_plugin/pile_up.hpp +++ b/ksp_plugin/pile_up.hpp @@ -101,9 +101,6 @@ class PileUp { virtual ~PileUp(); - std::string trace; - static bool conserve_angular_momentum; - // This class is moveable. PileUp(PileUp&& pile_up) = default; PileUp& operator=(PileUp&& pile_up) = default; diff --git a/ksp_plugin_adapter/main_window.cs b/ksp_plugin_adapter/main_window.cs index 3164d4f922..7ed2cc2491 100644 --- a/ksp_plugin_adapter/main_window.cs +++ b/ksp_plugin_adapter/main_window.cs @@ -238,33 +238,6 @@ protected override void RenderWindow(int window_id) { } private void RenderKSPFeatures() { - if (show_2519_debugging_ui) { - string offsets = ""; - if (FlightGlobals.ActiveVessel != null) { - foreach (var part in FlightGlobals.ActiveVessel.parts) { - double? offset = part.rb?.centerOfMass.magnitude; - if (offset != 0) { - offsets += $"{part.name}: {offset:F3} m; "; - } - } - } - UnityEngine.GUILayout.TextArea( - offsets, - style: Style.Multiline(UnityEngine.GUI.skin.textArea)); - conserve_angular_momentum = UnityEngine.GUILayout.Toggle( - conserve_angular_momentum, - "Conserve angular momentum"); - Interface.SetAngularMomentumConservation(conserve_angular_momentum); - string trace = null; - if (FlightGlobals.ActiveVessel != null && - plugin.HasVessel(FlightGlobals.ActiveVessel.id.ToString())) { - trace = plugin.VesselGetPileUpTrace( - FlightGlobals.ActiveVessel.id.ToString()); - } - UnityEngine.GUILayout.TextArea( - trace ?? "No managed active vessel", - style : Style.Multiline(UnityEngine.GUI.skin.textArea)); - } display_patched_conics = UnityEngine.GUILayout.Toggle( value : display_patched_conics, text : "Display patched conics (do not use for flight planning!)"); @@ -517,12 +490,6 @@ private void RenderToggleableSection(string name, value = 7 * 24 * 60 * 60 }; - // These flags exist to facilitate investigation of #2519. - // They must not be serialized: their non-default values can lead to absurd - // behaviour. - private static bool conserve_angular_momentum = true; - private static readonly bool show_2519_debugging_ui = false; - private static readonly double[] prediction_length_tolerances_ = {1e-3, 1e-2, 1e0, 1e1, 1e2, 1e3, 1e4}; private static readonly long[] prediction_steps_ = diff --git a/serialization/journal.proto b/serialization/journal.proto index 926ea12961..f3bb079326 100644 --- a/serialization/journal.proto +++ b/serialization/journal.proto @@ -218,32 +218,6 @@ message Method { extensions 5000 to 5999; // Last used: 5174. } -message SetAngularMomentumConservation { - extend Method { - optional SetAngularMomentumConservation extension = 5999; - } - message In { - required bool conserve_angular_momentum = 1; - } - optional In in = 1; -} - -message VesselGetPileUpTrace { - extend Method { - optional VesselGetPileUpTrace extension = 5998; - } - message In { - required fixed64 plugin = 1 [(pointer_to) = "Plugin const", - (is_subject) = true]; - required string vessel_guid = 2; - } - message Return { - required string result = 1; - } - optional In in = 1; - optional Return return = 3; -} - message AdvanceTime { extend Method { optional AdvanceTime extension = 5019;