|
@@ -97,7 +97,7 @@ namespace parkMonitor.server
|
|
|
parkingLaserCenterX_address = Int32.Parse(ConfigurationManager.AppSettings.Get("parkingLaserCenterX_address"));
|
|
|
parkingSpaceID_address = Int32.Parse(ConfigurationManager.AppSettings.Get("parkingSpaceID_address"));
|
|
|
park_completed_address = Int32.Parse(ConfigurationManager.AppSettings.Get("park_completed_address"));
|
|
|
- park_completed_acknowledge_address = Int32.Parse(ConfigurationManager.AppSettings.Get("park_completed_acknowledge_address"));
|
|
|
+ park_completed_acknowledge_address = Int32.Parse(ConfigurationManager.AppSettings.Get("park_completed_acknowledge_address"));
|
|
|
|
|
|
fetching_startRobot_address = Int32.Parse(ConfigurationManager.AppSettings.Get("fetching_startRobot_address"));
|
|
|
fetch_to_address = Int32.Parse(ConfigurationManager.AppSettings.Get("fetch_to_address"));
|
|
@@ -108,7 +108,7 @@ namespace parkMonitor.server
|
|
|
|
|
|
laser_start_address = Int32.Parse(ConfigurationManager.AppSettings.Get("park_command_address"));
|
|
|
|
|
|
- rpu1 = new RobotProcessUnit(1, parking_startRobot_address, parkingLaserCenterX_address, parkingSpaceID_address, park_completed_address, park_completed_acknowledge_address, fetching_startRobot_address, fetch_to_address, fetch_completed_address,fetch_completed_acknowledge_address, frontWheelbase_address, rearWheelbase_address);
|
|
|
+ rpu1 = new RobotProcessUnit(1, parking_startRobot_address, parkingLaserCenterX_address, parkingSpaceID_address, park_completed_address, park_completed_acknowledge_address, fetching_startRobot_address, fetch_to_address, fetch_completed_address, fetch_completed_acknowledge_address, frontWheelbase_address, rearWheelbase_address);
|
|
|
|
|
|
//激光管理
|
|
|
for (int i = 1; i < 20; i++)
|
|
@@ -187,7 +187,7 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
}
|
|
|
json = JsonHelper.SerializeObject(return_Value);//序列化
|
|
|
- //List<PLCValue> prv = JsonHelper.DeserializeJsonToList<PLCValue>(json);
|
|
|
+ //List<PLCValue> prv = JsonHelper.DeserializeJsonToList<PLCValue>(json);
|
|
|
|
|
|
//Console.WriteLine(json);
|
|
|
}
|
|
@@ -466,8 +466,9 @@ namespace parkMonitor.server
|
|
|
foreach (PLCNode node in plcMsg.originalPlcList)
|
|
|
{
|
|
|
//判断激光空闲状态
|
|
|
- if (node.Address.Equals(lpuTemp.laser_status_address.ToString()) && (node.Value.Equals("254") || node.Value.Equals("255")))
|
|
|
+ if (node.Address.Equals(lpuTemp.laser_status_address.ToString()) && (node.Value.Equals("254") || node.Value.Equals("255")) && !lpuTemp.occupied)
|
|
|
{
|
|
|
+ lpuTemp.occupied = true;
|
|
|
jumpOut = true;
|
|
|
break;
|
|
|
}
|
|
@@ -534,21 +535,24 @@ namespace parkMonitor.server
|
|
|
}
|
|
|
if (laser_start_addr == "")
|
|
|
return;
|
|
|
-
|
|
|
- WaitForLaserReady(lpuTemp);
|
|
|
- SendtoPLC(laser_start_addr, "0");
|
|
|
- foreach (LaserMessage lm in plcMsg.laserMsgList)
|
|
|
+ lock (lpuTemp)
|
|
|
{
|
|
|
- if (lm.id == lpuTemp.id)
|
|
|
+ WaitForLaserReady(lpuTemp);
|
|
|
+ SendtoPLC(laser_start_addr, "0");
|
|
|
+
|
|
|
+ foreach (LaserMessage lm in plcMsg.laserMsgList)
|
|
|
{
|
|
|
- lm.status = 6;
|
|
|
- break;
|
|
|
+ if (lm.id == lpuTemp.id)
|
|
|
+ {
|
|
|
+ lm.status = 6;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ Thread.Sleep(300);
|
|
|
+ SendtoPLC(laser_start_addr, "1");
|
|
|
+ Thread.Sleep(100);
|
|
|
+ SendtoPLC("1", "1");//停车指令置1
|
|
|
}
|
|
|
- Thread.Sleep(300);
|
|
|
- SendtoPLC(laser_start_addr, "1");
|
|
|
- Thread.Sleep(100);
|
|
|
- SendtoPLC("1", "1");//停车指令置1
|
|
|
});
|
|
|
//Console.WriteLine("扫摆激光启动");
|
|
|
break;
|
|
@@ -700,8 +704,9 @@ namespace parkMonitor.server
|
|
|
public int laser_start_address { get; set; }
|
|
|
public int laser_status_address { get; set; }
|
|
|
public int id { get; set; }
|
|
|
+ public bool occupied { get; set; }
|
|
|
private int LASER_RESCAN_COUNT, LASER_HEARTBEAT_PERIOD, laser_rescan_countdown, laser_heartbeat_countdown;
|
|
|
- private bool laser_record, laser_heartbeat_test, enable_status_check = true,disconnected = false;
|
|
|
+ private bool laser_record, laser_heartbeat_test, enable_status_check = true, disconnected = false;
|
|
|
private HashSet<int> laser_heartbeat = new HashSet<int>();
|
|
|
private IEquipments plc = null;
|
|
|
public LaserMessage laserMsg = new LaserMessage();
|
|
@@ -713,6 +718,7 @@ namespace parkMonitor.server
|
|
|
laserMsg.id = id;
|
|
|
this.id = id;
|
|
|
laserMsg.status = 6;
|
|
|
+ occupied = false;
|
|
|
this.laser_start_address = park_command_address;
|
|
|
this.laser_status_address = laser_status_address;
|
|
|
LASER_RESCAN_COUNT = laser_rescan_count;
|
|
@@ -895,6 +901,7 @@ namespace parkMonitor.server
|
|
|
laserMsg.data.height = value;
|
|
|
}
|
|
|
laserMsg.recorded = true;
|
|
|
+ occupied = false;
|
|
|
//Console.WriteLine("激光测量数据已记录");
|
|
|
}
|
|
|
}
|
|
@@ -925,7 +932,7 @@ namespace parkMonitor.server
|
|
|
public int frontWheelbase { get; set; }
|
|
|
public int rearWheelbase { get; set; }
|
|
|
|
|
|
- public RobotProcessUnit(int id, int parking_startRobot_address, int parking_laserCenterX_address, int parkingSpaceID_address, int park_completed_address,int park_completed_acknowledge_address, int fetching_startRobot_address, int fetch_to_address, int fetch_completed_address,int fetch_completed_acknowledge_address, int frontWheelbase, int rearWheelbase)
|
|
|
+ public RobotProcessUnit(int id, int parking_startRobot_address, int parking_laserCenterX_address, int parkingSpaceID_address, int park_completed_address, int park_completed_acknowledge_address, int fetching_startRobot_address, int fetch_to_address, int fetch_completed_address, int fetch_completed_acknowledge_address, int frontWheelbase, int rearWheelbase)
|
|
|
{
|
|
|
this.id = id;
|
|
|
this.parking_startRobot_address = parking_startRobot_address;
|