pry 2 年前
父节点
当前提交
48247c64fa
共有 6 个文件被更改,包括 108 次插入23 次删除
  1. +7
    -0
      HBLConsole.Communication/LebaiHelper.cs
  2. +8
    -7
      HBLConsole.Communication/Serial/SerialPortClient.cs
  3. +84
    -11
      HBLConsole.MORKIC/Control_MORKIC.cs
  4. +1
    -1
      HBLConsole.MainConsole/Main.cs
  5. +1
    -1
      HBLConsole/App.config
  6. +7
    -3
      HBLDevice.ICChip/CommandEvent.cs

+ 7
- 0
HBLConsole.Communication/LebaiHelper.cs 查看文件

@@ -20,6 +20,13 @@ namespace HBLConsole.Communication
public const int SENCE_接冰淇淋2 = 10003;
public const int SENCE_接冰淇淋3 = 10005;
public const int SENCE_咖啡 = 10006;
#region 新增场景
public const int SENCE_取咖啡杯 = 10013;
public const int SENCE_咖啡杯检测 = 10014;
public const int SENCE_接咖啡 = 10015;
public const int SENCE_送咖啡 = 10016;
public const int SENCE_再次取杯 = 10017;
#endregion
public const int SENCE_欢迎 = 10002;

private volatile static LebaiHelper _Instance;


+ 8
- 7
HBLConsole.Communication/Serial/SerialPortClient.cs 查看文件

@@ -202,21 +202,22 @@ namespace HBLConsole.Communication
}
}

/// <summary>
/// 写入数据
/// 读取数据
/// </summary>
/// <param name="buffer">写入端口的字节数组</param>
public void Write(byte[] buffer)
/// <returns></returns>
public byte[] Read()
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (!IsHavePort) return new byte[0];
if (!(comPort.IsOpen)) comPort.Open();
comPort.Write(buffer, 0, buffer.Length);
byte[] buffer = new byte[1024];
comPort.Read(buffer, 0, buffer.Length);
return buffer;
}

}

public void Start()
{
Open();


+ 84
- 11
HBLConsole.MORKIC/Control_MORKIC.cs 查看文件

@@ -249,13 +249,58 @@ namespace HBLConsole.MORKIC
/// </summary>
private void DoCoffee()
{

//are.Reset();
//LebaiHelper.GetInstance.SetValue(0);
////订单状态改变:开始制作
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
////todo:先调用机器人

//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡);
////ThreadManage.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡); }), "调用乐百机器人做咖啡场景");
//Thread.Sleep(2000);

//while (!(lebai.Ok && lebai.Value == 1))
//{
// Thread.Sleep(5);
//}
////todo:咖啡杯下杯
//new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();
//Thread.Sleep(500);

////while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_COFFEE) { Thread.Sleep(5); }
//MessageLog.GetInstance.Show("咖啡杯取杯完成");
//LebaiHelper.GetInstance.SetValue(100);


//while (!(lebai.Ok && lebai.Value == 2))
//{
// Thread.Sleep(5);
//}
//MessageLog.GetInstance.Show("机器人到达接咖啡口位置");
//new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish();
//are.WaitOne(1000 * 180);

////are.WaitOne(1 * 180);
//MessageLog.GetInstance.Show("咖啡机制作咖啡完成");
//LebaiHelper.GetInstance.SetValue(101);
//while (!(lebai.Ok && lebai.Value == 3))
//{
// Thread.Sleep(5);
//}
//MessageLog.GetInstance.Show("机器人到达接咖啡口位置");
////订单状态改变:完成
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
//---------------------------------------------------------含咖啡杯检测-----------------------------------------//
#region 含咖啡杯检测的多场景
int checkeNum = 0;
are.Reset();
LebaiHelper.GetInstance.SetValue(0);
//订单状态改变:开始制作
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//todo:先调用机器人

LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡);
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡);
//ThreadManage.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡); }), "调用乐百机器人做咖啡场景");
Thread.Sleep(2000);

@@ -270,9 +315,35 @@ namespace HBLConsole.MORKIC
//while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_COFFEE) { Thread.Sleep(5); }
MessageLog.GetInstance.Show("咖啡杯取杯完成");
LebaiHelper.GetInstance.SetValue(100);


while (!(lebai.Ok && lebai.Value == 2))
//咖啡杯检测场景
while (!ChipStatus.GetInstance().ArticleExits)
{
checkeNum++;
if (checkeNum > 1)
{
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_再次取杯);
while (!(lebai.Ok && lebai.Value ==3))
{
Thread.Sleep(5);
}
new TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();
Thread.Sleep(500);
}
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测);
while (!(lebai.Ok && lebai.Value == 2))
{
Thread.Sleep(5);
}
new ArticleExitsEvent() { }.Publish();
Thread.Sleep(1000);
}
checkeNum = 0;
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接咖啡);
while (!(lebai.Ok && lebai.Value == 4))
{
Thread.Sleep(5);
}
@@ -283,13 +354,15 @@ namespace HBLConsole.MORKIC
//are.WaitOne(1 * 180);
MessageLog.GetInstance.Show("咖啡机制作咖啡完成");
LebaiHelper.GetInstance.SetValue(101);
while (!(lebai.Ok && lebai.Value == 3))
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_送咖啡);
while (!(lebai.Ok && lebai.Value == 5))
{
Thread.Sleep(5);
}
MessageLog.GetInstance.Show("机器人到达接咖啡口位置");
MessageLog.GetInstance.Show("机器人到达顾客取咖啡位置");
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
#endregion
}

/// <summary>
@@ -368,12 +441,12 @@ namespace HBLConsole.MORKIC

public void ReadData()
{
//ThreadManage.GetInstance.StartLong(new Action(() =>
//{
lebai = LebaiHelper.GetInstance.GetValueAsync();
ThreadManage.GetInstance.StartLong(new Action(() =>
{
lebai = LebaiHelper.GetInstance.GetValueAsync();
LebaiHelper.GetInstance.GetRobotModeStatus();
// Thread.Sleep(100);
//}), "乐百机器人数据读取");
Thread.Sleep(100);
}), "乐百机器人数据读取");
}

public void SimOrder<T>(T simOrder)


+ 1
- 1
HBLConsole.MainConsole/Main.cs 查看文件

@@ -53,7 +53,7 @@ namespace HBLConsole.MainConsole
ThreadManage.GetInstance.Start(new Action(() =>
{
InternetInfo.ConfigInit();//从 consul 获取配置数据
IotReport.GetInstance.Initialize();
//IotReport.GetInstance.Initialize();
Topics.Clear();
Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));


+ 1
- 1
HBLConsole/App.config 查看文件

@@ -11,7 +11,7 @@

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="5"/>
<add key="ClientId" value="4"/>

<add key="COM_Coffee" value="COM8"/>
<add key="BAUD_Coffee" value="115200"/>


+ 7
- 3
HBLDevice.ICChip/CommandEvent.cs 查看文件

@@ -30,12 +30,16 @@ namespace HBLDevice.ICChip
{
public bool TurnOn { get; set; }
}

/// <summary>
/// 检测有无杯子
/// </summary>
public class ArticleExitsEvent : IEvent
{
}

/// <summary>
/// 检测物品距离
/// </summary>
public class ArticleDistEvent : IEvent
{



正在加载...
取消
保存