Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
URSolderingRobot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1b4ad800
由
几米阳光
编写于
2018-07-30 16:10:16 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
机器人调试
1 个父辈
7a9f2418
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
61 行增加
和
17 行删除
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/deviceLibrary/urRobot/URRobotClient.cs
DeviceLibrary/deviceLibrary/urRobot/URRobotControl.cs
URSolderingClient/FrmBoardInfo.Designer.cs
URSolderingClient/FrmBoardInfo.cs
URSolderingClient/FrmBoardInfo.resx
URSolderingClient/FrmIoManager.Designer.cs
URSolderingClient/FrmIoManager.cs
URSolderingClient/FrmOrgConfig.cs
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
1b4ad80
...
...
@@ -118,9 +118,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Content Include="RobotConfig\config\boardData.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="RobotConfig\config\defaultBoard.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
...
...
DeviceLibrary/deviceLibrary/urRobot/URRobotClient.cs
查看文件 @
1b4ad80
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System.Threading
;
using
URSoldering.Common
;
namespace
URSoldering.DeviceLibrary
...
...
@@ -70,6 +71,7 @@ namespace URSoldering.DeviceLibrary
{
listenClient
.
sendLine
(
LastMoveCMD
);
LastMoveCMD
=
""
;
//Thread.Sleep(50);
}
StopListen
();
try
...
...
@@ -129,10 +131,11 @@ namespace URSoldering.DeviceLibrary
else
{
string
reviceMsg
=
ByteToStr
(
reviceData
);
LogUtil
.
URLError
(
LogName
+
"Read data:【"
+
reviceMsg
+
"】 "
);
LogUtil
.
URLError
(
LogName
+
"无法获取坐标,数据长度不正确"
);
//
LogUtil.URLError(LogName + "Read data:【" + reviceMsg + "】 ");
LogUtil
.
URLError
(
LogName
+
"
length["
+
messageSize
+
"],data长["
+
reviceData
.
Length
+
"]
无法获取坐标,数据长度不正确"
);
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
URLError
(
LogName
+
"HandleMessage出错:"
+
ex
.
ToString
());
StopListen
();
...
...
DeviceLibrary/deviceLibrary/urRobot/URRobotControl.cs
查看文件 @
1b4ad80
...
...
@@ -67,10 +67,48 @@ namespace URSoldering.DeviceLibrary
{
get
{
return
"【"
+
RobotIp
+
" ,"
+
ControlPort
+
"】"
;
}
}
public
static
void
Test
()
public
static
string
GetStatus
()
{
if
(
WarnMsg
.
Equals
(
""
))
{
if
(
IsRun
)
{
return
"正常连接中"
;
}
else
{
if
(
IsStartConnect
)
{
TimeSpan
span
=
DateTime
.
Now
-
PreStartTime
;
if
(
span
.
TotalMilliseconds
>
StartTimeOutSeconds
)
{
return
"启动超时"
;
}
else
{
return
"启动中"
;
}
}
else
{
return
"未连接"
;
}
}
}
else
{
return
WarnMsg
;
}
}
public
static
void
Reset
()
{
URWithOutTP
a
=
new
URWithOutTP
();
//创建对象
a
.
restartURControl
(
RobotIp
);
//重置UR控制器,然后可以利用dashboard,poweron,brake release
LogUtil
.
info
(
LogName
+
"重置完成"
);
Thread
.
Sleep
(
100
);
}
/// <summary>
/// 开始启动连接机器人
...
...
@@ -121,6 +159,7 @@ namespace URSoldering.DeviceLibrary
PreStartTime
=
DateTime
.
Now
;
startCount
++;
//Reset();
controlTcp
=
new
TcpClient
();
bool
result
=
controlTcp
.
connect
(
RobotIp
,
ControlPort
,
new
TcpClient
.
HandleMessage
(
OnControlRevice
));
...
...
@@ -241,11 +280,11 @@ namespace URSoldering.DeviceLibrary
}
else
if
(
message
.
ToLower
().
IndexOf
(
REV_RobotMode
)
>=
0
)
{
S
afetymode
Process
(
message
);
S
tatus
Process
(
message
);
}
else
if
(
message
.
ToLower
().
IndexOf
(
REV_SafetyMode
)
>=
0
)
{
S
tatus
Process
(
message
);
S
afetymode
Process
(
message
);
}
else
{
...
...
@@ -257,7 +296,7 @@ namespace URSoldering.DeviceLibrary
LogUtil
.
URSError
(
LogName
+
" OnControlRevice出错啦"
+
ex
.
ToString
());
}
}
private
static
void
S
afetymode
Process
(
string
message
)
private
static
void
S
tatus
Process
(
string
message
)
{
string
msg
=
message
.
ToLower
().
Replace
(
REV_RobotMode
+
": "
,
""
).
ToUpper
().
Trim
();
...
...
@@ -282,7 +321,7 @@ namespace URSoldering.DeviceLibrary
}
}
}
private
static
void
S
tatus
Process
(
string
message
)
private
static
void
S
afetymode
Process
(
string
message
)
{
string
msg
=
message
.
ToLower
().
Replace
(
REV_SafetyMode
+
": "
,
""
).
ToUpper
().
Trim
();
if
(
msg
.
Equals
(
URStatus
.
SFETY_POWER_OFF
)
||
msg
.
Equals
(
URStatus
.
ROBOT_EMERGENCY_STOP
))
...
...
@@ -300,7 +339,7 @@ namespace URSoldering.DeviceLibrary
}
else
{
SendCMD
(
CMD_
Safetym
ode
,
500
);
SendCMD
(
CMD_
robotM
ode
,
500
);
}
}
private
static
bool
IsTimeOut
(
string
status
)
...
...
@@ -366,8 +405,14 @@ namespace URSoldering.DeviceLibrary
/// <param name="point"></param>
public
static
bool
MoveTo
(
URPointValue
point
)
{
//movep(p[0.062, -0.030, 0.325, 0.0299, 2.2263, 2.2171], a = 1.2, v = 0.25, r = 0)
LogUtil
.
info
(
LogName
+
"试图移动到:"
+
point
.
ToShowStr
());
//movej([0, 1.57, -1.57, 3.14, -1.57, 1.57],a = 1.4, v = 1.05, t = 0, r = 0)
string
moveCmd
=
"movej(["
+
point
.
X
+
spiltStr
+
point
.
X
+
spiltStr
+
point
.
X
+
spiltStr
+
point
.
X
+
spiltStr
+
point
.
X
+
spiltStr
+
point
.
X
+
"],a=1.4, v=1.05, t=0, r=0)"
;
string
x
=
Math
.
Round
(
point
.
X
/
1000F
,
5
).
ToString
();
string
y
=
Math
.
Round
(
point
.
Y
/
1000F
,
5
).
ToString
();
string
z
=
Math
.
Round
(
point
.
Z
/
1000F
,
5
).
ToString
();
string
moveCmd
=
"movep(p["
+
x
+
spiltStr
+
y
+
spiltStr
+
z
+
spiltStr
+
point
.
RX
+
spiltStr
+
point
.
RY
+
spiltStr
+
point
.
RZ
+
"],a=0.1, v=0.1, r=0)"
;
URRobotClient
.
LastMoveCMD
=
moveCmd
;
return
true
;
}
...
...
URSolderingClient/FrmBoardInfo.Designer.cs
查看文件 @
1b4ad80
此文件的差异被折叠,
点击展开。
URSolderingClient/FrmBoardInfo.cs
查看文件 @
1b4ad80
此文件的差异被折叠,
点击展开。
URSolderingClient/FrmBoardInfo.resx
查看文件 @
1b4ad80
此文件的差异被折叠,
点击展开。
URSolderingClient/FrmIoManager.Designer.cs
查看文件 @
1b4ad80
...
...
@@ -150,7 +150,6 @@ namespace URSoldering.Client
this
.
btnWireWork
.
TabIndex
=
269
;
this
.
btnWireWork
.
Text
=
"送丝工作端"
;
this
.
btnWireWork
.
UseVisualStyleBackColor
=
true
;
this
.
btnWireWork
.
Visible
=
false
;
this
.
btnWireWork
.
Click
+=
new
System
.
EventHandler
(
this
.
btnWireWork_Click
);
//
// btnWUp
...
...
@@ -173,7 +172,6 @@ namespace URSoldering.Client
this
.
btnWireClear
.
TabIndex
=
268
;
this
.
btnWireClear
.
Text
=
"送丝清洗端"
;
this
.
btnWireClear
.
UseVisualStyleBackColor
=
true
;
this
.
btnWireClear
.
Visible
=
false
;
this
.
btnWireClear
.
Click
+=
new
System
.
EventHandler
(
this
.
btnWireClear_Click
);
//
// btnWStop
...
...
URSolderingClient/FrmIoManager.cs
查看文件 @
1b4ad80
...
...
@@ -305,7 +305,7 @@ namespace URSoldering.Client
private
void
btnWireClear_Click
(
object
sender
,
EventArgs
e
)
{
SendWireCylinderMove
(
IO_VALUE
.
HIGH
,
IO_VALUE
.
LOW
);
SendWireCylinderMove
(
IO_VALUE
.
LOW
,
IO_VALUE
.
HIGH
);
}
}
}
URSolderingClient/FrmOrgConfig.cs
查看文件 @
1b4ad80
...
...
@@ -74,7 +74,8 @@ namespace URSoldering.Client
URPointValue
lastP
=
URRobotControl
.
GetLastPosition
();
urRobotSControl1
.
ShowPoint
(
lastP
);
}
lblMsg
.
Text
=
URRobotControl
.
WarnMsg
;
lblMsg
.
Text
=
URRobotControl
.
GetStatus
();
}
private
void
FrmBoardInfo_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论