예제 #1
0
 public void Stop()
 {
     Informations.printInformations(Priority.HIGH, "Robot - called stop()");
     isStopped = true;
     this.SWITCH_GLOBAL.Activate();
     if (this.typeRobot == TypeRobot.GRAND_ROBOT)
     {
         this.GR_LANCEUR_BALLE.stop();
         this.GR_SERVO_PLATEAU.Stop();
         Thread.Sleep(50);
         this.GR_SERVO_ABEILLE.Stop();
         Thread.Sleep(50);
         this.GR_SERVO_TRAPPE.Stop();
         Thread.Sleep(50);
     }
     else
     {
         this.PR_RELAIS_VENTOUZES.Desactivate();
         this.PR_SERVO_AIGUILLAGE.Stop();
         Thread.Sleep(50);
         this.PR_SERVO_ASCENSEUR_BRAS_DROIT.Stop();
         Thread.Sleep(50);
         this.PR_SERVO_ASCENSEUR_BRAS_GAUCHE.Stop();
         Thread.Sleep(50);
         this.PR_SERVO_DEPLOIEMENT_BRAS_GAUCHE.Stop();
         Thread.Sleep(50);
         this.PR_SERVO_POUSSOIRJOKER.Stop();
         Thread.Sleep(20);
         this.PR_SERVO_ROTATION_BRAS_DROIT.Stop();
         Thread.Sleep(50);
         this.PR_SERVO_ROTATION_BRAS_GAUCHE.Stop();
         Thread.Sleep(50);
     }
     IHM.AfficherInformation("Score : " + score, true);
 }
예제 #2
0
 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());
     }
 }
예제 #3
0
                ).BuildActionEnSerieRepeated(-1); // Envois infinis

        public static void loadActions()
        {
            ACTION_PER_TYPE.Clear();
            loadActionHomologation();
            loadActionTest1();

            Informations.printInformations(Priority.MEDIUM, "actions chargées");
        }
예제 #4
0
 public static void sendPositionInformation()
 {
     if (GetRobotPositionEvent != null)
     {
         GetRobotPositionEvent(getPosition());
         Informations.printInformations(Priority.HIGH, "l'information sur la position du robot a été mise à jour");
     }
 }
예제 #5
0
 private static void setMotherAction(ModeOperatoire mode, Action a)
 {
     if (ACTION_PER_TYPE.Contains(mode))
     {
         ACTION_PER_TYPE[mode] = a;
     }
     else
     {
         ACTION_PER_TYPE.Add(mode, a);
     }
     Informations.printInformations(Priority.MEDIUM, "actions mère redéfinie");
 }
예제 #6
0
        public void loadComponents()
        {
            switch (TypeRobot)
            {
            case TypeRobot.GRAND_ROBOT:

                break;

            case TypeRobot.PETIT_ROBOT:

                break;

            case TypeRobot.TEST_ROBOT_1:
                TR1_BOUTON_1 = new Button(TR1_SOCKET_BOUTON1);
                //TR1_BOUTON_2 = new Button(TR1_SOCKET_BOUTON2);
                BASE_ROULANTE = new composants.BaseRoulante.BaseRoulante(GR_SOCKET_BASE_ROUlANTE);
                break;
            }
            Informations.printInformations(Priority.MEDIUM, "composés du robot chargés");
        }
