예제 #1
0
        public void Initialize()
        {
            //#if false
            PropertiesRobotUnity prop1 = new PropertiesRobotUnity();

            prop1.NameId               = "RSD" + RobotUnityRegistedList.Count;
            prop1.L1                   = 2.5;
            prop1.L2                   = 4;
            prop1.WS                   = 3;
            prop1.Label                = "R1";
            prop1.BatteryLevelRb       = 40;
            prop1.Url                  = "ws://192.168.1.184:9090"; //59 -> 181
            prop1.ipMcuCtrl            = "192.168.1.214";
            prop1.portMcuCtrl          = 8081;
            prop1.DistInter            = 8;
            prop1.BatteryLowLevel      = BAT_LOW_LEVEL;
            prop1.RequestChargeBattery = false;
            prop1.Width                = 1.8;
            prop1.Height               = 2.5;
            prop1.Length               = 2.2;
            prop1.ChargeID             = ChargerId.CHARGER_ID_1;
            prop1.Scale                = 10;
            prop1.enableChage          = false;
            RobotUnity r1 = new RobotUnity();

            r1.name = "Robot1";
            r1.Initialize(this.canvas);
            r1.UpdateProperties(prop1);
            r1.ConnectionStatusHandler += ConnectionStatusHandler;
            r1.mcuCtrl = new McuCtrl(r1);
            //r1.mcuCtrl.TurnOnLampRb();
            //Thread.Sleep(1000);
            //r1.mcuCtrl.TurnOffLampRb();
            PropertiesRobotUnity_List.Add(r1.properties);
            RobotUnityRegistedList.Add(r1.properties.NameId, r1);


            //  r1.Radius_S = 40;
            // r1.Radius_B = 40;
            // r1.Radius_Y = 40;
            // đăng ký robot list to many robot quan trong
            // AddRobotUnityReadyList(r1);
            //   AddRobotUnityReadyList(r1);
            r1.RegistryRobotService(this);

            r1.TurnOnSupervisorTraffic(false);

            /*    r1.properties.pose.Position = new Point(-7.2,0.5);
             *  r1.properties.pose.Angle = -180;
             *  r1.properties.pose.AngleW = -180*Math.PI/180;*/

            PropertiesRobotUnity prop2 = new PropertiesRobotUnity();

            prop2.NameId               = "RSD" + RobotUnityRegistedList.Count;
            prop2.L1                   = 2.5;
            prop2.L2                   = 4;
            prop2.WS                   = 3;
            prop2.Label                = "R2";
            prop2.BatteryLevelRb       = 40;
            prop2.Url                  = "ws://192.168.1.185:9090";
            prop2.ipMcuCtrl            = "192.168.1.215";
            prop2.portMcuCtrl          = 8081;
            prop2.DistInter            = 8;
            prop2.BatteryLowLevel      = BAT_LOW_LEVEL;
            prop2.RequestChargeBattery = false;
            prop2.Width                = 1.8;
            prop2.Height               = 2.5;
            prop2.Length               = 2.2;
            prop2.ChargeID             = ChargerId.CHARGER_ID_2;
            prop2.Scale                = 10;
            prop2.enableChage          = false;
            RobotUnity r2 = new RobotUnity();

            r2.name = "Robot1";
            r2.Initialize(this.canvas);
            r2.UpdateProperties(prop2);
            r2.mcuCtrl = new McuCtrl(r2);
            r2.ConnectionStatusHandler += ConnectionStatusHandler;
            PropertiesRobotUnity_List.Add(r2.properties);
            RobotUnityRegistedList.Add(r2.properties.NameId, r2);
            //  r2.Start(prop2.Url);
            // đăng ký robot list to many robot quan trong
            //    AddRobotUnityReadyList(r2);
            r2.RegistryRobotService(this);

            r2.TurnOnSupervisorTraffic(false);

            // r2.Radius_S = 40;
            //  r2.Radius_B = 40;
            //  r2.Radius_Y = 40;

            //#endif


            r1.properties.pose.Position = new Point(30, -15);
            r1.properties.pose.Angle    = 90;
            r1.properties.pose.AngleW   = 90 * Math.PI / 180;

            r1.properties.poseRoot.Position = new Point(30, -15);
            r1.properties.poseRoot.Angle    = 90;
            r1.properties.poseRoot.AngleW   = 90 * Math.PI / 180;

            r2.properties.pose.Position = new Point(32, -15);
            r2.properties.pose.Angle    = 90;
            r2.properties.pose.AngleW   = 90 * Math.PI / 180;

            r2.properties.poseRoot.Position = new Point(32, -15);
            r2.properties.poseRoot.Angle    = 90;
            r2.properties.poseRoot.AngleW   = 90 * Math.PI / 180;


            r1.Registry(trafficManagementService);
            r2.Registry(trafficManagementService);

            r2.RegisteRobotInAvailable(RobotUnityRegistedList);
            r1.RegisteRobotInAvailable(RobotUnityRegistedList);

            r1.StartTraffic();
            r2.StartTraffic();

            r1.PreProcedureAs = ProcedureControlAssign.PRO_READY;
            r2.PreProcedureAs = ProcedureControlAssign.PRO_READY;

            // add robot trong traffic quản lý
            trafficManagementService.RegistryRobotList(RobotUnityRegistedList);

            //
            //  r1.Start(prop1.Url);
            //   r2.Start(prop2.Url);
        }