Esempio n. 1
0
        /// <summary>
        /// Decision Manager Constructor
        /// </summary>
        /// <param name="surveyor">Convertion and table size storage unit.
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="ricochetCalc">Ricochet calc unit. NOTE: working in mm.
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="predictor">Predictor for ball coordinates
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="decisionTree">Full decision tree to make decisions per eacch rod.
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="controlledRods">Rods to be controlled by manager
        /// (If null [default] - will be instantiated in constructor)</param>
        public DecisionManager(ISurveyor surveyor = null, IInitializableRicochet ricochetCalc = null, IPredictor predictor = null, IDecisionTree decisionTree = null, List <IInitializableRod> controlledRods = null)
        {
            _surveyor = surveyor ?? new Surveyor();

            IInitializableRicochet ricochetCalculator = ricochetCalc ?? new RicochetCalc(true, eUnits.Mm);

            _decisionTree = decisionTree ?? new FullDecisionTree(new PartialDecisionTree());

            _predictor = predictor ?? new Predictor(_surveyor, ricochetCalculator);

            //use given rods if not null
            if (controlledRods != null)
            {
                _controlledRods = controlledRods;
            }
            //create new rods and init them
            else
            {
                _controlledRods = new List <IInitializableRod>();
                foreach (eRod type in Enum.GetValues(typeof(eRod)))
                {
                    IInitializableRod rod = new ControlRod(type, _surveyor, ricochetCalculator);
                    rod.Initialize();
                    _controlledRods.Add(rod);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Decision Manager Constructor
        /// </summary>
        /// <param name="surveyor">Convertion and table size storage unit. 
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="ricochetCalc">Ricochet calc unit. NOTE: working in mm. 
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="predictor">Predictor for ball coordinates
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="decisionTree">Full decision tree to make decisions per eacch rod.
        /// (If null [default] - will be instantiated in constructor)</param>
        /// <param name="controlledRods">Rods to be controlled by manager
        /// (If null [default] - will be instantiated in constructor)</param>
        public DecisionManager(ISurveyor surveyor = null, IInitializableRicochet ricochetCalc = null, IPredictor predictor = null, IDecisionTree decisionTree = null, List<IInitializableRod> controlledRods = null)
        {
            _surveyor =  surveyor ?? new Surveyor();

            IInitializableRicochet ricochetCalculator = ricochetCalc ?? new RicochetCalc(true, eUnits.Mm);

            _decisionTree = decisionTree ?? new FullDecisionTree(new PartialDecisionTree());

            _predictor = predictor ?? new Predictor(_surveyor, ricochetCalculator);

            //use given rods if not null
            if (controlledRods != null)
            {
                _controlledRods = controlledRods;
            }
            //create new rods and init them
            else
            {
                _controlledRods = new List<IInitializableRod>();
                foreach (eRod type in Enum.GetValues(typeof(eRod)))
                {
                    IInitializableRod rod = new ControlRod(type, _surveyor, ricochetCalculator);
                    rod.Initialize();
                    _controlledRods.Add(rod);
                }
            }
        }