|
|
@@ -69,8 +69,6 @@ namespace parkMonitor.server
|
|
|
private RobotProcessUnit rpu1;
|
|
|
private List<string> decompressIndex;
|
|
|
|
|
|
- private int cx, cy, aa;
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// plc构造函数
|
|
|
/// </summary>
|
|
|
@@ -130,11 +128,6 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
decompressIndex.Add((70 + i).ToString());
|
|
|
}
|
|
|
-
|
|
|
- //临时
|
|
|
- cx = Int32.Parse(ConfigurationManager.AppSettings.Get("cx"));
|
|
|
- cy = Int32.Parse(ConfigurationManager.AppSettings.Get("cy"));
|
|
|
- aa = Int32.Parse(ConfigurationManager.AppSettings.Get("aa"));
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
@@ -589,14 +582,6 @@ namespace parkMonitor.server
|
|
|
WaitForLaserReady(lpuTemp);
|
|
|
SendtoPLC(laser_start_addr, "0");
|
|
|
lpuTemp.laserMsg.licenseNum = cm.LicenseNum;
|
|
|
- //foreach (LaserMessage lm in plcMsg.laserMsgList)
|
|
|
- //{
|
|
|
- // if (lm.id == lpuTemp.id)
|
|
|
- // {
|
|
|
- // lm.licenseNum = cm.LicenseNum;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
Thread.Sleep(300);
|
|
|
SendtoPLC(laser_start_addr, "1");
|
|
|
Thread.Sleep(100);
|
|
|
@@ -611,22 +596,12 @@ namespace parkMonitor.server
|
|
|
case 2:
|
|
|
if (cm.RobotID == 1)
|
|
|
{
|
|
|
-
|
|
|
//停车启动机械手
|
|
|
SendtoPLC(rpu1.parking_startRobot_address.ToString(), "1");
|
|
|
//自动或手动输入激光雷达数据
|
|
|
- if (cx == 0 && cy == 0 && aa == 0)
|
|
|
- {
|
|
|
- SendtoPLC(rpu1.parking_laserCenterX_address.ToString(), cm.centerX);
|
|
|
- SendtoPLC((rpu1.parking_laserCenterX_address + 1).ToString(), cm.centerY);
|
|
|
- SendtoPLC((rpu1.parking_laserCenterX_address + 2).ToString(), cm.angleA);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendtoPLC(rpu1.parking_laserCenterX_address.ToString(), cx.ToString());
|
|
|
- SendtoPLC((rpu1.parking_laserCenterX_address + 1).ToString(), cy.ToString());
|
|
|
- SendtoPLC((rpu1.parking_laserCenterX_address + 2).ToString(), aa.ToString());
|
|
|
- }
|
|
|
+ SendtoPLC(rpu1.parking_laserCenterX_address.ToString(), cm.centerX);
|
|
|
+ SendtoPLC((rpu1.parking_laserCenterX_address + 1).ToString(), cm.centerY);
|
|
|
+ SendtoPLC((rpu1.parking_laserCenterX_address + 2).ToString(), cm.angleA);
|
|
|
//车位信息
|
|
|
SendtoPLC(rpu1.parkingSpaceID_address.ToString(), cm.parkingSpaceID);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 1).ToString(), cm.parkingSpaceX);
|
|
|
@@ -659,7 +634,6 @@ namespace parkMonitor.server
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 1).ToString(), cm.parkingSpaceX);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 2).ToString(), cm.parkingSpaceY);
|
|
|
SendtoPLC((rpu1.parkingSpaceID_address + 3).ToString(), cm.parkingSpaceZ);
|
|
|
- //Console.WriteLine("取车中,开始抓车");
|
|
|
SendtoPLC(rpu1.fetching_startRobot_address.ToString(), "1");
|
|
|
}
|
|
|
break;
|
|
|
@@ -771,7 +745,7 @@ namespace parkMonitor.server
|
|
|
Thread.Sleep(500);
|
|
|
SendtoPLC(laserMgmtList[0].laser_status_address.ToString(), "2");
|
|
|
Thread.Sleep(5000);
|
|
|
- SendtoPLC((laserMgmtList[0].laser_status_address+1).ToString(), (new Random(DateTime.Now.Millisecond).Next(4000,7000)).ToString());
|
|
|
+ SendtoPLC((laserMgmtList[0].laser_status_address + 1).ToString(), (new Random(DateTime.Now.Millisecond).Next(4000, 7000)).ToString());
|
|
|
Thread.Sleep(1);
|
|
|
SendtoPLC((laserMgmtList[0].laser_status_address + 2).ToString(), (new Random(DateTime.Now.Millisecond).Next(4000, 7000)).ToString());
|
|
|
Thread.Sleep(1);
|
|
|
@@ -785,6 +759,7 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Thread.Sleep(200);
|
|
|
}
|
|
|
}
|
|
|
private void wheelbaseAnim()
|
|
|
@@ -817,12 +792,13 @@ namespace parkMonitor.server
|
|
|
{
|
|
|
working = false;
|
|
|
SendtoPLC("81", "254");
|
|
|
- Thread.Sleep(2000);
|
|
|
+ Thread.Sleep(1000);
|
|
|
SendtoPLC("81", "255");
|
|
|
- Thread.Sleep(2000);
|
|
|
+ Thread.Sleep(1000);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ Thread.Sleep(200);
|
|
|
}
|
|
|
}
|
|
|
private void autoCycling()
|
|
|
@@ -835,7 +811,7 @@ namespace parkMonitor.server
|
|
|
int addr = Int32.Parse(p.Address);
|
|
|
int value = Int32.Parse(p.Value);
|
|
|
//停取车复位
|
|
|
- if(addr==park_completed_acknowledge_address && value == 0)
|
|
|
+ if (addr == park_completed_acknowledge_address && value == 0)
|
|
|
{
|
|
|
Thread.Sleep(2000);
|
|
|
SendtoPLC(park_completed_address.ToString(), "0");
|
|
|
@@ -862,6 +838,7 @@ namespace parkMonitor.server
|
|
|
SendtoPLC(addr.ToString(), "0");
|
|
|
}
|
|
|
}
|
|
|
+ Thread.Sleep(200);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -991,37 +968,37 @@ namespace parkMonitor.server
|
|
|
lock (laserMsg)
|
|
|
{
|
|
|
laser_rescan_countdown--;
|
|
|
- //停车指令置0
|
|
|
- PLCNode pn = new PLCNode(laser_start_address.ToString(), "0");
|
|
|
+ //停车指令置0
|
|
|
+ PLCNode pn = new PLCNode(laser_start_address.ToString(), "0");
|
|
|
plc.SetMessage(pn);
|
|
|
- //未终止重测,车未开走,停车指令归零后置1
|
|
|
- if (!laserMsg.abort_rescan)
|
|
|
+ //未终止重测,车未开走,停车指令归零后置1
|
|
|
+ if (!laserMsg.abort_rescan)
|
|
|
{
|
|
|
UILogServer.ins.error("激光" + laserMsg.id + "计算异常,重新测量");
|
|
|
- //重测检测心跳
|
|
|
- Task rescan_wait_heartbeat = Task.Factory.StartNew(() =>
|
|
|
+ //重测检测心跳
|
|
|
+ Task rescan_wait_heartbeat = Task.Factory.StartNew(() =>
|
|
|
+ {
|
|
|
+ MyTimer mt = new MyTimer();
|
|
|
+ mt.StartTiming();
|
|
|
+ while (laserMsg.status != 254 && laserMsg.status != 255)
|
|
|
{
|
|
|
- MyTimer mt = new MyTimer();
|
|
|
- mt.StartTiming();
|
|
|
- while (laserMsg.status != 254 && laserMsg.status != 255)
|
|
|
+ Thread.Sleep(1000);
|
|
|
+ mt.EndTiming();
|
|
|
+ int activationCount = 0;
|
|
|
+ if (mt.IsLonger(15, 1, false, out activationCount))
|
|
|
{
|
|
|
- Thread.Sleep(1000);
|
|
|
- mt.EndTiming();
|
|
|
- int activationCount = 0;
|
|
|
- if (mt.IsLonger(15, 1, false, out activationCount))
|
|
|
+ if (activationCount == 1)
|
|
|
+ {
|
|
|
+ UILogServer.ins.info("重测前未获得心跳,继续等待");
|
|
|
+ }
|
|
|
+ if (MyTimer.restart && !mt.rolledBack)
|
|
|
{
|
|
|
- if (activationCount == 1)
|
|
|
- {
|
|
|
- UILogServer.ins.info("重测前未获得心跳,继续等待");
|
|
|
- }
|
|
|
- if (MyTimer.restart && !mt.rolledBack)
|
|
|
- {
|
|
|
- mt.rolledBack = true;
|
|
|
- UILogServer.ins.error("发起重测前超时未能获取摆扫激光心跳,请检查设备");
|
|
|
- }
|
|
|
+ mt.rolledBack = true;
|
|
|
+ UILogServer.ins.error("发起重测前超时未能获取摆扫激光心跳,请检查设备");
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
UILogServer.ins.log("获得心跳,准备发起重测");
|
|
|
rescan_wait_heartbeat.Wait();
|
|
|
pn = new PLCNode(laser_start_address.ToString(), "1");
|