Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 065d6590
由
LN
编写于
2019-10-23 12:52:54 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加位置验证
1 个父辈
5f3160f1
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
51 行增加
和
32 行删除
ABBRobotTest/ABBRobotManager.cs
ABBRobotTest/ABBRobotServer.cs
ABBRobotTest/FrmRobotMain.Designer.cs
ABBRobotTest/FrmRobotMain.cs
doc/ABB机器人程序.txt
source/Common/util/TcpServer.cs
ABBRobotTest/ABBRobotManager.cs
查看文件 @
065d659
...
...
@@ -14,10 +14,11 @@ namespace ABBRobotTest
internal
class
ABBRobotManager
{
internal
static
string
DI_Start
=
"di_start"
;
internal
static
string
DI_Stop
=
"di_stop"
;
internal
static
string
DO_ES
=
"do_ES"
;
internal
static
string
DO_IsRun
=
"do_IsRun"
;
internal
static
string
DI_Start
=
"di_start"
;
//启动程序
internal
static
string
DI_Stop
=
"di_stop"
;
//停止程序
internal
static
string
DO_ES
=
"do_ES"
;
//急停状态
internal
static
string
DO_IsRun
=
"do_IsRun"
;
//机器人程序运行状态
internal
static
string
Do_AutoOn
=
"do_AutoOn"
;
//是否自动状态
private
static
NetworkScanner
scanner
=
null
;
// private Controller controller = null;
...
...
ABBRobotTest/ABBRobotServer.cs
查看文件 @
065d659
...
...
@@ -22,6 +22,7 @@ namespace ABBRobotTest
internal
static
string
Cmd_movep
=
"movep"
;
internal
static
string
Cmd_moveget
=
"moveget"
;
internal
static
string
Cmd_moveput
=
"moveput"
;
internal
static
string
Cmd_validateP
=
"validateP"
;
public
static
Dictionary
<
string
,
Client
>
ClientMap
=
new
Dictionary
<
string
,
Client
>();
...
...
@@ -29,7 +30,7 @@ namespace ABBRobotTest
public
static
string
LastSendPoint
=
""
;
public
delegate
void
OpEnd
(
string
result
);
private
static
event
OpEnd
On
Move
End
;
private
static
event
OpEnd
On
Cmd
End
;
private
static
object
LockObj
=
new
object
();
...
...
@@ -125,43 +126,50 @@ namespace ABBRobotTest
}
else
if
(
msg
.
Contains
(
Cmd_movep
)&&
msg
.
Contains
(
"OK"
))
{
On
Move
End
?.
Invoke
(
msg
);
On
Cmd
End
?.
Invoke
(
msg
);
}
else
if
(
msg
.
Contains
(
Cmd_moveput
)
&&
msg
.
Contains
(
"OK"
))
{
On
Move
End
?.
Invoke
(
msg
);
On
Cmd
End
?.
Invoke
(
msg
);
}
else
if
(
msg
.
Contains
(
Cmd_moveget
)
&&
msg
.
Contains
(
"ok"
))
{
On
Move
End
?.
Invoke
(
msg
);
On
Cmd
End
?.
Invoke
(
msg
);
}
return
false
;
}
public
static
void
MoveToP
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Move
=
null
)
public
static
void
MoveToP
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Cmd
=
null
)
{
ABBRobotServer
.
On
MoveEnd
=
AfterMove
;
ABBRobotServer
.
On
CmdEnd
=
AfterCmd
;
SendMovePoint
(
robotIp
,
Cmd_movep
,
PointName
,
moveType
,
targetSpeed
.
ToString
());
}
public
static
void
MoveToPut
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Move
=
null
)
public
static
void
MoveToPut
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Cmd
=
null
)
{
ABBRobotServer
.
On
MoveEnd
=
AfterMove
;
ABBRobotServer
.
On
CmdEnd
=
AfterCmd
;
SendMovePoint
(
robotIp
,
Cmd_moveput
,
PointName
,
moveType
,
targetSpeed
.
ToString
());
}
public
static
void
MoveToGet
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Move
=
null
)
public
static
void
MoveToGet
(
string
robotIp
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
After
Cmd
=
null
)
{
ABBRobotServer
.
On
MoveEnd
=
AfterMove
;
ABBRobotServer
.
On
CmdEnd
=
AfterCmd
;
SendMovePoint
(
robotIp
,
Cmd_moveget
,
PointName
,
moveType
,
targetSpeed
.
ToString
());
}
public
static
void
Move
(
string
robotIp
,
string
moveCmd
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
AfterMove
=
null
)
public
static
void
SendCmd
(
string
robotIp
,
string
moveCmd
,
string
PointName
,
string
moveType
=
"L"
,
double
targetSpeed
=
100
,
OpEnd
AfterCmd
=
null
)
{
ABBRobotServer
.
On
MoveEnd
=
AfterMove
;
if
(
moveCmd
.
Equals
(
Cmd_moveget
)
||
moveCmd
.
Equals
(
Cmd_movep
)
||
moveCmd
.
Equals
(
Cmd_moveput
))
ABBRobotServer
.
On
CmdEnd
=
AfterCmd
;
if
(
moveCmd
.
Equals
(
Cmd_moveget
)
||
moveCmd
.
Equals
(
Cmd_movep
)
||
moveCmd
.
Equals
(
Cmd_moveput
)
||
moveCmd
.
Equals
(
Cmd_validateP
)
)
{
SendMovePoint
(
robotIp
,
moveCmd
,
PointName
,
moveType
,
targetSpeed
.
ToString
());
}
}
private
static
void
SendMovePoint
(
string
robotIp
,
string
param1
,
string
param2
,
string
param3
,
string
param4
)
public
static
void
ValidateP
(
string
robotIp
,
string
pointName
,
OpEnd
AfterCmd
=
null
)
{
ABBRobotServer
.
OnCmdEnd
=
AfterCmd
;
SendMovePoint
(
robotIp
,
Cmd_validateP
,
pointName
);
}
private
static
void
SendMovePoint
(
string
robotIp
,
string
param1
,
string
param2
,
string
param3
=
"L"
,
string
param4
=
"10"
)
{
lock
(
LockObj
)
{
...
...
ABBRobotTest/FrmRobotMain.Designer.cs
查看文件 @
065d659
...
...
@@ -209,6 +209,7 @@
//
// comMoveP
//
this
.
comMoveP
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
comMoveP
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
comMoveP
.
FormattingEnabled
=
true
;
this
.
comMoveP
.
Location
=
new
System
.
Drawing
.
Point
(
136
,
130
);
...
...
@@ -227,6 +228,7 @@
//
// comMoveCmd
//
this
.
comMoveCmd
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
comMoveCmd
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
comMoveCmd
.
FormattingEnabled
=
true
;
this
.
comMoveCmd
.
Location
=
new
System
.
Drawing
.
Point
(
136
,
75
);
...
...
ABBRobotTest/FrmRobotMain.cs
查看文件 @
065d659
...
...
@@ -36,14 +36,15 @@ namespace ABBRobotTest
comMoveCmd
.
Items
.
Add
(
ABBRobotServer
.
Cmd_movep
);
comMoveCmd
.
Items
.
Add
(
ABBRobotServer
.
Cmd_moveget
);
comMoveCmd
.
Items
.
Add
(
ABBRobotServer
.
Cmd_moveput
);
comMoveCmd
.
Items
.
Add
(
ABBRobotServer
.
Cmd_validateP
);
comMoveP
.
Items
.
Clear
();
for
(
int
i
=
0
;
i
<
30
;
i
++)
for
(
int
i
=
1
;
i
<=
30
;
i
++)
{
comMoveP
.
Items
.
Add
(
"p"
+
i
);
}
comMoveP
.
SelectedIndex
=
0
;
comMoveCmd
.
SelectedIndex
=
1
;
comMoveCmd
.
SelectedIndex
=
0
;
radioButton1
.
Checked
=
true
;
...
...
@@ -76,13 +77,13 @@ namespace ABBRobotTest
private
void
LoadListView
()
{
this
.
listView1
.
Columns
.
Clear
();
AddHealder
(
"IPAddress"
,
1
0
0
);
AddHealder
(
"ID"
,
80
);
AddHealder
(
"IPAddress"
,
1
5
0
);
AddHealder
(
"ID"
,
1
80
);
// AddHealder("设备状态", 100);
AddHealder
(
"Availability"
,
1
0
0
);
AddHealder
(
"IsVirtual"
,
1
0
0
);
AddHealder
(
"SystemName"
,
1
0
0
);
AddHealder
(
"Version"
,
1
0
0
);
AddHealder
(
"Availability"
,
1
5
0
);
AddHealder
(
"IsVirtual"
,
1
5
0
);
AddHealder
(
"SystemName"
,
1
5
0
);
AddHealder
(
"Version"
,
1
5
0
);
AddHealder
(
"ControllerName"
,
180
);
AddHealder
(
"Statue"
,
180
);
}
...
...
@@ -118,8 +119,7 @@ namespace ABBRobotTest
int
esValue
=
ABBRobotManager
.
GetSingalState
(
SelConIp
);
if
(
esValue
.
Equals
(
1
))
{
lblState
.
Text
=
"机器人["
+
SelConIp
+
"]急停中"
;
lblState
.
ForeColor
=
Color
.
Red
;
SetMsg
(
"机器人["
+
SelConIp
+
"]急停中"
,
Color
.
Red
);
}
else
{
...
...
@@ -128,11 +128,19 @@ namespace ABBRobotTest
int
isRun
=
ABBRobotManager
.
GetSingalState
(
SelConIp
,
ABBRobotManager
.
DO_IsRun
);
if
(
isRun
.
Equals
(
1
))
{
lblState
.
Text
=
"机器人程序正常运行中"
;
lblState
.
ForeColor
=
Color
.
Green
;
SetMsg
(
"机器人程序正常运行中"
,
Color
.
Green
);
}
else
{
SetMsg
(
"机器人["
+
SelConIp
+
"]程序未运行"
,
Color
.
Red
);
}
}
}
private
void
SetMsg
(
string
msg
,
Color
foreColor
)
{
lblState
.
Text
=
msg
;
lblState
.
ForeColor
=
foreColor
;
}
private
void
btnStart_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -199,7 +207,7 @@ namespace ABBRobotTest
{
speed
=
100
;
}
ABBRobotServer
.
Move
(
SelConIp
,
moveCmd
,
PPoint
,
MType
,
speed
,
MoveEnd
);
ABBRobotServer
.
SendCmd
(
SelConIp
,
moveCmd
,
PPoint
,
MType
,
speed
,
MoveEnd
);
}
private
void
MoveEnd
(
string
msg
)
{
...
...
doc/ABB机器人程序.txt
查看文件 @
065d659
此文件的差异被折叠,
点击展开。
source/Common/util/TcpServer.cs
查看文件 @
065d659
...
...
@@ -121,7 +121,7 @@ namespace OnlineStore.Common
}
private
StringBuilder
sb
=
new
StringBuilder
();
//这个是用来保存:接收到了的,但是还没有结束的消息
private
int
receiveBufferSize
=
1024
;
private
string
terminateString
=
"
\r
"
;
private
string
terminateString
=
"
;
"
;
public
void
ReceiveMessages
(
Client
client
)
//这个函数会被以线程方式运行
{
try
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论