Browse Source

咖啡模拟

master
原川 张 2 years ago
parent
commit
aa7b570a3a
3 changed files with 43 additions and 12 deletions
  1. +1
    -0
      HBLConsole.Communication/LebaiHelper.cs
  2. +41
    -12
      HBLConsole.MORKIC/Control_MORKIC.cs
  3. +1
    -0
      HBLConsole.MainConsole/Main.cs

+ 1
- 0
HBLConsole.Communication/LebaiHelper.cs View File

@@ -192,6 +192,7 @@ namespace HBLConsole.Communication
/// <param name="id"></param>
public void Scene(int id)
{
Thread.Sleep(1000);
if (robotData == null || client == null) return;
if (!client.GetIsCanRunTask().Result) return;
client?.RunScene(id);


+ 41
- 12
HBLConsole.MORKIC/Control_MORKIC.cs View File

@@ -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


+ 1
- 0
HBLConsole.MainConsole/Main.cs View File

@@ -52,6 +52,7 @@ namespace HBLConsole.MainConsole
{
ThreadManage.GetInstance.Start(new Action(() =>
{
SimpleFactory.GetInstance.DeviceInit();//设备初始化
InternetInfo.ConfigInit();//从 consul 获取配置数据
IotReport.GetInstance.Initialize();
Topics.Clear();


Loading…
Cancel
Save