Exemplo n.º 1
0
        //
        // private methods
        //
        private void checkStates()
        {
            // docking override?
            if (command == Command.DOCK) {
                attMode = AttMode.IDLE;
                rateMode = RateMode.IDLE;
                posMode = PosMode.IDLE;
            }

            // no target vessel?
            if (flightData.targetVessel == null) {

                // disable invalid att hold modes
                if (command == Command.ATT &&
                    (attMode == AttMode.RPP || attMode == AttMode.RPN ||
                    attMode == AttMode.RVP || attMode == AttMode.RVN)) {
                    requestAttMode (AttMode.IDLE);
                }
            }

            // no target vessel or target changed?
            if (flightData.targetVessel == null || flightData.targetChanged) {

                // disable position modes
                if (posMode != PosMode.IDLE) {
                    requestPosMode (PosMode.IDLE);
                }
            }

            // no target vessel or docking ports?
            if (flightData.targetVessel == null ||
                flightData.targetPart == null ||
                flightData.vesselPart == null ||
                flightData.targetChanged) {

                // disable dock master mode
                if(command == Command.DOCK)	{
                    requestCommand(Command.OFF);
                }
            }
        }
Exemplo n.º 2
0
        public void restoreConfiguration(GNCconfig config)
        {
            // should be good, might need to add some checks
            command = config.command;
            rateMode = config.rateMode;
            attMode = config.attMode;
            eacMode = config.eacMode;
            posMode = config.posMode;
            dockMode = config.dockMode;
            dockState = config.dockState;
            dockAbort = config.dockAbort;
            userRateSetting = config.userRateSetting.toVector3 ();
            userAttSetting = config.userAttSetting.toVector3 ();
            userAttUpSetting = config.userAttUpSetting.toVector3 ();
            userPosSetting = config.userPosSetting.toVector3 ();
            Kp_AngVel = config.Kp_AngVel;
            Kp_AngAcc = config.Kp_AngAcc;
            Kp_Vel = config.Kp_Vel;
            Kp_Acc = config.Kp_Acc;
            eacPulseLength = config.eacPulseLength;
            eacPulseLevel = config.eacPulseLevel;
            eacRate = config.eacRate;
            dockRollAdjust = config.dockRollAdjust;
            networkPropulsion = config.networkPropulsion;

            // ...
            if (command == Command.EAC && eacMode == EACMode.RATE_ATT) {
                eacAttInvalid = true;
            }
        }
Exemplo n.º 3
0
        public void requestAttMode(AttMode m)
        {
            if(command != Command.ATT)
                return;

            if(attMode == m)
                attMode = AttMode.IDLE;
            else
                attMode = m;

            if(attMode == AttMode.HOLD)
                userAttHoldRequest = true;
        }
Exemplo n.º 4
0
        public void requestCommand(Command c)
        {
            command = c;

            rateMode = RateMode.IDLE;
            attMode = AttMode.IDLE;
            eacMode = EACMode.IDLE;
            dockMode = DockMode.IDLE;
            dockState = DockState.IDLE;

            if (command != Command.RATE && command != Command.ATT && command != Command.EAC)
                posMode = PosMode.IDLE;

            if (command == Command.DOCK)
            {
                if (flightData.targetVessel == null)
                {
                    command = Command.OFF;
                }
            }
        }
Exemplo n.º 5
0
 public void getStates(out Command outCommand, 
     out RateMode outRateMode,
     out AttMode outAttMode,
     out EACMode outEacMode,
     out PosMode outPosMode,
     out DockMode outDockMode)
 {
     outCommand = command;
     outRateMode = rateMode;
     outAttMode = attMode;
     outEacMode = eacMode;
     outPosMode = posMode;
     outDockMode = dockMode;
 }