void DriveCircularizationBurn(FlightCtrlState s) { if (!vessel.patchedConicsUnlocked() || skipCircularization) { this.users.Clear(); return; } DriveDeployableComponents(s); if (placedCircularizeNode) { if (vessel.patchedConicSolver.maneuverNodes.Count == 0) { MechJebModuleFlightRecorder recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); if (recorder != null) { launchPhaseAngle = recorder.phaseAngleFromMark; } if (recorder != null) { launchLANDifference = vesselState.orbitLAN - recorder.markLAN; } //finished circularize this.users.Clear(); return; } } else { //place circularization node vessel.RemoveAllManeuverNodes(); double UT = orbit.NextApoapsisTime(vesselState.time); //During the circularization burn, try to correct any inclination errors because it's better to combine the two burns. // For example, if you're about to do a 1500 m/s circularization burn, if you combine a 200 m/s inclination correction // into it, you actually only spend 1513 m/s to execute combined manuver. Mechjeb should also do correction burns before // this if possible, and this can't correct all errors... but it's better then nothing. // (A better version of this should try to match inclination & LAN if target is specified) // FIXME? this inclination correction is unlikely to be at tha AN/DN and will throw the LAN off with anything other than high // TWR launches from equatorial launch sites -- should probably be made optional (or clip it if the correction is too large). Vector3d inclinationCorrection = OrbitalManeuverCalculator.DeltaVToChangeInclination(orbit, UT, Math.Abs(desiredInclination)); Vector3d smaCorrection = OrbitalManeuverCalculator.DeltaVForSemiMajorAxis(orbit.PerturbedOrbit(UT, inclinationCorrection), UT, desiredOrbitAltitude + mainBody.Radius); Vector3d dV = inclinationCorrection + smaCorrection; vessel.PlaceManeuverNode(orbit, dV, UT); placedCircularizeNode = true; core.node.ExecuteOneNode(this); } if (core.node.burnTriggered) { status = Localizer.Format("#MechJeb_Ascent_status7"); //"Circularizing" } else { status = Localizer.Format("#MechJeb_Ascent_status8"); //"Coasting to circularization burn" } }
private static void DrawnTrajectory(Rect r, MechJebModuleAscentClassic path, MechJebModuleFlightRecorder recorder) { if (recorder.history.Length <= 2 || recorder.historyIdx == 0) { return; } float scale = (float)((path.autoPath ? path.autoTurnEndAltitude : path.turnEndAltitude) / r.height); //meters per pixel int t = 1; Vector2 p1 = new Vector2(r.xMin + (float)(recorder.history[0].downRange / scale), r.yMax - (float)(recorder.history[0].altitudeASL / scale)); Vector2 p2 = new Vector2(); while (t <= recorder.historyIdx && t < recorder.history.Length) { var rec = recorder.history[t]; p2.x = r.xMin + (float)(rec.downRange / scale); p2.y = r.yMax - (float)(rec.altitudeASL / scale); if (r.Contains(p2) && (p1 - p2).sqrMagnitude >= 1.0 || t < 2) { Drawing.DrawLine(p1, p2, Color.white, 2, true); p1.x = p2.x; p1.y = p2.y; } t++; } }
public override void OnStart(PartModule.StartState state) { width = 128 * hSize; height = 128 * vSize; recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); ResetScale(); }
public override void OnStart(PartModule.StartState state) { width = 128 * hSize; height = 128 * vSize; recorder = core.GetComputerModule<MechJebModuleFlightRecorder>(); ResetScale(); }
void DriveCircularizationBurn(FlightCtrlState s) { if (!vessel.patchedConicsUnlocked() || skipCircularization) { this.users.Clear(); return; } if (placedCircularizeNode) { if (!vessel.patchedConicSolver.maneuverNodes.Any()) { MechJebModuleFlightRecorder recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); if (recorder != null) { launchPhaseAngle = recorder.phaseAngleFromMark; } if (recorder != null) { launchLANDifference = vesselState.orbitLAN - recorder.markLAN; } //finished circularize this.users.Clear(); return; } } else { //place circularization node vessel.RemoveAllManeuverNodes(); double UT = orbit.NextApoapsisTime(vesselState.time); //During the circularization burn, try to correct any inclination errors because it's better to combine the two burns. // For example, if you're about to do a 1500 m/s circularization burn, if you combine a 200 m/s inclination correction // into it, you actually only spend 1513 m/s to execute combined manuver. Mechjeb should also do correction burns before // this if possible, and this can't correct all errors... but it's better then nothing. // (A better version of this should try to match inclination & LAN if target is specified) Vector3d inclinationCorrection = OrbitalManeuverCalculator.DeltaVToChangeInclination(orbit, UT, desiredInclination); Vector3d smaCorrection = OrbitalManeuverCalculator.DeltaVForSemiMajorAxis(orbit.PerturbedOrbit(UT, inclinationCorrection), UT, desiredOrbitAltitude + mainBody.Radius); Vector3d dV = inclinationCorrection + smaCorrection; vessel.PlaceManeuverNode(orbit, dV, UT); placedCircularizeNode = true; core.node.ExecuteOneNode(this); } if (core.node.burnTriggered) { status = "Circularizing"; } else { status = "Coasting to circularization burn"; } }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsEditor) return; width = 128 * hSize; height = 128 * vSize; recorder = core.GetComputerModule<MechJebModuleFlightRecorder>(); ResetScale(); }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsEditor) { return; } width = 128 * hSize; height = 128 * vSize; recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); ResetScale(); }
void DriveCircularizationBurn(FlightCtrlState s) { if (!vessel.patchedConicsUnlocked() || skipCircularization) { this.users.Clear(); return; } if (placedCircularizeNode) { if (!vessel.patchedConicSolver.maneuverNodes.Any()) { MechJebModuleFlightRecorder recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); if (recorder != null) { launchPhaseAngle = recorder.phaseAngleFromMark; } if (recorder != null) { launchLANDifference = vesselState.orbitLAN - recorder.markLAN; } //finished circularize this.users.Clear(); return; } } else { //place circularization node vessel.RemoveAllManeuverNodes(); double UT = orbit.NextApoapsisTime(vesselState.time); //Vector3d dV = OrbitalManeuverCalculator.DeltaVToCircularize(orbit, UT); Vector3d dV = OrbitalManeuverCalculator.DeltaVForSemiMajorAxis(orbit, UT, desiredOrbitAltitude + mainBody.Radius); vessel.PlaceManeuverNode(orbit, dV, UT); placedCircularizeNode = true; core.node.ExecuteOneNode(this); } if (core.node.burnTriggered) { status = "Circularizing"; } else { status = "Coasting to circularization burn"; } }
public override void OnStart(PartModule.StartState state) { path = (DefaultAscentPath)core.GetComputerModule<MechJebModuleAscentAutopilot>().ascentPath; recorder = core.GetComputerModule<MechJebModuleFlightRecorder>(); }
private static void DrawnTrajectory(Rect r, DefaultAscentPath path, MechJebModuleFlightRecorder recorder) { if (recorder.history.Length <= 2 || recorder.historyIdx == 0) return; float scale = (float)((path.autoPath ? path.autoTurnEndAltitude : path.turnEndAltitude) / r.height); //meters per pixel int t = 1; Vector2 p1 = new Vector2(r.xMin + (float)(recorder.history[0].downRange / scale), r.yMax - (float)(recorder.history[0].altitudeASL / scale)); Vector2 p2 = new Vector2(); while (t <= recorder.historyIdx && t < recorder.history.Length) { var rec = recorder.history[t]; p2.x = r.xMin + (float)(rec.downRange / scale); p2.y = r.yMax - (float)(rec.altitudeASL / scale); if (r.Contains(p2) && (p1 - p2).sqrMagnitude >= 1.0 || t < 2) { Drawing.DrawLine(p1, p2, Color.white, 2, true); p1.x = p2.x; p1.y = p2.y; } t++; } }
public override void OnStart(PartModule.StartState state) { autopilot = core.GetComputerModule <MechJebModuleAscentAutopilot>(); recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); }
public override void OnStart(PartModule.StartState state) { path = (DefaultAscentPath)core.GetComputerModule <MechJebModuleAscentAutopilot>().ascentPath; recorder = core.GetComputerModule <MechJebModuleFlightRecorder>(); }