diff --git a/HBLConsole.Communication/LebaiHelper.cs b/HBLConsole.Communication/LebaiHelper.cs index 62abaa4..b854288 100644 --- a/HBLConsole.Communication/LebaiHelper.cs +++ b/HBLConsole.Communication/LebaiHelper.cs @@ -192,6 +192,7 @@ namespace HBLConsole.Communication /// public void Scene(int id) { + Thread.Sleep(1000); if (robotData == null || client == null) return; if (!client.GetIsCanRunTask().Result) return; client?.RunScene(id); diff --git a/HBLConsole.MORKIC/Control_MORKIC.cs b/HBLConsole.MORKIC/Control_MORKIC.cs index e1cbe4d..7c0883f 100644 --- a/HBLConsole.MORKIC/Control_MORKIC.cs +++ b/HBLConsole.MORKIC/Control_MORKIC.cs @@ -192,7 +192,7 @@ namespace HBLConsole.MORKIC { Thread.Sleep(10); } - LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_欢迎); + //LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_欢迎); }), "MORK-IC欢迎"); //ThreadManage.GetInstance.StartLong(new Action(() => //{ @@ -247,9 +247,9 @@ namespace HBLConsole.MORKIC private AutoResetEvent are = new AutoResetEvent(false); - private void Wait() + private void Wait(int value = 101) { - while (!(lebai.Ok && lebai.Value == 101)) + while (!(lebai.Ok && lebai.Value == value)) { Thread.Sleep(5); } @@ -268,31 +268,45 @@ namespace HBLConsole.MORKIC SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取咖啡杯); Wait(); - new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 + //new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 + Thread.Sleep(3000); + Thread.Sleep(500); MessageLog.GetInstance.Show("咖啡杯取杯完成"); LebaiHelper.GetInstance.SetValue(1); + p: LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测); Wait(); - p: + LebaiHelper.GetInstance.SetValue(1); + if (!LebaiHelper.GetInstance.GetInput()) { MessageLog.GetInstance.Show("执行二次取咖啡杯"); - LebaiHelper.GetInstance.SetValue(1); LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_二次取咖啡杯); Wait(); + + //new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制 + Thread.Sleep(3000); + + LebaiHelper.GetInstance.SetValue(1); goto p; } LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接咖啡); Wait(); - new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); - are.WaitOne(1000 * 180); + + //new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 + //are.WaitOne(1000 * 180); + + Thread.Sleep(3000); + LebaiHelper.GetInstance.SetValue(1); + while (LebaiHelper.GetInstance.GetInput(1)) { Thread.Sleep(500); } LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_放咖啡位置); Wait(); + LebaiHelper.GetInstance.SetValue(1); //订单状态改变:完成 SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); #endregion @@ -521,28 +535,42 @@ namespace HBLConsole.MORKIC SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING); LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_取冰淇淋杯); Wait(); - new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 + + //new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 + Thread.Sleep(3000); + Thread.Sleep(500); MessageLog.GetInstance.Show("冰淇淋杯取杯完成"); LebaiHelper.GetInstance.SetValue(1); + p: LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_冰淇淋杯检测); Wait(); - p: + LebaiHelper.GetInstance.SetValue(1); if (!LebaiHelper.GetInstance.GetInput()) { MessageLog.GetInstance.Show("执行二次取冰淇淋杯"); - LebaiHelper.GetInstance.SetValue(1); + //LebaiHelper.GetInstance.SetValue(1); LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_二次取冰淇淋杯); + + //new TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制 + Thread.Sleep(3000); + Wait(); + LebaiHelper.GetInstance.SetValue(1); + + goto p; } LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接冰淇淋公共点); Wait(); + LebaiHelper.GetInstance.SetValue(1); var res = PolymerBatching.GetIceCreamSE(mainMaterialLoc, out int scene); LebaiHelper.GetInstance.Scene(scene); Wait(); - new MakeIceCreamEvent() { SteeringEngine = res }.Publish(); + //new MakeIceCreamEvent() { SteeringEngine = res }.Publish(); //控制舵机 + Thread.Sleep(3000); + Thread.Sleep(500); LebaiHelper.GetInstance.SetValue(1); while (LebaiHelper.GetInstance.GetInput(1)) @@ -551,6 +579,7 @@ namespace HBLConsole.MORKIC } LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_放冰淇淋位置); Wait(); + LebaiHelper.GetInstance.SetValue(1); //订单状态改变:完成 SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); #endregion diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs index 62ea774..49b6e04 100644 --- a/HBLConsole.MainConsole/Main.cs +++ b/HBLConsole.MainConsole/Main.cs @@ -52,6 +52,7 @@ namespace HBLConsole.MainConsole { ThreadManage.GetInstance.Start(new Action(() => { + SimpleFactory.GetInstance.DeviceInit();//设备初始化 InternetInfo.ConfigInit();//从 consul 获取配置数据 IotReport.GetInstance.Initialize(); Topics.Clear();