예제 #7
0
        public static void loadActions()
        {
            ACTION_PER_TYPE.Clear();

            StrategieGrosRobot strategieGR = new StrategieGrosRobot();

            setMotherAction(ModeOperatoire.COMPETITION, TypeRobot.GRAND_ROBOT, CouleurEquipe.VERT, strategieGR.GetMotherActionForCouleurVerte());
            setMotherAction(ModeOperatoire.COMPETITION, TypeRobot.GRAND_ROBOT, CouleurEquipe.ORANGE, strategieGR.GetMotherActionForCouleurOrange());

            StrategiePetitRobot strategiePR = new StrategiePetitRobot();

            setMotherAction(ModeOperatoire.COMPETITION, TypeRobot.PETIT_ROBOT, CouleurEquipe.VERT, strategiePR.GetMotherActionPRCompetitionForCouleurVerte());
            setMotherAction(ModeOperatoire.COMPETITION, TypeRobot.PETIT_ROBOT, CouleurEquipe.ORANGE, strategiePR.GetMotherActionPRCompetitionForCouleurOrange());

            TestRobots testRobots = new TestRobots();

            setMotherAction(ModeOperatoire.TEST1, TypeRobot.PETIT_ROBOT, CouleurEquipe.VERT, testRobots.TestPRAscenseurDroit());
            setMotherAction(ModeOperatoire.TEST1, TypeRobot.PETIT_ROBOT, CouleurEquipe.ORANGE, testRobots.TestPRAscenseurDroit());
            setMotherAction(ModeOperatoire.TEST1, TypeRobot.GRAND_ROBOT, CouleurEquipe.VERT, testRobots.GetActionTestScore());
            setMotherAction(ModeOperatoire.TEST1, TypeRobot.GRAND_ROBOT, CouleurEquipe.ORANGE, testRobots.TestRecallage());

            GestionnaireServosGR gestio = new GestionnaireServosGR();

            setMotherAction(ModeOperatoire.HOMOLOGATION, TypeRobot.GRAND_ROBOT, CouleurEquipe.VERT, gestio.GR_PLATEAU_LIBERATION_TUBE_UNICOULEUR());
            setMotherAction(ModeOperatoire.HOMOLOGATION, TypeRobot.GRAND_ROBOT, CouleurEquipe.ORANGE,
                            new ActionBuilder("Test").Add(gestio.GR_TRAPPE_FERMER).Add(gestio.GR_PLATEAU_RECOLTE)
                            .Add(gestio.GR_PLATEAU_LIBERATION_BALLES_COULEUR_OPPOSEE()).BuildActionEnSerie());

            if (Robot.robot.TypeRobot == TypeRobot.PETIT_ROBOT)
            {
                setMotherAction(ModeOperatoire.HOMOLOGATION, TypeRobot.PETIT_ROBOT, CouleurEquipe.ORANGE, testRobots.TestCodesCouleurs());
                setMotherAction(ModeOperatoire.HOMOLOGATION, TypeRobot.PETIT_ROBOT, CouleurEquipe.VERT, testRobots.TestCodesCouleurs());
            }



            //setMotherAction(ModeOperatoire.TEST1, TypeRobot.GRAND_ROBOT, CouleurEquipe.ORANGE, gestio.GR_PLATEAU_LIBERATION_BALLES_TUBE_MIXTE_NOTRE_COULEUR());

            Informations.printInformations(Priority.HIGH, "actions chargees");
        }
예제 #8
0
        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);
        }
