static void Initialize(List <LesRobots.Robot> robotList)
        {
            Random rand = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       typeValue = rand.Next(1, 3);
                TypeRobot type      = (TypeRobot)typeValue;

                Robot robot = null;

                switch (type)
                {
                case TypeRobot.Droide:
                    robot = new Droide("droide : " + i, 1, 1, "fusil");
                    break;

                case TypeRobot.R2D:
                    robot = new R2D("r2d : " + i, 1, 1);
                    break;
                }

                robotList.Add(robot);
            }
        }
 public static void startActions(ModeOperatoire mode, TypeRobot type, CouleurEquipe couleur)
 {
     Informations.printInformations(Priority.HIGH, "Starting actions with mod : " + mode.ToString() + " & type : " + type.ToString());
     if (ACTION_PER_TYPE.Contains(mode))
     {
         if (((Hashtable)ACTION_PER_TYPE[mode]).Contains(type))
         {
             if (((Hashtable)((Hashtable)ACTION_PER_TYPE[mode])[type]).Contains(couleur))
             {
                 Informations.printInformations(Priority.HIGH, "Lancement de l'action mère avec le mode " + mode.ToString() + " & type : " + type.ToString() + " & couleur " + couleur.ToString());
                 ((Action)((Hashtable)((Hashtable)ACTION_PER_TYPE[mode])[type])[couleur]).Execute();
                 return;
             }
             else
             {
                 Informations.printInformations(Priority.HIGH, "MODE INTROUVABLE : Impossible de lancer l'action mère (introuvable) pour la couleur : " + couleur.ToString());
             }
         }
         else
         {
             Informations.printInformations(Priority.HIGH, "MODE INTROUVABLE : Impossible de lancer l'action mère (introuvable) pour le mode : " + mode.ToString());
         }
     }
     else
     {
         Informations.printInformations(Priority.HIGH, "TYPE INTROUVABLE : Impossible de lancer l'action mère (introuvable) pour le type : " + type.ToString());
     }
 }
Example #3
0
        /* ********************************** FIN TEST ROBOT 1 ****************************** */

        /// <summary>
        /// Fin de la liste des composants
        /// </summary>


        public Robot(composants.IHM.Parametrization parametrization)
        {
            this.typeRobot      = parametrization.GetTypeRobot();
            this.modeOperatoire = parametrization.GetModeOperatoire();
            this.couleurEquipe  = parametrization.GetCouleurEquipe();
            //ecranTactile = new DisplayTE35(14, 13, 12, 10); // L'écran tactile est présent sur chaque robot

            parametrization.startMethod += this.Start;
            robot = this;

            loadComponents();
        }
Example #4
0
        /* ********************************** FIN TEST ROBOT 1 ****************************** */

        /// <summary>
        /// Fin de la liste des composants
        /// </summary>

        public Robot(composants.IHM.Parametrization parametrization, composants.IHM.C_IHM IHM)
        {
            this.IHM = IHM;

            Debug.Print("Querying type...");
            this.typeRobot = parametrization.GetTypeRobot();
            Debug.Print("Got type : " + typeRobot.ToString());

            Debug.Print("Querying mode operatoire...");
            this.modeOperatoire = parametrization.GetModeOperatoire();
            Debug.Print("Got mode : " + modeOperatoire.ToString());

            Debug.Print("Querying couleur...");
            this.couleurEquipe = parametrization.GetCouleurEquipe();
            Debug.Print("Got couleur : " + Couleur.ToString());
            //ecranTactile = new DisplayTE35(14, 13, 12, 10); // L'écran tactile est présent sur chaque robot

            parametrization.startMethod += this.Start;

            robot = this;

            loadComponents();

            new Thread(() =>
            {
                while (true)
                {
                    Thread.Sleep(this.BASE_ROULANTE.REFRESH_RATE_KANGAROO);
                    this.BASE_ROULANTE.kangaroo.CheckMovingStatus();
                }
            }).Start();

            /*
             * if (this.TypeRobot == TypeRobot.PETIT_ROBOT)
             * {
             *  new Thread(() =>
             *  {
             *      while (true)
             *      {
             *          //Thread.Sleep(PR_ULTRASON.REFRESH_RATE);
             *          PR_ULTRASON.detectObstacle(null);
             *      }
             *  }).Start();
             * }*/


            /*Debug.Print("Starting ROBOT !!!");
             * parametrization.startMethod();*/
        }
Example #5
0
        public GeneralTypeRobot(Communicator communicator, string name, TypeRobot type)
        {
            if (communicator == null)
            {
                throw new ArgumentNullException("communicator");
            }

            if (!communicator.GetDataLink().Connected())
            {
                throw new InvalidOperationException("Datalink in communicator not connected");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            _robotName = name;
            _robotType = type;

            _communicator = communicator;
        }
        private static void setMotherAction(ModeOperatoire mode, TypeRobot type, CouleurEquipe couleur, Action a)
        {
            if (!ACTION_PER_TYPE.Contains(mode))
            {
                ACTION_PER_TYPE.Add(mode, new Hashtable());
            }

            if (!((Hashtable)ACTION_PER_TYPE[mode]).Contains(type))
            {
                ((Hashtable)ACTION_PER_TYPE[mode]).Add(type, new Hashtable());
            }

            if (((Hashtable)((Hashtable)ACTION_PER_TYPE[mode])[type]).Contains(couleur))
            {
                ((Hashtable)((Hashtable)ACTION_PER_TYPE[mode])[type])[couleur] = a;
            }
            else
            {
                ((Hashtable)((Hashtable)ACTION_PER_TYPE[mode])[type]).Add(couleur, a);
            }
            Informations.printInformations(Priority.MEDIUM, "actions mere set pour le type " + type + " & le mode " + mode + " & couleur " + couleur);
        }
Example #7
0
        /// <summary>
        /// Configure la fenetre de competition avec les parametre du robot
        /// </summary>
        /// <param name="type">Type de Robot</param>
        /// <param name="couleur">Couleur de l'equipe</param>
        internal void defineRobotParam(TypeRobot type, CouleurEquipe couleur)
        {
            TextBlock indicatifRobot;

            indicatifRobot = (TextBlock)m_window.GetChildByName("indicatifRobot");

            switch (type)
            {
            case TypeRobot.GRAND_ROBOT:
                indicatifRobot.Text = "GRAND_ROBOT";
                break;

            case TypeRobot.PETIT_ROBOT:
                indicatifRobot.Text = "PETIT_ROBOT";
                break;

            default:
                indicatifRobot.Text = "Robot type inconnu";
                break;
            }

            switch (couleur)
            {
            case CouleurEquipe.VERT:
                indicatifRobot.BackColor = Colors.Green;
                break;

            case CouleurEquipe.ORANGE:
                indicatifRobot.BackColor = Colors.Orange;
                break;

            default:
                indicatifRobot.BackColor = Colors.Blue;
                break;
            }
        }
Example #8
0
 public CustomParametrization(TypeRobot typeRobot, ModeOperatoire modeOperatoire, CouleurEquipe couleurEquipe)
 {
     this.typeRobot      = typeRobot;
     this.modeOperatoire = modeOperatoire;
     this.couleurEquipe  = couleurEquipe;
 }