Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO827-AutoScanAndLabel
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 10a4dfe6
由
张东亮
编写于
2022-09-09 16:46:42 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
回原优化,agv交互测试ok
1 个父辈
a718ffd1
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
151 行增加
和
85 行删除
AutoScanAndLabel/IOControl.cs
AutoScanAndLabel/UC/AgvControl.cs
DL.StandardRobots/Robots/StandardRobot.cs
DL.StandardRobots/TCP/ModbusTCPMaster.cs
DeviceLibrary/AGVManager.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
AutoScanAndLabel/IOControl.cs
查看文件 @
10a4dfe
...
...
@@ -237,8 +237,8 @@ namespace AutoScanAndLabel
private
void
btn
左侧电滚筒退出
_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
LeftMoto_Reverse
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
);
}
private
void
btn
左侧电滚筒停止
_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -247,14 +247,14 @@ namespace AutoScanAndLabel
}
private
void
btn
右侧电滚筒进入
_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
}
private
void
btn
右侧电滚筒退出
_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
RightMoto_R
everse
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
RightMoto_R
un
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
RightMoto_R
un
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
RightMoto_R
everse
,
IO_VALUE
.
HIGH
);
}
private
void
btn
右侧电滚筒停止
_Click
(
object
sender
,
EventArgs
e
)
...
...
AutoScanAndLabel/UC/AgvControl.cs
查看文件 @
10a4dfe
...
...
@@ -9,6 +9,7 @@ using System.Data;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
...
...
@@ -83,7 +84,8 @@ namespace AutoScanAndLabel.UC
//等待agv到位
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
// Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
RobotManage
.
mainMachine
.
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
//等待agv到位后执行,启动进入
ShelfOutAgv
();
...
...
@@ -93,7 +95,8 @@ namespace AutoScanAndLabel.UC
}
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
ToStandby
();
//通知agv上料结束, 也可以把上料结束的代码放到 R40_InShelf的结束步骤里去
...
...
@@ -127,18 +130,21 @@ namespace AutoScanAndLabel.UC
//等待agv到位
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
RobotManage
.
mainMachine
.
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
//等待agv到位后执行,启动料串离开
ShelfEnterAgv
();
while
(
RobotManage
.
mainMachine
.
RightMoveInfo
.
MoveStep
>=
MoveStep
.
R30_OutShelf
)
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
//通知agv上料结束, 也可以把上料结束的代码放到R30_OutShelf的结束步骤里去
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
ToStandby
();
InCalling
=
false
;
...
...
@@ -178,7 +184,7 @@ namespace AutoScanAndLabel.UC
}
private
bool
WaitMissionOk
()
{
return
curState
!=
null
&&
curState
.
MissionResult
.
Equals
(
MissionResult
.
任务执行成功
);
return
WaitMissionOk
((
uint
)
AGVManager
.
CurMissionId
);
}
private
void
button_Leftleavefull_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -202,19 +208,22 @@ namespace AutoScanAndLabel.UC
//等待agv到位
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
RobotManage
.
mainMachine
.
LeftMoveInfo
.
NewMove
(
MoveStep
.
L50_OutShelf
);
//等待agv到位后执行,启动料串离开
ShelfEnterAgv
();
while
(
RobotManage
.
mainMachine
.
LeftMoveInfo
.
MoveStep
>=
MoveStep
.
L50_OutShelf
)
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
//通知agv上料结束, 也可以把上料结束的代码放到L50_OutShelf的结束步骤里去
//等待agv到位
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
ToStandby
();
InCalling
=
false
;
...
...
@@ -246,18 +255,21 @@ namespace AutoScanAndLabel.UC
//等待agv到位
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
RobotManage
.
mainMachine
.
LeftMoveInfo
.
NewMove
(
MoveStep
.
L60_InShelf
);
//等待agv到位后执行,启动进入
ShelfOutAgv
();
while
(
RobotManage
.
mainMachine
.
LeftMoveInfo
.
MoveStep
>=
MoveStep
.
L60_InShelf
)
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
//通知agv上料结束, 也可以把上料结束的代码放到 L60_InShelf的结束步骤里去
while
(!
WaitMissionOk
())
{
Task
.
Delay
(
1000
).
Wait
();
//Task.Delay(1000).Wait();
Thread
.
Sleep
(
1000
);
}
ToStandby
();
InCalling
=
false
;
...
...
DL.StandardRobots/Robots/StandardRobot.cs
查看文件 @
10a4dfe
...
...
@@ -57,9 +57,9 @@ namespace DL.StandardRobot
{
if
(
data
.
Length
>=
240
)
{
preState
.
RunMissionId
=
GetUInt32
(
new
byte
[]
{
data
[
19
5
],
data
[
194
],
data
[
193
],
data
[
192
]
});
preState
.
MissionRunState
=
(
MissionRunState
)
GetUInt16
(
data
[
19
7
],
data
[
196
]);
preState
.
MissionResult
=
(
MissionResult
)
GetUInt16
(
data
[
19
9
],
data
[
198
]);
preState
.
RunMissionId
=
GetUInt32
(
new
byte
[]
{
data
[
19
2
],
data
[
193
],
data
[
194
],
data
[
195
]
});
preState
.
MissionRunState
=
(
MissionRunState
)
GetUInt16
(
data
[
19
6
],
data
[
197
]);
preState
.
MissionResult
=
(
MissionResult
)
GetUInt16
(
data
[
19
8
],
data
[
199
]);
if
(!
missionState
.
Equals
(
preState
))
{
missionState
.
RunMissionId
=
preState
.
RunMissionId
;
...
...
DL.StandardRobots/TCP/ModbusTCPMaster.cs
查看文件 @
10a4dfe
...
...
@@ -68,14 +68,13 @@ namespace DL.Com.TCP
{
try
{
Online
=
tcpClient
.
IsConnected
();
if
(!
Online
)
{
if
(
IsAutoReconnect
)
{
bool
rtn
=
tcpClient
.
Connect
(
IP
,
Port
,
ReceiveMessage
);
online
=
tcpClient
.
Connect
(
IP
,
Port
,
ReceiveMessage
);
Thread
.
Sleep
(
1000
);
if
(
rtn
)
if
(
online
)
{
RequestInfo
requestInfo
=
GetPeek
();
if
(
requestInfo
!=
null
&&
requestInfo
.
Requested
)
...
...
@@ -371,6 +370,8 @@ namespace DL.Com.TCP
RequestInfo
requestInfo
=
GetPeek
();
if
(
requestInfo
!=
null
&&
(!
requestInfo
.
Requested
||
requestInfo
.
RequestTimeOut
))
{
try
{
bool
rtn
=
tcpClient
.
Send
(
GetRequestBytes
(
requestInfo
.
FunCode
,
requestInfo
.
StartAddr
,
requestInfo
.
CountOrValue
,
requestInfo
.
EquipAddr
,
requestInfo
.
Values
));
requestInfo
.
SetRequestState
(
rtn
);
if
(!
GetFunction
(
requestInfo
.
FunCode
).
Equals
(
RegisterFunction
.
Read
))
...
...
@@ -378,6 +379,11 @@ namespace DL.Com.TCP
else
LogUtil
.
Debug
(
$
"Request {requestInfo}"
);
}
catch
{
online
=
false
;
}
}
}
}
/// <summary>
...
...
DeviceLibrary/AGVManager.cs
查看文件 @
10a4dfe
...
...
@@ -32,8 +32,10 @@ namespace DeviceLibrary
{
robot
.
MissionSateChanged
-=
changedEventHandler
;
}
public
static
int
CurMissionId
=
0
;
public
static
void
AddMission
(
int
id
)
{
CurMissionId
=
id
;
robot
.
AddMission
(
id
);
}
public
static
bool
IsConnected
()
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
查看文件 @
10a4dfe
...
...
@@ -14,7 +14,7 @@ namespace DeviceLibrary
{
partial
class
MainMachine
{
Point
Label_p3
;
void
LabelProcess
()
{
if
(
CheckWait
(
LabelMoveInfo
))
...
...
@@ -23,12 +23,21 @@ namespace DeviceLibrary
switch
(
LabelMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Lbl01
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_WaitPrint
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P2
,
Config
.
Label_X_P2_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Y_P2
,
Config
.
Label_Y_P2_speed
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl02
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P1
,
Config
.
Label_X_P1_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X到待机点,Label_Y到贴标前点"
);
break
;
case
MoveStep
.
Lbl02
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl02_1
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Y_P2
,
Config
.
Label_Y_P2_speed
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_R_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_XYZ转到取标点,等待标签打印完毕"
);
LabelMoveInfo
.
log
(
"Label_YR转到取标点"
);
break
;
case
MoveStep
.
Lbl02_1
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_WaitPrint
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P2
,
Config
.
Label_X_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X转到取标点,等待标签打印完毕"
);
break
;
case
MoveStep
.
Lbl_WaitPrint
:
if
(
LastPrintStatus
==
Asa
.
PrintLabel
.
PrinterStatus
.
Idle
)
{
...
...
@@ -89,19 +98,27 @@ namespace DeviceLibrary
//计算贴标角度的脉冲值
int
labelAxisPos
=
Config
.
Label_R_360
/
350
*
labelAngle
;
//计算像素点位与中心点的差
Point
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
Label_p3
.
X
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
)
+
Config
.
Label_X_P3
;
Label_p3
.
Y
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
)
+
Config
.
Label_Y_P3
;
LabelMoveInfo
.
log
(
$
"计算贴标像素点位为{p},轴点位为{Label_p3},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW}"
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl11
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
X
,
Config
.
Label_X_P3_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
Y
,
Config
.
Label_Y_P3_speed
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl10_1
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P1
,
Config
.
Label_X_P1_speed
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
labelAxisPos
,
Config
.
Label_R_P2_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P4
,
Config
.
Label_Z_P4_speed
);
LabelMoveInfo
.
log
(
"Label_XYZ转到贴标点."
);
LabelMoveInfo
.
log
(
"Label_X到待机点,Z转到贴标点."
);
break
;
case
MoveStep
.
Lbl10_1
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl10_2
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
Y
,
Config
.
Label_Y_P3_speed
);
LabelMoveInfo
.
log
(
"Label_Y到贴标点."
);
break
;
case
MoveStep
.
Lbl10_2
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl11
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
X
,
Config
.
Label_X_P3_speed
);
LabelMoveInfo
.
log
(
"Label_X到贴标点."
);
break
;
case
MoveStep
.
Lbl11
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl12
);
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
查看文件 @
10a4dfe
...
...
@@ -127,8 +127,8 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
L52
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L53
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
LeftMoto_Reverse
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
,
false
);
MiddleMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LeftEnd_Check
,
IO_VALUE
.
LOW
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
LeftMoveInfo
.
log
(
$
"电滚筒向外滚动"
);
...
...
@@ -142,7 +142,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
L54
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
REND
);
IOMove
(
IO_Type
.
LeftMoto_R
un
,
IO_VALUE
.
HIGH
,
false
,
500
);
IOMove
(
IO_Type
.
LeftMoto_R
everse
,
IO_VALUE
.
HIGH
,
false
,
500
);
LeftMoveInfo
.
log
(
$
"电滚停止"
);
break
;
//}
...
...
@@ -162,9 +162,9 @@ namespace DeviceLibrary
case
MoveStep
.
L62
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L63
);
IOMove
(
IO_Type
.
LeftMoto_Reverse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
,
false
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
);
MiddleMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LeftEnd_Check
,
IO_VALUE
.
HIGH
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
6000
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
6000
0
));
LeftMoveInfo
.
OneWaitCanEndStep
=
true
;
LeftMoveInfo
.
log
(
$
"等待料串到位"
);
break
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
查看文件 @
10a4dfe
...
...
@@ -155,8 +155,8 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
R32
:
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R33
);
IOMove
(
IO_Type
.
RightMoto_R
everse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_R
un
,
IO_VALUE
.
HIGH
,
false
);
IOMove
(
IO_Type
.
RightMoto_R
un
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_R
everse
,
IO_VALUE
.
HIGH
);
MiddleMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
RightEnd_Check
,
IO_VALUE
.
LOW
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
RightMoveInfo
.
log
(
$
"电滚筒向外滚动"
);
...
...
@@ -170,7 +170,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
R34
:
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
REND
);
IOMove
(
IO_Type
.
RightMoto_R
un
,
IO_VALUE
.
HIGH
,
false
,
500
);
IOMove
(
IO_Type
.
RightMoto_R
everse
,
IO_VALUE
.
HIGH
,
false
,
500
);
RightMoveInfo
.
log
(
$
"电滚停止"
);
break
;
//}
...
...
@@ -189,10 +189,10 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
R42
:
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R43
);
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
,
false
);
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
RightEnd_Check
,
IO_VALUE
.
HIGH
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
6000
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
6000
0
));
RightMoveInfo
.
OneWaitCanEndStep
=
true
;
RightMoveInfo
.
log
(
$
"等待料串到位"
);
break
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
查看文件 @
10a4dfe
...
...
@@ -13,14 +13,15 @@ namespace DeviceLibrary
{
public
partial
class
MainMachine
:
IRobot
{
public
string
Name
{
get
;
set
;
}
=
crc
.
GetString
(
"Res0036"
,
"移载"
);
private
bool
_canRunning
=
true
;
public
string
Name
{
get
;
set
;
}
=
crc
.
GetString
(
"Res0036"
,
"移载"
);
private
bool
_canRunning
=
true
;
public
bool
canRunning
{
get
{
return
_canRunning
;
}
set
{
if
(
_canRunning
!=
value
)
{
if
(
_canRunning
!=
value
)
{
Msg
.
setlogones
();
}
_canRunning
=
value
;
...
...
@@ -69,20 +70,21 @@ namespace DeviceLibrary
public
MainMachine
(
Robot_Config
_config
)
{
public
MainMachine
(
Robot_Config
_config
)
{
Config
=
_config
;
RightMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0039"
,
"右侧取料"
));
RightMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0039"
,
"右侧取料"
));
RightMoveInfo
.
SetStateDelegate
(
RightState
);
MiddleMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0042"
,
"移栽"
));
MiddleMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0042"
,
"移栽"
));
MiddleMoveInfo
.
SetStateDelegate
(
MiddleState
);
LeftMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0051"
,
"左侧放料"
));
LeftMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0051"
,
"左侧放料"
));
LeftMoveInfo
.
SetStateDelegate
(
LeftState
);
LabelMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0052"
,
"贴标"
));
LabelMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0052"
,
"贴标"
));
LabelMoveInfo
.
SetStateDelegate
(
LabelState
);
ResetMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0053"
,
"重置"
));
ResetMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0053"
,
"重置"
));
#
region
初始化
led
灯
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_HddLed
].
GetIOAddr
());
...
...
@@ -106,36 +108,37 @@ namespace DeviceLibrary
Take_Middle_Axis
.
interference
+=
Take_Middle_Axis_interference
;
electricClamp
=
RobotManage
.
electricGripper
;
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
AlarmBuzzer
.
SetOnOffAction
(()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
InitPrint
();
LedProcessInit
();
}
private
(
bool
,
string
)
Take_Middle_Axis_interference
(
int
from
,
int
to
)
private
(
bool
,
string
)
Take_Middle_Axis_interference
(
int
from
,
int
to
)
{
if
(
to
>
from
)
{
if
(
Label_Y_Axis
.
GetAclPosition
()
>
Config
.
Label_Y_P2
+
Label_Y_Axis
.
Config
.
CanErrorCountMax
)
{
return
(
true
,
crc
.
GetString
(
"Res0054"
,
"可能与贴标Y轴干涉"
));
return
(
true
,
crc
.
GetString
(
"Res0054"
,
"可能与贴标Y轴干涉"
));
}
}
return
(
false
,
""
);
return
(
false
,
""
);
}
private
(
bool
,
string
)
Label_Y_Axis_interference
(
int
from
,
int
to
)
{
if
(
to
>
from
)
{
if
(
Take_Middle_Axis
.
GetAclPosition
()
>
Math
.
Max
(
Config
.
Take_Middle_P1
,
Config
.
Take_Middle_P2
)
+
Take_Middle_Axis
.
Config
.
CanErrorCountMax
)
{
return
(
true
,
crc
.
GetString
(
"Res0055"
,
"可能与旋转轴干涉"
));
;
if
(
Take_Middle_Axis
.
GetAclPosition
()
>
Math
.
Max
(
Config
.
Take_Middle_P1
,
Config
.
Take_Middle_P2
)
+
Take_Middle_Axis
.
Config
.
CanErrorCountMax
)
{
return
(
true
,
crc
.
GetString
(
"Res0055"
,
"可能与旋转轴干涉"
));
;
}
}
var
Label_Z_Pos
=
Label_Z_Axis
.
GetAclPosition
();
if
(
Label_Z_Pos
>
Math
.
Max
(
Config
.
Label_Z_P2
,
Config
.
Label_Z_P4
)
+
Label_Z_Axis
.
Config
.
CanErrorCountMax
)
return
(
true
,
crc
.
GetString
(
"Res0056"
,
"可能与贴标Z轴干涉"
));
;
if
(
Label_Z_Pos
>
Math
.
Max
(
Config
.
Label_Z_P2
,
Config
.
Label_Z_P4
)
+
Label_Z_Axis
.
Config
.
CanErrorCountMax
)
return
(
true
,
crc
.
GetString
(
"Res0056"
,
"可能与贴标Z轴干涉"
));
;
return
(
false
,
""
);
}
...
...
@@ -143,10 +146,12 @@ namespace DeviceLibrary
/// <summary>
/// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary>
bool
mstart
=
true
;
public
void
Run
()
{
bool
mstart
=
true
;
public
void
Run
()
{
mstart
=
true
;
while
(
mstart
)
{
while
(
mstart
)
{
try
{
canRunning
=
DeviceCheck
();
...
...
@@ -176,7 +181,8 @@ namespace DeviceLibrary
Msg
.
add
(
ex
.
ToString
(),
MsgLevel
.
warning
);
Msg
.
setlogones
();
}
finally
{
finally
{
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
//ProcessMoveinfoEvent?.Invoke(MoveInfo.List);
Msg
.
clear
();
...
...
@@ -184,7 +190,8 @@ namespace DeviceLibrary
}
LogUtil
.
info
(
"主线程已退出."
);
}
public
void
Stop
()
{
public
void
Stop
()
{
mstart
=
false
;
Thread
.
Sleep
(
300
);
Alarm
(
AlarmType
.
None
);
...
...
@@ -193,7 +200,8 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
LabelCylinder_Work
,
IO_VALUE
.
LOW
);
}
public
void
BeginHomeReset
(
bool
firstRun
=
false
)
{
public
void
BeginHomeReset
(
bool
firstRun
=
false
)
{
if
(!
firstRun
)
{
StopMove
();
...
...
@@ -223,7 +231,7 @@ namespace DeviceLibrary
Right_Batch_Axis
.
HomeMove
(
ResetMoveInfo
);
electricClamp
.
HomeReset
();
break
;
case
MoveStep
.
H02_HomeReset
:
case
MoveStep
.
H02_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H03_HomeReset
);
Label_R_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
...
...
@@ -258,9 +266,20 @@ namespace DeviceLibrary
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
break
;
case
MoveStep
.
H07_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H
END
_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H
08
_HomeReset
);
Take_Middle_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Take_Middle_P1
,
Config
.
Take_Middle_P1_speed
);
ResetMoveInfo
.
log
(
"正在回原 进出料口滚筒正转10秒"
);
IOMove
(
IO_Type
.
LeftMoto_Reverse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
break
;
case
MoveStep
.
H08_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原 阻挡气缸判断"
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
LOW
);
if
(
IOManager
.
IOValue
(
IO_Type
.
LeftEnd_Check
)
==
IO_VALUE
.
LOW
)
{
CylinderMove
(
ResetMoveInfo
,
IO_Type
.
LeftStopUP
,
IO_Type
.
LeftStopDown
);
...
...
@@ -283,18 +302,20 @@ namespace DeviceLibrary
break
;
}
}
public
bool
IgnoreSafecheck
=
false
;
public
bool
IgnoreSafecheck
=
false
;
public
bool
IgnoreGratingSignal
=
false
;
bool
lastSafeCheckStatus
=
true
;
bool
SafeCheck
()
{
bool
SafeCheck
()
{
bool
ok
=
true
;
if
(
UserPause
)
{
Msg
.
add
(
crc
.
GetString
(
"Res0057"
,
"用户暂停"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0057"
,
"用户暂停"
),
MsgLevel
.
warning
);
DeviceSuddenStop
();
ok
=
false
;
}
else
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
}
else
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
LOW
)
...
...
@@ -303,17 +324,17 @@ namespace DeviceLibrary
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0058"
,
"安全光栅被遮挡"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0058"
,
"安全光栅被遮挡"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
}
if
(
IOValue
(
IO_Type
.
HasNgBox
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
crc
.
GetString
(
"Res0062"
,
"没有检测到NG料箱"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0062"
,
"没有检测到NG料箱"
),
MsgLevel
.
warning
);
ok
=
false
;
}
if
(
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
crc
.
GetString
(
"Res0063"
,
"没有检测打印机"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0063"
,
"没有检测打印机"
),
MsgLevel
.
warning
);
ok
=
false
;
}
if
(
IOValue
(
IO_Type
.
LeftBackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -323,7 +344,7 @@ namespace DeviceLibrary
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0064"
,
"左后门没有关闭"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0064"
,
"左后门没有关闭"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
}
if
(
IOValue
(
IO_Type
.
RightBackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -332,13 +353,14 @@ namespace DeviceLibrary
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0065"
,
"右后门没有关闭"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0065"
,
"右后门没有关闭"
)
+
(
ok
?
crc
.
GetString
(
"Res0061"
,
"[已忽略]"
)
:
""
),
MsgLevel
.
warning
);
}
lastSafeCheckStatus
=
ok
;
return
ok
;
}
void
DeviceSuddenStop
()
{
void
DeviceSuddenStop
()
{
if
(
lastSafeCheckStatus
)
{
//lastSafeCheckStatus = false;
...
...
@@ -359,22 +381,24 @@ namespace DeviceLibrary
DateTime
lastAirCloseTime
=
DateTime
.
MinValue
;
internal
DateTime
checkAlarmTime
=
DateTime
.
Now
;
public
bool
DeviceCheck
()
{
public
bool
DeviceCheck
()
{
bool
ok
=
true
;
if
(
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
{
Alarm
(
AlarmType
.
SuddenStop
);
Msg
.
add
(
crc
.
GetString
(
"Res0066"
,
"急停中"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0066"
,
"急停中"
),
MsgLevel
.
warning
);
ok
=
false
;
}
else
if
(
alarmType
==
AlarmType
.
SuddenStop
)
{
else
if
(
alarmType
==
AlarmType
.
SuddenStop
)
{
//if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH))
//{
// Alarm(AlarmType.None);
//}
//else
{
Msg
.
add
(
crc
.
GetString
(
"Res0067"
,
"系统需要重置"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0067"
,
"系统需要重置"
),
MsgLevel
.
warning
);
ok
=
false
;
}
}
...
...
@@ -387,13 +411,14 @@ namespace DeviceLibrary
if
(
span
.
TotalSeconds
>
RobotManage
.
Config
.
AirCheckSeconds
)
{
ok
=
false
;
Msg
.
add
(
crc
.
GetString
(
"Res0068"
,
"气压不足"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0068"
,
"气压不足"
),
MsgLevel
.
warning
);
}
}
else
{
else
{
lastAirCloseTime
=
DateTime
.
MinValue
;
}
if
(
alarmType
!=
AlarmType
.
SuddenStop
)
if
(
alarmType
!=
AlarmType
.
SuddenStop
)
{
TimeSpan
span
=
DateTime
.
Now
-
checkAlarmTime
;
//在回原点,复位,出入库时,检测报警间隔减小
...
...
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
查看文件 @
10a4dfe
...
...
@@ -18,6 +18,7 @@ namespace DeviceLibrary
H05_HomeReset
,
H06_HomeReset
,
H07_HomeReset
,
H08_HomeReset
,
HEND_HomeReset
,
//右侧常规扫码流程
...
...
@@ -101,10 +102,13 @@ namespace DeviceLibrary
Lbl_Printted
,
Lbl01
,
Lbl02
,
Lbl02_1
,
Lbl03
,
Lbl04
,
Lbl05
,
Lbl10
,
Lbl10_1
,
Lbl10_2
,
Lbl11
,
Lbl12
,
Lbl13
,
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论