public void FixedPropertiesRobotUnity(String nameID, PropertiesRobotUnity properties) { /* DialogResult result = System.Windows.Forms.MessageBox.Show("Bạn chắc chắn Robot đang nằm ở vùng Charge/Ready?", "Confirmation", MessageBoxButtons.YesNo); * if (result == DialogResult.Yes) * { * RobotUnity Rd = RobotUnityRegistedList[nameID]; * Rd.RemoveDraw(); * Rd.Dispose(); * RemoveRobotUnityRegistedList(nameID); * RemoveRobotUnityWaitTaskList(nameID); * RemoveRobotUnityReadyList(nameID); * Rd = null; * RobotUnity rn = new RobotUnity(); * // cài đặt canvas * rn.Initialize(this.canvas); * rn.UpdateProperties(properties); * * // update properties * * // connect ros * rn.Start(properties.Url); * // đăng ký giao thông * rn.Registry(trafficManagementService); * RobotUnityRegistedList.Add(nameID, rn); * RobotUnityReadyList.Add( rn); * // dăng ký robot list * rn.RegisteRobotInAvailable(RobotUnityRegistedList); * } * else if (result == DialogResult.No) * { * //... * }*/ }
private void FixedBtn_Click(object sender, RoutedEventArgs e) { PropertiesRobotUnity properties = (sender as Button).DataContext as PropertiesRobotUnity; robotManagementService.FixedPropertiesRobotUnity(properties.NameId, properties); robotManagementService.SaveConfig(JsonConvert.SerializeObject(MainDataGrid.ItemsSource, Formatting.Indented)); }
public override void UpdateProperties(PropertiesRobotUnity proR) { base.UpdateProperties(proR); DfL1 = proR.L1; DfL2 = proR.L2; DfWS = proR.WS; DfDistanceInter = proR.DistInter; DfL1Cv = proR.L1 * properties.Scale; DfL2Cv = proR.L2 * properties.Scale; DfWSCv = proR.WS * properties.Scale; DfDistInterCv = proR.DistInter * properties.Scale; L1Cv = proR.L1 * properties.Scale; L2Cv = proR.L2 * properties.Scale; WSCv = proR.WS * properties.Scale; DistInterCv = proR.DistInter * properties.Scale; //Draw (); }
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); }