Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
URSolderingRobot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3f006b78
由
几米阳光
编写于
2018-10-12 16:52:45 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改:检测NG时红灯亮
1 个父辈
ecba5851
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
178 行增加
和
5 行删除
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/Robot/LineSolderingRobot.cs
DeviceLibrary/Robot/soldering/WeldRobotBean_Partial.cs
DeviceLibrary/bean/AOIDataResult.cs
DeviceLibrary/bean/RobotBean.cs
URSolderingClient/FrmWork.cs
URSolderingClient/记录.txt
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
3f006b7
...
@@ -85,6 +85,7 @@
...
@@ -85,6 +85,7 @@
</Reference>
</Reference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="bean\AOIDataResult.cs" />
<Compile Include="bean\BoardInfo.cs" />
<Compile Include="bean\BoardInfo.cs" />
<Compile Include="bean\RobotBean.cs" />
<Compile Include="bean\RobotBean.cs" />
<Compile Include="bean\RobotManager.cs" />
<Compile Include="bean\RobotManager.cs" />
...
...
DeviceLibrary/Robot/LineSolderingRobot.cs
查看文件 @
3f006b7
...
@@ -8,7 +8,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -8,7 +8,7 @@ namespace URSoldering.DeviceLibrary
{
{
public
partial
class
URSolderingRobot
:
RobotBean
public
partial
class
URSolderingRobot
:
RobotBean
{
{
private
AlarmType
alarmType
=
AlarmType
.
None
;
public
string
WareCode
=
""
;
public
string
WareCode
=
""
;
public
SolderingRobotConfig
Config
;
public
SolderingRobotConfig
Config
;
public
LineStepBean
LineStep
=
new
LineStepBean
();
public
LineStepBean
LineStep
=
new
LineStepBean
();
...
@@ -65,6 +65,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -65,6 +65,7 @@ namespace URSoldering.DeviceLibrary
KNDIOMove
(
IO_Type
.
AlarmSingle
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
AlarmSingle
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
WaitSingle
,
IO_VALUE
.
LOW
);
KNDIOMove
(
IO_Type
.
WaitSingle
,
IO_VALUE
.
LOW
);
Status
=
RobotStatus
.
Reset
;
Status
=
RobotStatus
.
Reset
;
WeldRobotBean
.
LastAOIResult
=
true
;
WeldRobotBean
.
IsInWeld
=
false
;
WeldRobotBean
.
IsInWeld
=
false
;
IsInProcess
=
false
;
IsInProcess
=
false
;
ledTimer
.
Enabled
=
true
;
ledTimer
.
Enabled
=
true
;
...
...
DeviceLibrary/Robot/soldering/WeldRobotBean_Partial.cs
查看文件 @
3f006b7
...
@@ -9,12 +9,15 @@ namespace URSoldering.DeviceLibrary
...
@@ -9,12 +9,15 @@ namespace URSoldering.DeviceLibrary
partial
class
WeldRobotBean
partial
class
WeldRobotBean
{
{
public
static
bool
IsInWeld
=
false
;
public
static
bool
IsInWeld
=
false
;
public
static
bool
LastAOIResult
=
true
;
//public delegate void GetCode();
//public delegate void GetCode();
//public static event GetCode GetCodeFun;
//public static event GetCode GetCodeFun;
public
delegate
void
AOICheck
(
);
public
delegate
bool
AOICheck
(
);
public
static
event
AOICheck
AOICheckFun
;
public
static
event
AOICheck
AOICheckFun
;
public
delegate
List
<
PositionResult
>
PositionOffset
();
public
static
event
PositionOffset
PositionOffsetFun
;
public
static
string
StartWeld
(
)
public
static
string
StartWeld
(
)
{
{
StopSleep
();
StopSleep
();
...
@@ -44,6 +47,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -44,6 +47,7 @@ namespace URSoldering.DeviceLibrary
{
{
return
"没有找到需要焊接的焊点,启动焊接失败!"
;
return
"没有找到需要焊接的焊点,启动焊接失败!"
;
}
}
LastAOIResult
=
true
;
IsInWeld
=
true
;
IsInWeld
=
true
;
return
""
;
return
""
;
}
}
...
@@ -169,7 +173,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -169,7 +173,7 @@ namespace URSoldering.DeviceLibrary
}
}
else
if
(
WeldMoveStep
.
moveStep
.
Equals
(
MoveStep
.
W14_AOICheck
))
else
if
(
WeldMoveStep
.
moveStep
.
Equals
(
MoveStep
.
W14_AOICheck
))
{
{
AOICheckFun
.
Invoke
();
LastAOIResult
=
AOICheckFun
.
Invoke
();
Thread
.
Sleep
(
300
);
Thread
.
Sleep
(
300
);
IsInWeld
=
false
;
IsInWeld
=
false
;
if
(
WeldCount
>=
RobotConfig
.
ClearCount
)
if
(
WeldCount
>=
RobotConfig
.
ClearCount
)
...
...
DeviceLibrary/bean/AOIDataResult.cs
0 → 100644
查看文件 @
3f006b7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
URSoldering.DeviceLibrary
{
public
class
PositionResult
{
public
PositionResult
(
double
x
,
double
y
,
int
type
,
WeldPointInfo
point
)
{
this
.
DataX
=
x
;
this
.
DataY
=
y
;
this
.
DataType
=
type
;
this
.
PointInfo
=
point
;
}
/// <summary>
/// 位置X
/// </summary>
public
double
DataX
=
0
;
/// <summary>
/// 位置Y
/// </summary>
public
double
DataY
=
0
;
/// <summary>
/// 数据类型,1=少锡,2=多锡
/// </summary>
public
int
DataType
=
0
;
/// <summary>
/// 拍照点、基准点坐标
/// </summary>
public
WeldPointInfo
PointInfo
=
null
;
}
}
DeviceLibrary/bean/RobotBean.cs
查看文件 @
3f006b7
...
@@ -7,6 +7,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -7,6 +7,7 @@ namespace URSoldering.DeviceLibrary
{
{
public
class
RobotBean
public
class
RobotBean
{
{
public
AlarmType
alarmType
=
AlarmType
.
None
;
/// <summary>
/// <summary>
/// 报警或者警告信息
/// 报警或者警告信息
/// </summary>
/// </summary>
...
@@ -94,6 +95,17 @@ namespace URSoldering.DeviceLibrary
...
@@ -94,6 +95,17 @@ namespace URSoldering.DeviceLibrary
KNDIOMove
(
IO_Type
.
AutoRunSingle
,
IO_VALUE
.
HIGH
);
KNDIOMove
(
IO_Type
.
AutoRunSingle
,
IO_VALUE
.
HIGH
);
}
}
}
}
if
(
Status
>
RobotStatus
.
Wait
&&
alarmType
.
Equals
(
AlarmType
.
None
))
{
if
(
WeldRobotBean
.
LastAOIResult
.
Equals
(
false
))
{
KNDIOMove
(
IO_Type
.
AlarmSingle
,
IO_VALUE
.
HIGH
);
}
else
{
KNDIOMove
(
IO_Type
.
AlarmSingle
,
IO_VALUE
.
LOW
);
}
}
}
}
protected
virtual
void
mainTimer_Elapsed
(
object
sender
,
ElapsedEventArgs
e
)
protected
virtual
void
mainTimer_Elapsed
(
object
sender
,
ElapsedEventArgs
e
)
...
...
URSolderingClient/FrmWork.cs
查看文件 @
3f006b7
...
@@ -38,6 +38,7 @@ namespace URSoldering.Client
...
@@ -38,6 +38,7 @@ namespace URSoldering.Client
Robot
=
RobotManager
.
SolderingRobot
;
Robot
=
RobotManager
.
SolderingRobot
;
WeldRobotBean
.
AOICheckFun
+=
AOICheck
;
WeldRobotBean
.
AOICheckFun
+=
AOICheck
;
WeldRobotBean
.
PositionOffsetFun
+=
RunPositionOffset
;
//Robot.GetCodeFun += GetCode;
//Robot.GetCodeFun += GetCode;
LogUtil
.
logBox
=
this
.
logBox
;
LogUtil
.
logBox
=
this
.
logBox
;
LogUtil
.
showCount
=
1
;
LogUtil
.
showCount
=
1
;
...
@@ -640,11 +641,15 @@ namespace URSoldering.Client
...
@@ -640,11 +641,15 @@ namespace URSoldering.Client
WeldRobotBean
.
StopWeld
();
WeldRobotBean
.
StopWeld
();
}
}
}
}
private
void
AOICheck
()
/// <summary>
/// true表示检测OK
/// </summary>
/// <returns></returns>
private
bool
AOICheck
()
{
{
try
try
{
{
this
.
label1
.
Text
=
"
视觉/光学
检测"
;
this
.
label1
.
Text
=
"
AOI
检测"
;
lblCodeResult
.
Visible
=
false
;
lblCodeResult
.
Visible
=
false
;
RunAOI
(
1
);
RunAOI
(
1
);
int
result
=
CKResult
(
"Result"
,
10
);
int
result
=
CKResult
(
"Result"
,
10
);
...
@@ -654,6 +659,7 @@ namespace URSoldering.Client
...
@@ -654,6 +659,7 @@ namespace URSoldering.Client
lblAOIResult
.
ForeColor
=
Color
.
Blue
;
lblAOIResult
.
ForeColor
=
Color
.
Blue
;
lblAOIResult
.
Text
=
"检测OK"
;
lblAOIResult
.
Text
=
"检测OK"
;
WorkCountManager
.
AddOKCount
();
WorkCountManager
.
AddOKCount
();
return
true
;
}
}
else
else
{
{
...
@@ -668,6 +674,7 @@ namespace URSoldering.Client
...
@@ -668,6 +674,7 @@ namespace URSoldering.Client
{
{
LogUtil
.
error
(
"AOI检测出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"AOI检测出错:"
+
ex
.
ToString
());
}
}
return
false
;
}
}
private
bool
RunAOI
(
int
num
)
private
bool
RunAOI
(
int
num
)
...
@@ -722,6 +729,111 @@ namespace URSoldering.Client
...
@@ -722,6 +729,111 @@ namespace URSoldering.Client
return
0
;
return
0
;
}
}
}
}
private
List
<
PositionResult
>
RunPositionOffset
(
)
{
List
<
PositionResult
>
pointList
=
new
List
<
PositionResult
>();
try
{
this
.
label1
.
Text
=
"视觉坐标偏移"
;
lblCodeResult
.
Visible
=
false
;
RunAOI
(
0
);
Thread
.
Sleep
(
100
);
string
shaoxi
=
"坐标偏移"
;
int
result1
=
CKResult
(
shaoxi
,
10
);
if
(!
result1
.
Equals
(
1
))
{
pointList
=
GetPhotoResult
(
shaoxi
,
100
);
}
string
resultList
=
""
;
if
(
pointList
.
Count
<=
0
)
{
lblAOIResult
.
Text
=
shaoxi
+
"未识别到焊点"
;
}
else
{
lblAOIResult
.
Text
=
shaoxi
+
"识别结果:"
;
foreach
(
PositionResult
result
in
pointList
)
{
lblAOIResult
.
Text
+=
" X:"
+
result
.
DataX
+
",Y:"
+
result
.
DataY
+
";"
;
}
}
resultList
=
lblAOIResult
.
Text
;
LogUtil
.
info
(
resultList
);
lblAOIResult
.
Visible
=
true
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"视觉坐标偏移出错:"
+
ex
.
ToString
());
}
return
pointList
;
}
private
List
<
PositionResult
>
GetPhotoResult
(
string
name
,
int
DataId
)
{
WeldPointInfo
point
=
null
;
if
(
WeldRobotBean
.
WeldMoveStep
.
CurrPoint
!=
null
)
{
point
=
WeldRobotBean
.
WeldMoveStep
.
CurrPoint
;
}
List
<
PositionResult
>
aOIDataResults
=
new
List
<
PositionResult
>();
string
result
=
""
;
try
{
int
idTool
=
axCKVisionCtrl1
.
GetTool
(
name
);
//NG的话需要获取数量,然后获取数据列表
int
num
=
0
;
string
value
=
""
;
object
objValue
=
new
VariantWrapper
(
value
);
if
(
axCKVisionCtrl1
.
GetValue
(
idTool
,
100
,
0
,
ref
objValue
)
==
true
)
{
result
=
objValue
.
ToString
();
num
=
Convert
.
ToInt32
(
result
);
}
LogUtil
.
info
(
"获取【"
+
name
+
"】的数量:"
+
num
);
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
double
x
=
0
,
y
=
0
;
if
(
name
.
Equals
(
"少锡"
))
{
objValue
=
new
VariantWrapper
(
value
);
if
(
axCKVisionCtrl1
.
GetValue
(
idTool
,
102
,
i
,
ref
objValue
)
==
true
)
{
result
=
objValue
.
ToString
();
x
=
Convert
.
ToDouble
(
result
);
}
objValue
=
new
VariantWrapper
(
value
);
if
(
axCKVisionCtrl1
.
GetValue
(
idTool
,
103
,
i
,
ref
objValue
)
==
true
)
{
result
=
objValue
.
ToString
();
y
=
Convert
.
ToDouble
(
result
);
}
aOIDataResults
.
Add
(
new
PositionResult
(
x
,
y
,
1
,
point
));
}
else
{
objValue
=
new
VariantWrapper
(
value
);
if
(
axCKVisionCtrl1
.
GetValue
(
idTool
,
103
,
i
,
ref
objValue
)
==
true
)
{
result
=
objValue
.
ToString
();
x
=
Convert
.
ToDouble
(
result
);
}
objValue
=
new
VariantWrapper
(
value
);
if
(
axCKVisionCtrl1
.
GetValue
(
idTool
,
104
,
i
,
ref
objValue
)
==
true
)
{
result
=
objValue
.
ToString
();
y
=
Convert
.
ToDouble
(
result
);
}
aOIDataResults
.
Add
(
new
PositionResult
(
x
,
y
,
2
,
point
));
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"获取【"
+
name
+
"】出错:"
+
ex
.
ToString
());
}
return
aOIDataResults
;
}
private
void
btnLook_Click
(
object
sender
,
EventArgs
e
)
private
void
btnLook_Click
(
object
sender
,
EventArgs
e
)
{
{
FrmWorkCount
frm
=
new
FrmWorkCount
();
FrmWorkCount
frm
=
new
FrmWorkCount
();
...
...
URSolderingClient/记录.txt
查看文件 @
3f006b7
...
@@ -24,3 +24,12 @@ UR机器人是否到位判断条件修改:只判断X.Y.Z坐标是否一致
...
@@ -24,3 +24,12 @@ UR机器人是否到位判断条件修改:只判断X.Y.Z坐标是否一致
拖焊点直接移动,普通焊点先移动至焊点高处,再下降焊接
拖焊点直接移动,普通焊点先移动至焊点高处,再下降焊接
20181012
最近修改内容:
抬起高度>0时,会先抬起再移动到焊点,抬起高度<=0时直接移动到焊点
配置ISDebug=1时,不检测夹具状态和急停状态
配置ISDebug=0时,才会检测夹具状态和急停状态
AOI检测NG时,红灯亮,等到下次开始焊接时清理红灯。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论