Exemple #1
0
        public void transitionAction(ref System.Windows.Forms.Panel panel,
                                     System.Windows.Forms.TextBox[] texts, ref int pass)
        {
            switch (state)
            {
            case stIdle:     // nothing
                break;

            case stSonarFiring:
                if (Cart.flagSonarArrayFiringDone)
                {
                    Cart.flagSonarArrayFiringDone = false;
                    // changing state
                    state = stSonarDataTransmission;
                    Cart.requestSensorData();
                }
                break;

            case stSonarDataTransmission:
                if (Cart.flagSensorDataAcquired)
                {
                    Cart.fillSonarTextBoxes(texts);

                    state = stFrameTransmission;
                    Cart.retrieveAbstraction();
                }
                break;

            case stFrameTransmission:
                if (Cart.flagAbstractionReady)
                {
                    Cart.drawAbstraction(panel);
                    state = stAbilityExecuting;
                    // running the cognitive array now
                    double[][] inputVecs = Cart.makeInputVector();
                    pass++;
                    int output = (int)MetaNode.getOutput(Cart.CogTop, inputVecs, pass);
                    if (output < 11)
                    {
                        Cart.useAbility((t_CartAbility)output);
                    }
                    else
                    {
                        state = stIdle;
                    }
                }
                break;

            case stAbilityExecuting:
                if (Cart.flagAbilityDone)
                {
                    Cart.flagAbilityDone = false;
                    state = stIdle;
                }
                break;
            }
        }
        public void transitionAction(System.Windows.Forms.Panel panel, System.Windows.Forms.TextBox[] texts)
        {
            switch (state)
            {
            case stIdle:     // nothing
                break;

            case stAbilityExecuting:
                if (Cart.flagAbilityDone)
                {
                    Cart.flagAbilityDone = false;
                    // ability dopne. Now firing the transducers
                    state = stSonarFiring;
                    Cart.fireSonarArray();
                }
                break;

            case stSonarFiring:
                if (Cart.flagSonarArrayFiringDone)
                {
                    // now attempting to retrieve the data
                    state = stSonarDataTransmission;
                    Cart.requestSensorData();
                }
                break;

            case stSonarDataTransmission:
                if (Cart.flagSensorDataAcquired)
                {
                    Cart.fillSonarTextBoxes(texts);
                    // now retrieving a camera frame abstraction
                    state = stFrameTransmission;
                    Cart.retrieveAbstraction();
                }
                break;

            case stFrameTransmission:
                if (Cart.flagAbstractionReady)
                {
                    Cart.drawAbstraction(panel);     // no need to reset the flag.
                    // It's being reset inside drawAbstraction()
                    state = stIdle;
                }
                break;
            }
        }