Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
URSolderingRobot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 07b72b9c
由
几米阳光
编写于
2018-08-01 14:10:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
机器人调试修改
1 个父辈
55b8cbcc
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
67 行增加
和
84 行删除
Common/Common.csproj
Common/logs/LogUtil.cs
Common/util/TcpClient.cs
Common/util/URTcpClient.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/deviceLibrary/urRobot/URRobotClient.cs
DeviceLibrary/deviceLibrary/urRobot/URRobotControl.cs
DeviceLibrary/deviceLibrary/urRobot/URTcpClient.cs
Common/Common.csproj
查看文件 @
07b72b9
...
@@ -95,7 +95,6 @@
...
@@ -95,7 +95,6 @@
<Compile Include="util\AcSerialBean.cs" />
<Compile Include="util\AcSerialBean.cs" />
<Compile Include="util\SerialBean.cs" />
<Compile Include="util\SerialBean.cs" />
<Compile Include="util\StringUtil.cs" />
<Compile Include="util\StringUtil.cs" />
<Compile Include="util\URTcpClient.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\WaitUtil.cs" />
<Compile Include="util\WaitUtil.cs" />
...
...
Common/logs/LogUtil.cs
查看文件 @
07b72b9
...
@@ -188,7 +188,10 @@ namespace URSoldering.Common
...
@@ -188,7 +188,10 @@ namespace URSoldering.Common
{
{
urListenLog
.
Error
(
msg
);
urListenLog
.
Error
(
msg
);
}
}
public
static
void
URLDebug
(
string
msg
)
{
urListenLog
.
Debug
(
msg
);
}
/// <summary>
/// <summary>
...
...
Common/util/TcpClient.cs
查看文件 @
07b72b9
...
@@ -15,14 +15,12 @@ namespace URSoldering.Common
...
@@ -15,14 +15,12 @@ namespace URSoldering.Common
{
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
delegate
void
HandleMessage
(
string
message
);
public
delegate
void
HandleMessage
(
string
message
);
public
delegate
void
ByteHandleMessage
(
byte
[]
data
);
public
int
DefaultDataLength
=
1024
;
public
int
DefaultDataLength
=
1024
;
public
int
ReviceSleepMS
=
100
;
public
int
ReviceSleepMS
=
100
;
private
Socket
m_clientSocket
=
null
;
private
Socket
m_clientSocket
=
null
;
private
byte
[]
m_receiveBuffer
=
new
byte
[
1024
];
private
byte
[]
m_receiveBuffer
=
new
byte
[
1024
];
private
string
LogName
=
""
;
private
HandleMessage
onReceived
;
private
HandleMessage
onReceived
;
private
ByteHandleMessage
byteOnReceived
;
public
int
TimeOutTime
=
0
;
public
int
TimeOutTime
=
0
;
/// <summary>
/// <summary>
...
@@ -91,20 +89,14 @@ namespace URSoldering.Common
...
@@ -91,20 +89,14 @@ namespace URSoldering.Common
return
false
;
return
false
;
}
}
}
}
public
bool
connect
(
string
serverIP
,
int
serverPort
,
ByteHandleMessage
byteHandle
)
{
return
connect
(
serverIP
,
serverPort
,
null
,
byteHandle
);
}
/// <summary>
/// 连接服务器
/// </summary>
public
bool
connect
(
string
serverIP
,
int
serverPort
,
HandleMessage
HandleMessage
)
public
bool
connect
(
string
serverIP
,
int
serverPort
,
HandleMessage
HandleMessage
)
{
{
return
connect
(
serverIP
,
serverPort
,
HandleMessage
,
null
);
LogName
=
"【"
+
serverIP
+
" ,"
+
serverPort
+
"】"
;
}
/// <summary>
/// 连接服务器
/// </summary>
private
bool
connect
(
string
serverIP
,
int
serverPort
,
HandleMessage
HandleMessage
,
ByteHandleMessage
byteHandle
)
{
m_receiveBuffer
=
new
byte
[
DefaultDataLength
];
m_receiveBuffer
=
new
byte
[
DefaultDataLength
];
m_clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
m_clientSocket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
if
(
TimeOutTime
<=
0
)
if
(
TimeOutTime
<=
0
)
...
@@ -124,21 +116,18 @@ namespace URSoldering.Common
...
@@ -124,21 +116,18 @@ namespace URSoldering.Common
{
{
onReceived
=
HandleMessage
;
onReceived
=
HandleMessage
;
}
}
if
(
byteHandle
!=
null
)
{
LogUtil
.
info
(
LOGGER
,
LogName
+
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
byteOnReceived
=
byteHandle
;
}
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
return
true
;
return
true
;
}
}
else
else
{
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
LogUtil
.
info
(
LOGGER
,
LogName
+
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
+
ex
.
ToString
(),
3
);
LogUtil
.
error
(
LOGGER
,
LogName
+
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
+
ex
.
ToString
(),
3
);
//m_clientSocket = null;
//m_clientSocket = null;
}
}
}
}
...
@@ -150,26 +139,23 @@ namespace URSoldering.Common
...
@@ -150,26 +139,23 @@ namespace URSoldering.Common
connResult
.
AsyncWaitHandle
.
WaitOne
(
this
.
TimeOutTime
,
true
);
//等待2秒
connResult
.
AsyncWaitHandle
.
WaitOne
(
this
.
TimeOutTime
,
true
);
//等待2秒
if
(!
connResult
.
IsCompleted
||
(!
m_clientSocket
.
Connected
))
if
(!
connResult
.
IsCompleted
||
(!
m_clientSocket
.
Connected
))
{
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
LogUtil
.
info
(
LOGGER
,
LogName
+
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" fail!"
);
m_clientSocket
.
Close
();
m_clientSocket
.
Close
();
//处理连接不成功的动作
//处理连接不成功的动作
return
false
;
return
false
;
}
}
else
else
{
{
//处理连接成功的动作
//处理连接成功的动作
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
if
(
HandleMessage
!=
null
)
if
(
HandleMessage
!=
null
)
{
{
onReceived
=
HandleMessage
;
onReceived
=
HandleMessage
;
}
}
if
(
byteHandle
!=
null
)
{
LogUtil
.
info
(
LOGGER
,
LogName
+
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
byteOnReceived
=
byteHandle
;
}
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
serverIP
+
":"
+
serverPort
+
" success!"
);
return
true
;
return
true
;
}
}
}
}
...
@@ -183,20 +169,21 @@ namespace URSoldering.Common
...
@@ -183,20 +169,21 @@ namespace URSoldering.Common
{
{
try
try
{
{
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
{
{
m_clientSocket
.
Shutdown
(
SocketShutdown
.
Both
);
m_clientSocket
.
Shutdown
(
SocketShutdown
.
Both
);
m_clientSocket
.
Close
();
m_clientSocket
.
Close
();
LogUtil
.
info
(
LOGGER
,
"Socket closed!"
);
LogUtil
.
info
(
LOGGER
,
LogName
+
"Socket closed!"
);
}
}
else
else
{
{
LogUtil
.
error
(
LOGGER
,
"No socket is running!"
);
LogUtil
.
error
(
LOGGER
,
LogName
+
"No socket is running!"
);
}
}
m_clientSocket
=
null
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LOGGER
,
"close error :"
+
ex
.
ToString
());
LogUtil
.
error
(
LOGGER
,
LogName
+
"close error :"
+
ex
.
ToString
());
}
}
}
}
...
@@ -211,7 +198,7 @@ namespace URSoldering.Common
...
@@ -211,7 +198,7 @@ namespace URSoldering.Common
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
{
{
m_clientSocket
.
Send
(
sendBuffer
);
m_clientSocket
.
Send
(
sendBuffer
);
LogUtil
.
debug
(
LOGGER
,
"Send >> "
+
strSendData
);
LogUtil
.
debug
(
LOGGER
,
LogName
+
"Send >> "
+
strSendData
);
}
}
}
}
/// <summary>
/// <summary>
...
@@ -219,27 +206,20 @@ namespace URSoldering.Common
...
@@ -219,27 +206,20 @@ namespace URSoldering.Common
/// </summary>
/// </summary>
public
void
sendLine
(
string
strSendData
)
public
void
sendLine
(
string
strSendData
)
{
{
if
(
strSendData
.
StartsWith
(
"save"
))
{
LogUtil
.
debug
(
LOGGER
,
"发送数据:"
+
strSendData
);
}
else
{
LogUtil
.
debug
(
LOGGER
,
"发送数据:"
+
strSendData
);
}
strSendData
=
strSendData
+
"\r\n"
;
strSendData
=
strSendData
+
"\r\n"
;
byte
[]
sendBuffer
=
new
byte
[
DefaultDataLength
];
byte
[]
sendBuffer
=
new
byte
[
DefaultDataLength
];
sendBuffer
=
Encoding
.
UTF8
.
GetBytes
(
strSendData
);
sendBuffer
=
Encoding
.
UTF8
.
GetBytes
(
strSendData
);
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
{
{
m_clientSocket
.
Send
(
sendBuffer
);
m_clientSocket
.
Send
(
sendBuffer
);
LogUtil
.
debug
(
LOGGER
,
"Send >> "
+
strSendData
);
LogUtil
.
debug
(
LOGGER
,
LogName
+
"Send >> "
+
strSendData
);
}
}
}
}
private
void
ReceiveCallBack
(
IAsyncResult
ar
)
private
void
ReceiveCallBack
(
IAsyncResult
ar
)
{
{
try
try
...
@@ -247,17 +227,18 @@ namespace URSoldering.Common
...
@@ -247,17 +227,18 @@ namespace URSoldering.Common
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
{
{
int
REnd
=
m_clientSocket
.
EndReceive
(
ar
);
int
REnd
=
m_clientSocket
.
EndReceive
(
ar
);
byteOnReceived
?.
Invoke
(
m_receiveBuffer
);
string
strReceiveData
=
Encoding
.
Default
.
GetString
(
m_receiveBuffer
,
0
,
REnd
);
string
strReceiveData
=
Encoding
.
Default
.
GetString
(
m_receiveBuffer
,
0
,
REnd
);
onReceived
?.
Invoke
(
strReceiveData
);
onReceived
?.
Invoke
(
strReceiveData
);
Thread
.
Sleep
(
ReviceSleepMS
);
Thread
.
Sleep
(
ReviceSleepMS
);
//LOGGER.Debug("m_clientSocket:" + m_clientSocket + "\n m_receiveBuffer" + m_receiveBuffer);
if
(
m_clientSocket
!=
null
&&
m_clientSocket
.
Connected
)
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
{
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LOGGER
,
"socket received error:"
+
ex
.
ToString
(),
4
);
LogUtil
.
error
(
LOGGER
,
LogName
+
"socket received error:"
+
ex
.
ToString
(),
4
);
}
}
}
}
}
}
...
...
Common/util/URTcpClient.cs
查看文件 @
07b72b9
...
@@ -107,7 +107,7 @@ namespace URSoldering.Common
...
@@ -107,7 +107,7 @@ namespace URSoldering.Common
{
{
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
byteOnReceived
=
byteHandle
;
byteOnReceived
=
byteHandle
;
LogUtil
.
URL
Info
(
"Connect to "
+
LogName
+
" success"
);
LogUtil
.
URL
Debug
(
"Connect to "
+
LogName
+
" success"
);
return
true
;
return
true
;
}
}
else
else
...
@@ -161,7 +161,7 @@ namespace URSoldering.Common
...
@@ -161,7 +161,7 @@ namespace URSoldering.Common
{
{
m_clientSocket
.
Shutdown
(
SocketShutdown
.
Both
);
m_clientSocket
.
Shutdown
(
SocketShutdown
.
Both
);
m_clientSocket
.
Close
();
m_clientSocket
.
Close
();
LogUtil
.
URL
Info
(
LogName
+
"Socket closed!"
);
LogUtil
.
URL
Debug
(
LogName
+
"Socket closed!"
);
}
}
else
else
{
{
...
@@ -309,11 +309,11 @@ namespace URSoldering.Common
...
@@ -309,11 +309,11 @@ namespace URSoldering.Common
{
{
byteOnReceived
(
m_receiveBuffer
);
byteOnReceived
(
m_receiveBuffer
);
});
});
Thread
.
Sleep
(
ReviceSleepMS
);
//
Thread.Sleep(ReviceSleepMS);
//LOGGER.Debug("m_clientSocket:" + m_clientSocket + "\n m_receiveBuffer" + m_receiveBuffer);
//LOGGER.Debug("m_clientSocket:" + m_clientSocket + "\n m_receiveBuffer" + m_receiveBuffer);
//Task.Factory.StartNew(delegate ()
//Task.Factory.StartNew(delegate ()
//{
//{
m_clientSocket
.
BeginReceive
(
m_receiveBuffer
,
0
,
m_receiveBuffer
.
Length
,
0
,
new
AsyncCallback
(
ReceiveCallBack
),
null
);
//
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
//});
//});
}
}
}
}
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
07b72b9
...
@@ -98,6 +98,7 @@
...
@@ -98,6 +98,7 @@
<Compile Include="deviceLibrary\kangnaide\MasterTcpClient.cs" />
<Compile Include="deviceLibrary\kangnaide\MasterTcpClient.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotControl.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotControl.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotClient.cs" />
<Compile Include="deviceLibrary\urRobot\URRobotClient.cs" />
<Compile Include="deviceLibrary\urRobot\URTcpClient.cs" />
<Compile Include="Robot\MoveType.cs" />
<Compile Include="Robot\MoveType.cs" />
<Compile Include="Robot\soldering\AlarmType.cs" />
<Compile Include="Robot\soldering\AlarmType.cs" />
<Compile Include="bean\BoardManager.cs" />
<Compile Include="bean\BoardManager.cs" />
...
...
DeviceLibrary/deviceLibrary/urRobot/URRobotClient.cs
查看文件 @
07b72b9
...
@@ -70,20 +70,17 @@ namespace URSoldering.DeviceLibrary
...
@@ -70,20 +70,17 @@ namespace URSoldering.DeviceLibrary
if
(
LastMoveCMD
.
Equals
(
""
).
Equals
(
false
))
if
(
LastMoveCMD
.
Equals
(
""
).
Equals
(
false
))
{
{
listenClient
.
sendLine
(
LastMoveCMD
);
listenClient
.
sendLine
(
LastMoveCMD
);
LastMoveCMD
=
""
;
LastMoveCMD
=
""
;
//Thread.Sleep(50);
}
}
StopListen
();
StopListen
();
try
try
{
{
//string reviceMsg = ByteToStr(reviceData);
//LogUtil.info("Read data:【" + reviceMsg + "】 ");
byte
[]
msgSizeArray
=
reviceData
.
Skip
(
0
).
Take
(
4
).
ToArray
();
byte
[]
msgSizeArray
=
reviceData
.
Skip
(
0
).
Take
(
4
).
ToArray
();
byte
[]
timeArray
=
reviceData
.
Skip
(
4
).
Take
(
8
).
ToArray
();
//
byte[] timeArray = reviceData.Skip(4).Take(8).ToArray();
byte
[]
qTargetArray
=
reviceData
.
Skip
(
12
).
Take
(
48
).
ToArray
();
//
byte[] qTargetArray = reviceData.Skip(12).Take(48).ToArray();
byte
[]
qdTargetArray
=
reviceData
.
Skip
(
60
).
Take
(
48
).
ToArray
();
//
byte[] qdTargetArray = reviceData.Skip(60).Take(48).ToArray();
byte
[]
qddArray
=
reviceData
.
Skip
(
108
).
Take
(
48
).
ToArray
();
//
byte[] qddArray = reviceData.Skip(108).Take(48).ToArray();
byte
[]
iTargetArray
=
reviceData
.
Skip
(
156
).
Take
(
48
).
ToArray
();
//
byte[] iTargetArray = reviceData.Skip(156).Take(48).ToArray();
int
messageSize
=
BitToInt
(
reviceData
.
Skip
(
0
).
Take
(
4
).
ToArray
().
Reverse
<
byte
>().
ToArray
());
int
messageSize
=
BitToInt
(
reviceData
.
Skip
(
0
).
Take
(
4
).
ToArray
().
Reverse
<
byte
>().
ToArray
());
int
maxdouble
=
(
messageSize
-
4
)
/
8
;
int
maxdouble
=
(
messageSize
-
4
)
/
8
;
...
@@ -113,8 +110,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -113,8 +110,7 @@ namespace URSoldering.DeviceLibrary
}
}
}
}
if
(
doubleList
.
Count
>
61
)
if
(
doubleList
.
Count
>
61
)
{
{
string
spilt
=
","
;
double
x
=
doubleList
[
56
]
*
1000
;
double
x
=
doubleList
[
56
]
*
1000
;
double
y
=
doubleList
[
57
]
*
1000
;
double
y
=
doubleList
[
57
]
*
1000
;
double
z
=
doubleList
[
58
]
*
1000
;
double
z
=
doubleList
[
58
]
*
1000
;
...
@@ -122,16 +118,18 @@ namespace URSoldering.DeviceLibrary
...
@@ -122,16 +118,18 @@ namespace URSoldering.DeviceLibrary
double
ry
=
doubleList
[
60
]
*
1
;
double
ry
=
doubleList
[
60
]
*
1
;
double
rz
=
doubleList
[
61
]
*
1
;
double
rz
=
doubleList
[
61
]
*
1
;
URPointValue
newp
=
new
URPointValue
(
x
,
y
,
z
,
rx
,
ry
,
rz
);
URPointValue
newp
=
new
URPointValue
(
x
,
y
,
z
,
rx
,
ry
,
rz
);
//string reviceMsg = ByteToStr(reviceData);
if
(!
URRobotControl
.
IsSamePoint
(
newp
,
URRobotControl
.
LastPoint
))
{
LogUtil
.
URLInfo
(
LogName
+
"length["
+
messageSize
+
"],data长["
+
reviceData
.
Length
+
"]坐标"
+
newp
.
ToShowStr
());
}
URRobotControl
.
LastPoint
=
newp
;
URRobotControl
.
LastPoint
=
newp
;
string
reviceMsg
=
ByteToStr
(
reviceData
);
//LogUtil.info("Read data:【" + reviceMsg + "】 ");
LogUtil
.
URLInfo
(
LogName
+
"length["
+
messageSize
+
"],data长["
+
reviceData
.
Length
+
"]坐标"
+
newp
.
ToShowStr
());
}
}
}
}
else
else
{
{
string
reviceMsg
=
ByteToStr
(
reviceData
);
string
reviceMsg
=
ByteToStr
(
reviceData
);
//LogUtil.URLError(LogName + "Read data:【" + reviceMsg + "】 ");
LogUtil
.
URLError
(
LogName
+
"length["
+
messageSize
+
"],data长["
+
reviceData
.
Length
+
"]无法获取坐标,数据长度不正确"
);
LogUtil
.
URLError
(
LogName
+
"length["
+
messageSize
+
"],data长["
+
reviceData
.
Length
+
"]无法获取坐标,数据长度不正确"
);
}
}
}
}
...
...
DeviceLibrary/deviceLibrary/urRobot/URRobotControl.cs
查看文件 @
07b72b9
...
@@ -124,7 +124,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -124,7 +124,7 @@ namespace URSoldering.DeviceLibrary
{
{
reconnectTimer
=
new
System
.
Timers
.
Timer
();
reconnectTimer
=
new
System
.
Timers
.
Timer
();
reconnectTimer
.
AutoReset
=
true
;
reconnectTimer
.
AutoReset
=
true
;
reconnectTimer
.
Interval
=
10
00
;
reconnectTimer
.
Interval
=
4
00
;
reconnectTimer
.
Elapsed
+=
reconnectTimer_Elapsed
;
reconnectTimer
.
Elapsed
+=
reconnectTimer_Elapsed
;
reconnectTimer
.
Enabled
=
false
;
reconnectTimer
.
Enabled
=
false
;
}
}
...
@@ -199,7 +199,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -199,7 +199,7 @@ namespace URSoldering.DeviceLibrary
if
(
IsRun
&&
IsStartConnect
)
if
(
IsRun
&&
IsStartConnect
)
{
{
TimeSpan
span
=
DateTime
.
Now
-
preCheckTime
;
TimeSpan
span
=
DateTime
.
Now
-
preCheckTime
;
if
(
span
.
TotalSeconds
>
30
)
if
(
span
.
TotalSeconds
>
2
)
{
{
preCheckTime
=
DateTime
.
Now
;
preCheckTime
=
DateTime
.
Now
;
//判断500在连接上,则获取急停状态
//判断500在连接上,则获取急停状态
...
@@ -415,7 +415,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -415,7 +415,7 @@ namespace URSoldering.DeviceLibrary
{
{
IsRun
=
false
;
IsRun
=
false
;
startCount
--;
startCount
--;
controlTcp
.
sendLine
(
CMD_powerOff
);
//
controlTcp.sendLine(CMD_powerOff);
controlTcp
.
close
();
controlTcp
.
close
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -429,9 +429,10 @@ namespace URSoldering.DeviceLibrary
...
@@ -429,9 +429,10 @@ namespace URSoldering.DeviceLibrary
public
static
void
StopRobot
()
public
static
void
StopRobot
()
{
{
try
try
{
{
IsStartConnect
=
false
;
IsStartConnect
=
false
;
reconnectTimer
.
Enabled
=
false
;
reconnectTimer
.
Enabled
=
false
;
URRobotClient
.
StopListen
();
stopTcp
();
stopTcp
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -507,7 +508,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -507,7 +508,7 @@ namespace URSoldering.DeviceLibrary
}
}
}
return
false
;
}
return
false
;
}
}
p
rivate
static
bool
IsSamePoint
(
URPointValue
p1
,
URPointValue
p2
)
p
ublic
static
bool
IsSamePoint
(
URPointValue
p1
,
URPointValue
p2
)
{
{
if
(
p1
==
null
&&
p2
==
null
)
if
(
p1
==
null
&&
p2
==
null
)
{
{
...
@@ -519,7 +520,7 @@ namespace URSoldering.DeviceLibrary
...
@@ -519,7 +520,7 @@ namespace URSoldering.DeviceLibrary
double
rxCha
=
Math
.
Abs
(
p1
.
RX
-
p2
.
RX
);
double
rxCha
=
Math
.
Abs
(
p1
.
RX
-
p2
.
RX
);
double
ryCha
=
Math
.
Abs
(
p1
.
RY
-
p2
.
RY
);
double
ryCha
=
Math
.
Abs
(
p1
.
RY
-
p2
.
RY
);
double
rzCha
=
Math
.
Abs
(
p1
.
RZ
-
p2
.
RZ
);
double
rzCha
=
Math
.
Abs
(
p1
.
RZ
-
p2
.
RZ
);
if
(
xCha
<
1
&&
yCha
<
1
&&
zCha
<
1
&&
rxCha
<
0.0
1
&&
ryCha
<
0.01
&&
rzCha
<
0.01
)
if
(
xCha
<
1
&&
yCha
<
1
&&
zCha
<
1
&&
rxCha
<
0.0
2
&&
ryCha
<
0.02
&&
rzCha
<
0.02
)
{
{
return
true
;
return
true
;
}
}
...
...
DeviceLibrary/deviceLibrary/urRobot/URTcpClient.cs
0 → 100644
查看文件 @
07b72b9
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论