Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e004515f
由
LN
编写于
2024-06-14 17:07:41 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
复位时去校准位进行声波信号检测。
1 个父辈
f8461585
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
214 行增加
和
60 行删除
DeviceLibrary/DeviceLibrary/flyelectronicControl/Flyelectronic_485_RGB_Controller.cs
DeviceLibrary/DeviceLibrary/weightSensor/OKLE_WeightSensor.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/MainMachine _Common.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MoveStep.cs
DeviceLibrary/theMachine/RobotManage.cs
TheMachine/resources/en-US.lngres
TheMachine/resources/ja-JP.lngres
TheMachine/resources/zh-CN.lngres
DeviceLibrary/DeviceLibrary/flyelectronicControl/Flyelectronic_485_RGB_Controller.cs
查看文件 @
e004515
...
...
@@ -164,7 +164,7 @@ namespace DeviceLibrary
if
(
r
>
0
)
{
var
recvdata
=
Encoding
.
ASCII
.
GetString
(
recv
,
0
,
r
);
log
(
"recvdata: "
+
recvdata
);
debug
log
(
"recvdata: "
+
recvdata
);
return
recv
.
Take
(
r
).
ToArray
();
//.Split(',');
}
}
...
...
@@ -192,6 +192,11 @@ namespace DeviceLibrary
loge
.
Info
(
Name
+
$
"[{comPortName}]"
+
":"
+
msg
);
Console
.
WriteLine
(
msg
);
}
void
debuglog
(
string
msg
)
{
loge
.
Info
(
Name
+
$
"[{comPortName}]"
+
":"
+
msg
);
Console
.
WriteLine
(
msg
);
}
static
class
CommandByte
{
public
static
byte
[]
GetDeviceID
=
ConvertStringToByteArray
(
"DD 55 EE 00 00 00 00 00 8F 01 00 00 00 03 00 01 00 00 00 AA BB"
);
...
...
DeviceLibrary/DeviceLibrary/weightSensor/OKLE_WeightSensor.cs
查看文件 @
e004515
...
...
@@ -237,7 +237,7 @@ namespace DeviceLibrary
port
.
DiscardInBuffer
();
CalculateCRC
(
recvdata
,
recvdata
.
Length
-
2
,
out
ushort
checksun
);
var
crcbyte
=
BitConverter
.
GetBytes
(
checksun
);
log
(
cmdname
+
"\trecvdata: "
+
BitConverter
.
ToString
(
recvdata
).
Replace
(
"-"
,
" "
)
+
" crc:"
+
BitConverter
.
ToString
(
crcbyte
).
Replace
(
"-"
,
" "
));
debug
log
(
cmdname
+
"\trecvdata: "
+
BitConverter
.
ToString
(
recvdata
).
Replace
(
"-"
,
" "
)
+
" crc:"
+
BitConverter
.
ToString
(
crcbyte
).
Replace
(
"-"
,
" "
));
if
(
recvdata
.
Length
>
5
&&
recvdata
[
1
]
==
buff
[
1
]
&&
recvdata
[
recvdata
.
Length
-
2
]
==
crcbyte
[
0
]
...
...
@@ -388,5 +388,10 @@ namespace DeviceLibrary
loge
.
Info
(
"x光高压:"
+
msg
);
Console
.
WriteLine
(
msg
);
}
void
debuglog
(
string
msg
)
{
loge
.
Debug
(
"x光高压:"
+
msg
);
Console
.
WriteLine
(
msg
);
}
}
}
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
e004515
...
...
@@ -203,8 +203,7 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"{storeMoveType}:旋转轴去取料点P2【{Fix.Middle_P2}】【{Config.Middle_P2_speed}】"
);
UpDown_Axis
.
AbsMove
(
MoveInfo
,
Fix
.
UpDown_PH
,
Config
.
UpDown_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:升降轴去取料高点【{Fix.UpDown_PH}】【{Config.UpDown_P1_speed}】"
);
SensorProcess
();
break
;
case
MoveStep
.
StoreFIX02
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX03
);
...
...
@@ -214,12 +213,7 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴去取料点【{Fix.InOut_P2}】【{Config.InOut_P2_speed}】"
);
break
;
case
MoveStep
.
StoreFIX03
:
bool
sCheck
=
SensorProcess
();
if
(!
sCheck
)
{
}
RobotManage
.
CameraA
.
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
To
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
ToFix
));
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX04
);
Comp_Axis
.
AbsMove
(
MoveInfo
,
Fix
.
Comp_PH
,
Config
.
Comp_P2_speed
);
...
...
@@ -230,6 +224,30 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreFIX04
:
if
(
To
.
Reel
.
PlateW
.
Equals
(
7
)
&&
RobotManage
.
NeedSensorPro
())
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX041_Sensor
);
MoveInfo
.
log
(
$
"{storeMoveType}:等待500ms进行声波传感器检测"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
}
else
{
if
(
Setting_Init
.
Enable_CheckReelLocInFix
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX04_01_InoutBackToP1
);
InOut_Axis
.
AbsMove
(
MoveInfo
,
Config
.
InOut_P1
,
Config
.
InOut_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴回到待机点【{Config.InOut_P1}】【{Config.InOut_P1_speed}】"
);
}
else
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX05
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
}
break
;
case
MoveStep
.
StoreFIX041_Sensor
:
RobotManage
.
SensorProcess
();
if
(
Setting_Init
.
Enable_CheckReelLocInFix
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX04_01_InoutBackToP1
);
...
...
@@ -241,7 +259,6 @@ namespace DeviceLibrary
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreFIX05
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
break
;
#
region
料盘放置位置检查
case
MoveStep
.
StoreFIX04_01_InoutBackToP1
:
...
...
@@ -460,47 +477,6 @@ namespace DeviceLibrary
// //return pos > 0 ? RobotManage.CameraA : RobotManage.CameraB;
// return RobotManage.CameraA;
//}
/// <summary>
/// 返回ture表示没问题,返回false需要报警
/// </summary>
/// <returns></returns>
private
bool
SensorProcess
()
{
try
{
if
(
Setting_Init
.
Device_DauxiKS107_PortName
==
""
||
RobotManage
.
dauxiKS107Controller
==
null
||
RobotManage
.
dauxiKS107Controller
.
PortIsOpen
()==
false
)
{
return
true
;
}
if
(
RobotManage
.
dauxiKS107Controller
.
Quary
(
out
int
value
,
out
string
errMsg
))
{
int
cha
=
value
-
Setting_Init
.
Device_DauxiKS107_BaseValue
;
if
(
cha
>
Setting_Init
.
Device_DauxiKS107_ErrorValue
)
{
TimeSpan
span
=
DateTime
.
Now
-
RobotManage
.
LastResetTime
;
RobotManage
.
SensorNeedReset
=
true
;
if
(
span
.
TotalHours
>
1
)
{
LogUtil
.
error
(
$
"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset}, 最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue},"
+
$
"上次复位时间{RobotManage.LastResetTime.ToShortDateString()},一小时内出现红外传感器检测错误,需要报警"
);
RobotManage
.
SensorNeedAlarm
=
true
;
return
false
;
}
else
{
LogUtil
.
error
(
$
"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset},最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}"
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SensorProcess 出错:"
+
ex
.
ToString
());
}
return
true
;
}
}
}
DeviceLibrary/theMachine/MainMachine _Common.cs
查看文件 @
e004515
...
...
@@ -223,8 +223,7 @@ namespace DeviceLibrary
this
.
alarmType
=
_alarmType
;
if
(
_alarmType
.
Equals
(
AlarmType
.
AxisAlarm
)
||
_alarmType
.
Equals
(
AlarmType
.
AxisMoveError
))
{
LogUtil
.
error
(
Name
+
"轴报警, 停止运动, 打开报警灯"
);
LogUtil
.
error
(
Name
+
"轴报警, 停止运动, 打开报警灯"
);
StopMove
(
true
);
}
else
if
(
_alarmType
==
AlarmType
.
SuddenStop
)
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
e004515
...
...
@@ -498,8 +498,16 @@ namespace DeviceLibrary
}
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"夹爪上上没有料盘"
);
if
(
RobotManage
.
NeedSensorPro
())
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H21_HomeStartCheck
);
ResetMoveInfo
.
log
(
"夹爪上没有料盘,开始去进行超声感应器检测"
);
}
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"夹爪上上没有料盘"
);
}
}
break
;
case
MoveStep
.
H08_HomeReset
:
...
...
@@ -596,8 +604,16 @@ namespace DeviceLibrary
}
else
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
HIGH
)
&&
!
h
.
Value
)
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"关门NG口门"
);
if
(
RobotManage
.
NeedSensorPro
())
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H21_HomeStartCheck
);
ResetMoveInfo
.
log
(
"关门NG口门,开始去进行超声感应器检测"
);
}
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"关门NG口门"
);
}
CloseSingleDoor
(
ResetMoveInfo
);
OpenFlipDoor
(
ResetMoveInfo
);
}
...
...
@@ -606,6 +622,93 @@ namespace DeviceLibrary
Msg
.
add
(
crc
.
GetString
(
L
.
wait_put_reel_into_ngdoor
,
"等待阻挡物离开光栅"
),
MsgLevel
.
warning
);
}
break
;
#
region
声波传感器检测
case
MoveStep
.
H21_HomeStartCheck
:
FixPos
=
BoxStorePosition
.
GetFixPos
(
Config
,
new
ReelParam
(
""
,
7
,
8
));
if
(
FixPos
==
null
)
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"未找到校准库位,不进行声波传感器检测"
);
}
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H22_HomeCheck
);
Middle_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
Middle_P2
,
Config
.
Middle_P2_speed
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid} 旋转轴去取料点P2【{FixPos.Middle_P2}】【{Config.Middle_P2_speed}】"
);
UpDown_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
UpDown_PH
,
Config
.
UpDown_P1_speed
);
ResetMoveInfo
.
log
(
$
" {FixPos.posid}升降轴去取料高点【{FixPos.UpDown_PH}】【{Config.UpDown_P1_speed}】"
);
Comp_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
Comp_PL
,
Config
.
Comp_P2_speed
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:压紧轴去压紧低点【{FixPos.Comp_PL}】【{Config.Comp_P2_speed}】"
);
}
break
;
case
MoveStep
.
H22_HomeCheck
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H23_HomeCheck
);
InOut_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
InOut_P2
,
Config
.
InOut_P2_speed
);
InOut_Axis
.
SensorDetection
(
Setting_Init
.
Device_WeightSensor_MaxValue
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:进出轴去取料点【{FixPos.InOut_P2}】【{Config.InOut_P2_speed}】"
);
break
;
case
MoveStep
.
H23_HomeCheck
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H24_HomeCheck
);
Comp_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
Comp_PH
,
Config
.
Comp_P2_speed
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:压紧轴去压紧高点【{FixPos.Comp_PH}】【{Config.Comp_P2_speed}】"
);
UpDown_Axis
.
AbsMove
(
ResetMoveInfo
,
FixPos
.
UpDown_PL
,
Config
.
UpDown_P3_speed
/
2
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:升降轴去取料低点【{FixPos.UpDown_PL}】【{Config.UpDown_P3_speed / 2}】"
);
break
;
case
MoveStep
.
H24_HomeCheck
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H25_HomeCheck
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:等待500ms进行声波传感器检测"
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
break
;
case
MoveStep
.
H25_HomeCheck
:
bool
checkOk
=
RobotManage
.
SensorProcess
();
if
(
checkOk
)
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H27_HomeCheck
);
InOut_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
InOut_P1
,
Config
.
InOut_P1_speed
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:进出轴返回待机点【{Config.InOut_P1}】【{Config.InOut_P1_speed}】"
);
}
else
{
//直接到报警步骤
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H31_HomeError
);
ResetMoveInfo
.
log
(
$
"{FixPos.posid}:声波感应器误差过大,需要报警"
);
}
break
;
case
MoveStep
.
H27_HomeCheck
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H28_HomeCheck
);
ResetMoveInfo
.
log
(
"旋转轴,升降轴,压紧轴,到P1待机点"
);
Middle_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Middle_P1
,
Config
.
Middle_P1_speed
);
UpDown_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
UpDown_P1
,
Config
.
UpDown_P1_speed
);
Comp_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Comp_P1
,
Config
.
Comp_P1_speed
);
break
;
case
MoveStep
.
H28_HomeCheck
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"声波感应器检测OK"
);
break
;
case
MoveStep
.
H31_HomeError
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
Msg
.
add
(
crc
.
GetString
(
"shengboError"
,
"声波感应器误差过大,请检查后重新复位"
),
MsgLevel
.
alarm
);
break
;
// H22_HomeCheck,//旋转轴到校准为止,升降轴到高点,压紧轴压紧
//H23_HomeCheck,//进出轴进入
//H24_HomeCheck,//升降轴下降,压紧轴放松
//H25_HomeCheck,//等待500毫秒
//H26_HomeCheck,//开始检测
//H27_HomeCheck,//进出轴返回待机点
//H28_HomeCheck,//旋转轴升降轴到待机点
//H31_HomeError,//检测错误,报警
#
endregion
case
MoveStep
.
HEND_HomeReset
:
//forceHome = false;
StringMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
...
...
@@ -651,6 +754,7 @@ namespace DeviceLibrary
break
;
}
}
private
BoxStorePosition
FixPos
=
null
;
//bool _IgnoreSafecheck = false;
public
bool
IgnoreSafecheck
{
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
e004515
...
...
@@ -37,6 +37,18 @@ namespace DeviceLibrary
H14_HomeReset
,
H15_HomeReset
,
H16_HomeReset
,
//回原点后,声波传感器检测
H21_HomeStartCheck
,
H22_HomeCheck
,
//旋转轴到校准为止,升降轴到高点,压紧轴压紧
H23_HomeCheck
,
//进出轴进入
H24_HomeCheck
,
//升降轴下降,压紧轴放松
H25_HomeCheck
,
//等待500毫秒
H26_HomeCheck
,
//开始检测
H27_HomeCheck
,
//进出轴返回待机点
H28_HomeCheck
,
//旋转轴升降轴到待机点
H31_HomeError
,
//检测错误,报警
HEND_HomeReset
,
...
...
@@ -148,6 +160,7 @@ namespace DeviceLibrary
StoreFIX02
,
StoreFIX03
,
StoreFIX04
,
StoreFIX041_Sensor
,
//等待500ms后超声感应器检测
StoreFIX04_01_InoutBackToP1
,
StoreFIX04_02_UpToCamLoc
,
StoreFIX04_03_CheckLocation
,
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
e004515
...
...
@@ -301,8 +301,57 @@ namespace DeviceLibrary
Setting_Init
.
Buffer_FixBuffInfo
=
""
;
}
#
endregion
}
public
static
bool
NeedSensorPro
()
{
if
(
Setting_Init
.
Device_DauxiKS107_PortName
==
""
||
RobotManage
.
dauxiKS107Controller
==
null
||
RobotManage
.
dauxiKS107Controller
.
PortIsOpen
()
==
false
)
{
return
false
;
}
return
true
;
}
/// <summary>
/// 返回ture表示没问题,返回false需要报警
/// </summary>
/// <returns></returns>
public
static
bool
SensorProcess
()
{
try
{
if
(
Setting_Init
.
Device_DauxiKS107_PortName
==
""
||
RobotManage
.
dauxiKS107Controller
==
null
||
RobotManage
.
dauxiKS107Controller
.
PortIsOpen
()
==
false
)
{
return
true
;
}
if
(
RobotManage
.
dauxiKS107Controller
.
Quary
(
out
int
value
,
out
string
errMsg
))
{
int
cha
=
value
-
Setting_Init
.
Device_DauxiKS107_BaseValue
;
if
(
cha
>
Setting_Init
.
Device_DauxiKS107_ErrorValue
)
{
TimeSpan
span
=
DateTime
.
Now
-
RobotManage
.
LastResetTime
;
RobotManage
.
SensorNeedReset
=
true
;
if
(
span
.
TotalHours
>
1
)
{
LogUtil
.
error
(
$
"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset}, 最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue},"
+
$
"上次复位时间{RobotManage.LastResetTime.ToShortDateString()},一小时内出现红外传感器检测错误,需要报警"
);
RobotManage
.
SensorNeedAlarm
=
true
;
return
false
;
}
else
{
LogUtil
.
error
(
$
"传感器误差过大,需要复位:当前值:{value},基准值:{Setting_Init.Device_DauxiKS107_BaseValue},SensorErroCount={RobotManage.SensorNeedReset},最大误差:{Setting_Init.Device_DauxiKS107_ErrorValue}"
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SensorProcess 出错:"
+
ex
.
ToString
());
}
return
true
;
}
}
public
enum
StoreType
{
TypeA
,
TypeB
...
...
TheMachine/resources/en-US.lngres
查看文件 @
e004515
...
...
@@ -431,3 +431,4 @@ comDataError 串口{0}数据错误{1} Serial port {0} data error {1}
comOpenFail 串口{0}打开失败 Serial port {0} open failed
shengbosensor 声波传感器 Acoustic Sensors
yalisensor 压力传感器 Pressure sensors
shengboError 声波感应器误差过大,请检查后重新复位 Acoustic sensor error is too large, please check and reset
TheMachine/resources/ja-JP.lngres
查看文件 @
e004515
...
...
@@ -433,4 +433,5 @@ comDataError 涓插彛{0}鏁版嵁閿欒{1} 銈枫儶銈€儷銉濄兗銉 {0} 銉囥兗銈裤偍銉
comOpenFail 串口{0}打开失败 シリアルポート {0} のオープンに失敗
shengbosensor 声波传感器 音響センサー
yalisensor 压力传感器 圧力センサー
shengboError 声波感应器误差过大,请检查后重新复位 音響センサーのエラーが大きすぎます
TheMachine/resources/zh-CN.lngres
查看文件 @
e004515
...
...
@@ -418,3 +418,4 @@ comDataError 串口{0}数据错误{1} 串口{0}数据错误{1}
comOpenFail 串口{0}打开失败 串口{0}打开失败
shengbosensor 声波传感器 声波传感器
yalisensor 压力传感器 压力传感器
shengboError 声波感应器误差过大,请检查后重新复位 声波感应器误差过大,请检查后重新复位
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论