예제 #9
0
        public void loadComponents()
        {
            switch (TypeRobot)
            {
            case TypeRobot.GRAND_ROBOT:
                Informations.printInformations(Priority.HIGH, "Robot : loadComponents : GRAND Robot selected !");

                /*if (isPRSpiderI)
                 *  Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpider();
                 * else
                 *  Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpiderII();*/

                SWITCH_GLOBAL = new composants.RelaisMoteur(GR_SOCKET_SWITCH_GLOBAL, GR_PORT_SWITCH_GLOBAL);
                //SWITCH_GLOBAL.Desactivate();

                BASE_ROULANTE = new composants.BaseRoulante.BaseRoulante(GR_SOCKET_BASE_ROUlANTE);

                GR_SERVO_PLATEAU = new composants.Servomoteurs.AX12(GR_SOCKET_SERVOS, GR_SERVO_ID_PLATEAU);
                GR_SERVO_TRAPPE  = new composants.Servomoteurs.AX12(GR_SOCKET_SERVOS, GR_SERVO_ID_TRAPPE);
                GR_SERVO_ABEILLE = new composants.Servomoteurs.AX12(GR_SOCKET_SERVOS, GR_SERVO_ID_ABEILLE);

                GR_LANCEUR_BALLE = new LanceurBalle(GR_SOCKET_LANCEUR);


                GR_INFRAROUGE_1 = new composants.CapteursObstacle.Infrarouge(GR_SOCKET_INFRAROUGE, GR_PORT_INFRAROUGE_1, OBSTACLE_DIRECTION.AVANT);
                GR_INFRAROUGE_2 = new composants.CapteursObstacle.Infrarouge(GR_SOCKET_INFRAROUGE, GR_PORT_INFRAROUGE_2, OBSTACLE_DIRECTION.AVANT);
                GR_INFRAROUGE_3 = new composants.CapteursObstacle.Infrarouge(GR_SOCKET_INFRAROUGE, GR_PORT_INFRAROUGE_3, OBSTACLE_DIRECTION.ARRIERE);
                GR_INFRAROUGE_4 = new composants.CapteursObstacle.Infrarouge(GR_SOCKET_INFRAROUGE, GR_PORT_INFRAROUGE_4, OBSTACLE_DIRECTION.ARRIERE);


                JACK = new composants.JackInterrupt(GR_SOCKET_JACK, GR_PORT_JACK);

                composants.CapteursObstacle.CapteurObstacle[] capteurs_GR = { GR_INFRAROUGE_1, GR_INFRAROUGE_2, GR_INFRAROUGE_3, GR_INFRAROUGE_4 };
                OBSTACLE_MANAGER = new composants.CapteursObstacle.CapteurObstacleManager(capteurs_GR);

                break;

            case TypeRobot.PETIT_ROBOT:
                Informations.printInformations(Priority.HIGH, "Robot : loadComponents : PETiT Robot selected !");
                // Port 5 Spider : Breakout => 4 = IR AVG, 5 = IR AVD, 8 = Jack
                // Port 6 Spider : Ultrason
                // Port 1 Spider : USB Client
                // Port 11 Spider : AX-12 => ID ?
                // Port 8 : Kangaroo
                // Quel socket pour les pompes ?

                /*if (isPRSpiderI)
                 *  Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpider();
                 * else
                 *  Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpiderII();*/

                SWITCH_GLOBAL = new composants.RelaisMoteur(PR_SOCKET_SWITCH_GLOBAL, PR_PORT_SWITCH_GLOBAL);
                //SWITCH_GLOBAL.Activate();

                PR_SERVO_ASCENSEUR_BRAS_DROIT    = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_ASCENSEUR_BRAS_DROIT);
                PR_SERVO_ASCENSEUR_BRAS_GAUCHE   = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_ASCENSEUR_BRAS_GAUCHE);
                PR_SERVO_ROTATION_BRAS_GAUCHE    = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_ROTATION_BRAS_GAUCHE);
                PR_SERVO_ROTATION_BRAS_DROIT     = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_ROTATION_BRAS_DROIT);
                PR_SERVO_DEPLOIEMENT_BRAS_GAUCHE = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_DEPLOIEMENT_BRAS_GAUCHE);
                PR_SERVO_POUSSOIRJOKER           = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_POUSSOIRJOKER);
                PR_SERVO_AIGUILLAGE = new composants.Servomoteurs.AX12(PR_SOCKET_SERVOS, PR_SERVO_ID_AIGUILLAGE);
                PR_SERVO_ASCENSEUR_BRAS_DROIT_NEW  = new composants.Servomoteurs.AscenseurDroite(PR_SOCKET_SERVOS, PR_SERVO_ID_ASCENSEUR_BRAS_DROIT);
                PR_SERVO_ASCENSEUR_BRAS_GAUCHE_NEW = new composants.Servomoteurs.AscenseurGauche(PR_SOCKET_SERVOS, PR_SERVO_ID_ASCENSEUR_BRAS_GAUCHE);

                BASE_ROULANTE = new composants.BaseRoulante.BaseRoulante(PR_SOCKET_BASE_ROUlANTE);

                PR_INFRAROUGE_1 = new composants.CapteursObstacle.Infrarouge(PR_SOCKET_INFRAROUGE, PR_PORT_INFRAROUGE_1, OBSTACLE_DIRECTION.ARRIERE);
                PR_INFRAROUGE_2 = new composants.CapteursObstacle.Infrarouge(PR_SOCKET_INFRAROUGE, PR_PORT_INFRAROUGE_2, OBSTACLE_DIRECTION.ARRIERE);

                PR_INFRAROUGE_3 = new composants.CapteursObstacle.Infrarouge(PR_SOCKET_INFRAROUGE, PR_PORT_INFRAROUGE_3, OBSTACLE_DIRECTION.AVANT);
                PR_INFRAROUGE_4 = new composants.CapteursObstacle.Infrarouge(PR_SOCKET_INFRAROUGE, PR_PORT_INFRAROUGE_4, OBSTACLE_DIRECTION.AVANT);
                //PR_ULTRASON = new composants.CapteursObstacle.Ultrason(PR_SOCKET_ULTRASON, OBSTACLE_DIRECTION.AVANT);

                //JACK = new composants.Jack(PR_SOCKET_JACK, PR_PORT_JACK);
                JACK = new composants.JackInterrupt(PR_SOCKET_JACK, PR_PORT_JACK);

                PR_RELAIS_VENTOUZES = new composants.RelaisMoteur(PR_SOCKET_VENTOUZES, PR_PORT_VENTOUZES);

                composants.CapteursObstacle.CapteurObstacle[] capteurs_PR = { PR_INFRAROUGE_1, PR_INFRAROUGE_2, PR_INFRAROUGE_3, PR_INFRAROUGE_4 };
                OBSTACLE_MANAGER = new composants.CapteursObstacle.CapteurObstacleManager(capteurs_PR);

                PR_RECEPTEUR_CODE_COULEUR = new composants.RecepteurCodeCouleur(PR_SOCKET_RECEPTEUR_CODE_COULEUR);

                break;

                /*case TypeRobot.TEST_ROBOT_1:
                 *  TR1_BOUTON_1 = new Button(TR1_SOCKET_BOUTON1);
                 *  //TR1_BOUTON_2 = new Button(TR1_SOCKET_BOUTON2);
                 *  BASE_ROULANTE = new composants.BaseRoulante.BaseRoulante(GR_SOCKET_BASE_ROUlANTE);
                 *  break;*/
            }
            Informations.printInformations(Priority.MEDIUM, "composants du robot chargés");
        }