Exemple #1
0
        protected void add_target_node()
        {
            var dV = trajectory.BrakeDeltaV;

            ManeuverAutopilot.AddNode(VSL, dV,
                                      trajectory.AtTargetUT
                                      - MatchVelocityAutopilot.BrakingNodeCorrection((float)dV.magnitude, VSL));
        }
        void circularize(double UT)
        {
            var dV = correct_dV(dV4C(VesselOrbit, hV(UT), UT), UT);

            ManeuverAutopilot.AddNode(VSL, dV, UT);
            CFG.AP1.On(Autopilot1.Maneuver);
            stage = Stage.Circularize;
        }
        void change_ApR(double UT)
        {
            var dV = correct_dV(dV4Ap(VesselOrbit, ApR, UT), UT);

            ManeuverAutopilot.AddNode(VSL, dV, UT);
            CFG.AP1.On(Autopilot1.Maneuver);
            stage = Stage.ChangeApA;
        }
        public void AddBrakeNode()
        {
            var dV = Trajectory.BrakeDeltaV;

            ManeuverAutopilot.AddNode(VSL, dV,
                                      Trajectory.AtTargetUT
                                      - MatchVelocityAutopilot.BrakingNodeCorrection((float)dV.magnitude, VSL));
        }
Exemple #5
0
        Vector3d PlaneCorrection(TargetedTrajectoryBase old)
        {
            var angle = old.DeltaFi;

            angle *= Math.Sin(old.TransferTime / old.Orbit.period * 2 * Math.PI);
            angle *= Math.Sign(Utils.ProjectionAngle(old.StartPos, old.AtTargetPos, old.AfterStartVel));
            var rot = QuaternionD.AngleAxis(angle, old.StartPos);

            return(ManeuverAutopilot.Orbital2NodeDeltaV(VesselOrbit, (rot * old.AfterStartVel) - old.AfterStartVel, old.StartUT));
        }
 void add_best_node()
 {
     ren.clear_nodes();
     ManeuverAutopilot.AddNodeRaw(ren.VSL, Best.NodeDeltaV, Best.StartUT);
 }
 public void AddTrajectoryNode()
 {
     ManeuverAutopilot.AddNode(VSL, Trajectory.ManeuverDeltaV, Trajectory.StartUT);
 }
        protected BaseTrajectory(VesselWrapper vsl, Vector3d dV, double startUT)
        {
            VSL = vsl;
            var dVm = (float)dV.magnitude;

            if (dVm > 0)
            {
                ManeuverFuel     = VSL.Engines.FuelNeeded(dVm);
                FullManeuver     = ManeuverFuel < VSL.Engines.AvailableFuelMass;
                ManeuverDuration = VSL.Engines.TTB_Precise(dVm);
            }
            else
            {
                ManeuverFuel     = 0;
                ManeuverDuration = 0;
                FullManeuver     = true;
            }
            StartUT   = startUT;
            OrigOrbit = VSL.vessel.orbitDriver.orbit;
            var obt = StartOrbit;

            Body = obt.referenceBody;
            if (dVm > 0)
            {
                ManeuverDeltaV = dV;
                NodeDeltaV     = ManeuverAutopilot.Orbital2NodeDeltaV(obt, ManeuverDeltaV, StartUT);
                try
                {
                    Orbit = TrajectoryCalculator.NewOrbit(obt, ManeuverDeltaV, StartUT);
                    var prev = Orbit;
                    for (int i = 0; i < 3; i++)
                    {
                        if (!PatchedConics.CalculatePatch(prev, prev.nextPatch ?? new Orbit(), prev.epoch, new PatchedConics.SolverParameters(), null))
                        {
                            break;
                        }
                        prev = prev.nextPatch;
                    }
                    Body = Orbit.referenceBody;
//                    if(Orbit.patchEndTransition != Orbit.PatchTransitionType.FINAL)//debug
//                    {
//                        Utils.Log("**************************************************************************************************");//debug
//                        RendezvousAutopilot.log_patches(Orbit, "Orbit");//deubg
//                    }
                }
                catch (ArithmeticException)
                {
                    Orbit            = OrigOrbit;
                    StartUT          = VSL.Physics.UT;
                    ManeuverFuel     = 0;
                    ManeuverDuration = 0;
                    ManeuverDeltaV   = Vector3d.zero;
                    FullManeuver     = true;
                }
            }
            else
            {
                Orbit = OrigOrbit;
            }
            StartPos      = obt.getRelativePositionAtUT(StartUT);
            StartVel      = obt.getOrbitalVelocityAtUT(StartUT);
            AfterStartVel = Orbit.getOrbitalVelocityAtUT(StartUT);
        }