Browse Source

小炒

样式分支
NXX 1 year ago
parent
commit
bbb5b314a8
3 changed files with 53 additions and 17 deletions
  1. +15
    -1
      BPASmartClient.Modbus/ModbusTcp.cs
  2. +34
    -16
      BPASmartClient.MorkF/Control_MorkF.cs
  3. +4
    -0
      BPASmartClient.MorkF/ML_MorkF.cs

+ 15
- 1
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -140,7 +140,21 @@ namespace BPASmartClient.Modbus
}
}
}

else if (address.ToUpper().Contains("I") && address.Length >= 2)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
{
if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
{
if (ExitAddress >= 0 && ExitAddress <= 7)
{
return (firstAddress * 8) + ExitAddress;
}
}
}
}
else if (address.ToUpper().Contains("GI") && address.Length >= 3)
{
var res = address.Remove(0, 2);


+ 34
- 16
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -161,7 +161,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 是否为本地炒菜模式,默认为联网的
/// </summary>
private bool isLocalFryingMode { get; set; } = false;
private bool isLocalFryingMode { get; set; } = true;

/// <summary>
/// 入口
@@ -201,7 +201,7 @@ namespace BPASmartClient.MorkF
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2;
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight;
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX;
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX;
}
////菜品库编号与坐标系对象存储
@@ -371,6 +371,17 @@ namespace BPASmartClient.MorkF
}
}), 2);

//抓手初始化完成
GetStatus("I0.1", new Action<object>((objects) =>
{
if (objects is bool[] bools && bools.Length > 2)
{
ml_morkf.PawPositon_1 = bools[0];
ml_morkf.PawPositon_2 = bools[1];
ml_morkf.PawPositon_3 = bools[2];
}
}), 2);

}

public override void Stop()
@@ -1041,8 +1052,9 @@ namespace BPASmartClient.MorkF
return false;
}

//MessageLog.GetInstance.Show("爪子去到2号位");
MaterailLibrary_Write("M1.1", true);
//MessageLog.GetInstance.Show("爪子去到2号位");


Thread.Sleep(500);

@@ -1055,7 +1067,7 @@ namespace BPASmartClient.MorkF
return false;
}
}
Thread.Sleep(300);

//MessageLog.GetInstance.Show("爪子去到2号位完成");
@@ -1084,7 +1096,11 @@ namespace BPASmartClient.MorkF
return false;
}
}

if (!ml_morkf.PawPositon_3)
{
MaterailLibrary_Write("M1.2", true);
Thread.Sleep(3000);
}
Thread.Sleep(300);

//MessageLog.GetInstance.Show("爪子去到3号位完成");
@@ -1358,8 +1374,9 @@ namespace BPASmartClient.MorkF
Thread.Sleep(1000);

//获取传感器的距离,转换成坐标系的点
int laserHigh = ml_morkf.LaserDistance;
//int laserHigh = ml_morkf.LaserDistance;

int laserHigh = 400;
//秦工要求读取后置0
WriteDistance(0);

@@ -1379,7 +1396,7 @@ namespace BPASmartClient.MorkF
}

//设置到传感器感应的距离处
if (!SetArmPosition(x - moveX, y))
if (!SetArmPosition(x, y))
{
return false;
}
@@ -1436,6 +1453,7 @@ namespace BPASmartClient.MorkF
MessageLog.GetInstance.ShowEx("错误:未设置当前菜品库出菜位置");
return false;
}

//爪子去2号位放菜
if (!PawToPoint2())
@@ -1444,12 +1462,12 @@ namespace BPASmartClient.MorkF
}

WriteSpeed(50000);
ThreadManage.GetInstance().Start(new Action(() =>
{
//收缩爪子
PawShrink();
}), "GetMaterialPawShrink");
//ThreadManage.GetInstance().Start(new Action(() =>
//{
// //收缩爪子
// PawShrink();
//}), "GetMaterialPawShrink");
PawShrink();

//判断炒锅是否可以放盒
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++)
@@ -1465,7 +1483,7 @@ namespace BPASmartClient.MorkF
//关闭启磁吸
MagnetOff(fryNum);

Thread.Sleep(200);
//Thread.Sleep(2000);

//根据炒锅不同设置不同的出菜处
if (fryNum % 2 == 0)
@@ -1494,7 +1512,7 @@ namespace BPASmartClient.MorkF
//开启磁吸
MagnetOn(fryNum);

Thread.Sleep(200);
Thread.Sleep(500);

//设置到炒锅1出菜处
if (!SetArmPosition(x, y))
@@ -1962,7 +1980,7 @@ namespace BPASmartClient.MorkF
//搅拌设置为1档
SetStir(new List<int> { 1 }, i);
//火力设置为2档
SetFire(new List<int> { 1 }, num);
SetFire(new List<int> { 3 }, num);
}
Thread.Sleep(materialSleepTime);
if (i >= materialSleepCount * 2 - 1)


+ 4
- 0
BPASmartClient.MorkF/ML_MorkF.cs View File

@@ -109,6 +109,10 @@ namespace BPASmartClient.MorkF
_PawArrivePortThree = value;
}
}

public bool PawPositon_1 { get; set; }
public bool PawPositon_2 { get; set; }
public bool PawPositon_3 { get; set; }
#endregion

#region


Loading…
Cancel
Save