Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
Line-Smart-Workstation
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 31d33c0b
由
LN
编写于
2021-04-29 16:00:54 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加通用IO端口值判断,调宽电机原点返回时如果已在原点,先相对走-1000.
1 个父辈
d18889ef
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
174 行增加
和
57 行删除
DeviceLibrary/manager/TSAVBean.cs
PUSICANLibrary/CAN_Address.cs
PUSICANLibrary/PUSICANControl.cs
TSA-V/Program.cs
TSA-V/deviceDebug/FrmPusicanTest.Designer.cs
TSA-V/deviceDebug/FrmPusicanTest.cs
TSA-V/workForm/FrmTSAV.cs
TSA-V/记录.txt
DeviceLibrary/manager/TSAVBean.cs
查看文件 @
31d33c0
...
@@ -136,7 +136,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -136,7 +136,7 @@ namespace TSA_V.DeviceLibrary
{
{
LogUtil
.
info
(
Name
+
"连接Can协议成功"
);
LogUtil
.
info
(
Name
+
"连接Can协议成功"
);
}
}
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
resetStep
=
ResetStep
.
OpenCan_0
;
resetStep
=
ResetStep
.
OpenCan_0
;
LastResetChangeTime
=
DateTime
.
Now
;
LastResetChangeTime
=
DateTime
.
Now
;
}
}
...
@@ -159,7 +159,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -159,7 +159,7 @@ namespace TSA_V.DeviceLibrary
{
{
LogUtil
.
info
(
Name
+
"重置中:重置之前先停止所有运动"
);
LogUtil
.
info
(
Name
+
"重置中:重置之前先停止所有运动"
);
StopMove
();
StopMove
();
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
}
}
...
@@ -174,7 +174,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -174,7 +174,7 @@ namespace TSA_V.DeviceLibrary
resetStep
=
ResetStep
.
AddNode_1
;
resetStep
=
ResetStep
.
AddNode_1
;
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
{
{
foreach
(
NodeInfo
nodeid
in
map
.
Values
)
foreach
(
NodeInfo
nodeid
in
map
.
Values
)
...
@@ -290,7 +290,7 @@ namespace TSA_V.DeviceLibrary
...
@@ -290,7 +290,7 @@ namespace TSA_V.DeviceLibrary
if
(
isAllOk
.
Equals
(
true
))
if
(
isAllOk
.
Equals
(
true
))
{
{
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
//初始化所有旋转轴
//初始化所有旋转轴
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
{
{
...
@@ -349,10 +349,14 @@ namespace TSA_V.DeviceLibrary
...
@@ -349,10 +349,14 @@ namespace TSA_V.DeviceLibrary
public
static
void
StopWork
()
public
static
void
StopWork
()
{
{
StopMove
();
if
(
Status
.
Equals
(
TSAVStatus
.
Reset
))
if
(
Status
.
Equals
(
TSAVStatus
.
Reset
))
{
{
Status
=
TSAVStatus
.
Wait
;
//Status = TSAVStatus.Wait;
}
else
{
StopMove
();
}
}
}
}
private
static
bool
IsProcess
=
false
;
private
static
bool
IsProcess
=
false
;
...
@@ -508,13 +512,13 @@ namespace TSA_V.DeviceLibrary
...
@@ -508,13 +512,13 @@ namespace TSA_V.DeviceLibrary
if
(
PUSICANControl
.
IsDuZhuan
(
node
.
NodeId
))
if
(
PUSICANControl
.
IsDuZhuan
(
node
.
NodeId
))
{
{
LogUtil
.
error
(
Name
+
" 发现旋转轴["
+
node
.
NodeId
+
"]堵转,清除一下控制器状态,重新读取一下堵转状态"
);
LogUtil
.
error
(
Name
+
" 发现旋转轴["
+
node
.
NodeId
+
"]堵转,清除一下控制器状态,重新读取一下堵转状态"
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
//清除一下状态,在重新读一次
//清除一下状态,在重新读一次
if
(!
TSAVBean
.
Status
.
Equals
(
TSAVStatus
.
Reset
))
if
(!
TSAVBean
.
Status
.
Equals
(
TSAVStatus
.
Reset
))
{
{
PUSICANControl
.
ClearStatus
(
node
.
NodeId
);
PUSICANControl
.
ClearStatus
(
node
.
NodeId
);
}
}
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
if
(
PUSICANControl
.
IsDuZhuan
(
node
.
NodeId
))
if
(
PUSICANControl
.
IsDuZhuan
(
node
.
NodeId
))
{
{
WarnMsg
=
GetTime
()
+
ResourceControl
.
GetString
(
ResourceControl
.
DuZhuanMsg
,
" 旋转轴[{0}]堵转,需要重置"
,
node
.
NodeId
);
WarnMsg
=
GetTime
()
+
ResourceControl
.
GetString
(
ResourceControl
.
DuZhuanMsg
,
" 旋转轴[{0}]堵转,需要重置"
,
node
.
NodeId
);
...
@@ -572,15 +576,18 @@ namespace TSA_V.DeviceLibrary
...
@@ -572,15 +576,18 @@ namespace TSA_V.DeviceLibrary
IOManager
.
IOMove
(
IOManager
.
Line_FStart
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IOManager
.
Line_FStart
,
IO_VALUE
.
LOW
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
PUSICANControl
.
SleepMS
);
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
foreach
(
Dictionary
<
int
,
NodeInfo
>
map
in
RotateMap
.
Values
)
{
{
foreach
(
NodeInfo
nodeid
in
map
.
Values
)
foreach
(
NodeInfo
nodeid
in
map
.
Values
)
{
{
if
(
PUSICANControl
.
IsBusy
(
nodeid
.
NodeId
))
{
PUSICANControl
.
StopMove
(
nodeid
.
NodeId
);
PUSICANControl
.
StopMove
(
nodeid
.
NodeId
);
}
}
}
}
}
}
}
private
static
void
CheckWorkWait
()
private
static
void
CheckWorkWait
()
{
{
try
try
...
...
PUSICANLibrary/CAN_Address.cs
查看文件 @
31d33c0
...
@@ -47,6 +47,7 @@ namespace PUSICANLibrary
...
@@ -47,6 +47,7 @@ namespace PUSICANLibrary
// sdoMap.Add(MoveDirection, new SDOAddrInfo(MoveDirection, DATA_TYPE.DT_UINT32, 0));
// sdoMap.Add(MoveDirection, new SDOAddrInfo(MoveDirection, DATA_TYPE.DT_UINT32, 0));
sdoMap
.
Add
(
CurrPosition
,
new
SDOAddrInfo
(
CurrPosition
,
DATA_TYPE
.
DT_UINT32
,
0
));
sdoMap
.
Add
(
CurrPosition
,
new
SDOAddrInfo
(
CurrPosition
,
DATA_TYPE
.
DT_UINT32
,
0
));
sdoMap
.
Add
(
OutStop
,
new
SDOAddrInfo
(
OutStopSingle
,
DATA_TYPE
.
DT_UINT8
,
0
));
sdoMap
.
Add
(
OutStop
,
new
SDOAddrInfo
(
OutStopSingle
,
DATA_TYPE
.
DT_UINT8
,
0
));
sdoMap
.
Add
(
GPIO_Value
,
new
SDOAddrInfo
(
GPIO_Value
,
DATA_TYPE
.
DT_INT16
,
0
));
}
}
return
sdoMap
;
return
sdoMap
;
}
}
...
@@ -163,6 +164,10 @@ namespace PUSICANLibrary
...
@@ -163,6 +164,10 @@ namespace PUSICANLibrary
/// 外部停止,0x600f ,2h 外部紧急停止触发
/// 外部停止,0x600f ,2h 外部紧急停止触发
/// </summary>
/// </summary>
public
static
uint
OutStop_Type
=
0x600F2
;
public
static
uint
OutStop_Type
=
0x600F2
;
/// <summary>
/// 通用IO端口值,0x6012 ,U16 0高电平,1低电平
/// </summary>
public
static
uint
GPIO_Value
=
0x6012
;
}
}
...
...
PUSICANLibrary/PUSICANControl.cs
查看文件 @
31d33c0
...
@@ -150,7 +150,7 @@ namespace PUSICANLibrary
...
@@ -150,7 +150,7 @@ namespace PUSICANLibrary
#
endregion
#
endregion
public
static
int
SleepMS
=
30
;
public
delegate
void
SetTcpClient_drvier
(
string
ip
,
int
nPort
);
public
delegate
void
SetTcpClient_drvier
(
string
ip
,
int
nPort
);
public
delegate
void
SetSerial_drvier
(
int
nPort
,
int
nBaud
);
public
delegate
void
SetSerial_drvier
(
int
nPort
,
int
nBaud
);
public
static
bool
ISOpen
=
false
;
public
static
bool
ISOpen
=
false
;
...
@@ -355,7 +355,7 @@ namespace PUSICANLibrary
...
@@ -355,7 +355,7 @@ namespace PUSICANLibrary
//相对运动
//相对运动
data
=
BitConverter
.
GetBytes
(
value
);
data
=
BitConverter
.
GetBytes
(
value
);
result
=
PUSICANControl
.
PUSICO_WriteSDO
(
nodeid
,
addr
.
sdoAddr
,
0x01
,
data
,
addr
.
dataType
,
addr
.
dataLength
,
addr
.
timeOut
);
result
=
PUSICANControl
.
PUSICO_WriteSDO
(
nodeid
,
addr
.
sdoAddr
,
0x01
,
data
,
addr
.
dataType
,
addr
.
dataLength
,
addr
.
timeOut
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
if
(
PUSIResult
.
RET_SUCCESS
==
result
)
if
(
PUSIResult
.
RET_SUCCESS
==
result
)
{
{
Console
.
WriteLine
(
"write "
+
nodeid
+
" CAN_Address.OutStop sdo ok."
);
Console
.
WriteLine
(
"write "
+
nodeid
+
" CAN_Address.OutStop sdo ok."
);
...
@@ -369,7 +369,7 @@ namespace PUSICANLibrary
...
@@ -369,7 +369,7 @@ namespace PUSICANLibrary
//相对运动
//相对运动
data
=
BitConverter
.
GetBytes
(
value
);
data
=
BitConverter
.
GetBytes
(
value
);
result
=
PUSICANControl
.
PUSICO_WriteSDO
(
nodeid
,
addr
.
sdoAddr
,
0x02
,
data
,
addr
.
dataType
,
addr
.
dataLength
,
addr
.
timeOut
);
result
=
PUSICANControl
.
PUSICO_WriteSDO
(
nodeid
,
addr
.
sdoAddr
,
0x02
,
data
,
addr
.
dataType
,
addr
.
dataLength
,
addr
.
timeOut
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
if
(
PUSIResult
.
RET_SUCCESS
==
result
)
if
(
PUSIResult
.
RET_SUCCESS
==
result
)
{
{
Console
.
WriteLine
(
"write "
+
nodeid
+
" CAN_Address.OutStop sdo ok."
);
Console
.
WriteLine
(
"write "
+
nodeid
+
" CAN_Address.OutStop sdo ok."
);
...
@@ -571,10 +571,10 @@ namespace PUSICANLibrary
...
@@ -571,10 +571,10 @@ namespace PUSICANLibrary
}
}
public
static
bool
AbsMove
(
uint
nodeid
,
int
position
)
public
static
bool
AbsMove
(
uint
nodeid
,
int
position
)
{
{
if
(
PUSICANControl
.
CheckStop2Is
High
(
nodeid
))
if
(
PUSICANControl
.
IsStop2
High
(
nodeid
))
{
{
PUSICANControl
.
ClearStatus
(
nodeid
);
PUSICANControl
.
ClearStatus
(
nodeid
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
}
}
//写模式
//写模式
...
@@ -592,10 +592,10 @@ namespace PUSICANLibrary
...
@@ -592,10 +592,10 @@ namespace PUSICANLibrary
/// </summary>
/// </summary>
public
static
bool
RelMove
(
uint
nodeId
,
int
position
)
public
static
bool
RelMove
(
uint
nodeId
,
int
position
)
{
{
if
(
PUSICANControl
.
CheckStop2Is
High
(
nodeId
))
if
(
PUSICANControl
.
IsStop2
High
(
nodeId
))
{
{
PUSICANControl
.
ClearStatus
(
nodeId
);
PUSICANControl
.
ClearStatus
(
nodeId
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
}
}
//写模式
//写模式
PUSIResult
result
;
PUSIResult
result
;
...
@@ -628,36 +628,69 @@ namespace PUSICANLibrary
...
@@ -628,36 +628,69 @@ namespace PUSICANLibrary
result
=
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
RelativeMove
,
(
speed
));
result
=
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
RelativeMove
,
(
speed
));
return
CheckWriteResult
(
result
,
" node ["
+
nodeid
+
"] CAN_Address.RelativeMove"
);
return
CheckWriteResult
(
result
,
" node ["
+
nodeid
+
"] CAN_Address.RelativeMove"
);
}
}
///// <summary>
///// 原点返回
///// </summary>
//public static bool HomeMove(uint nodeid, int speed)
//{
// //写模式
// PUSIResult result;
// PUSICANControl.WriteSDO(nodeid, CAN_Address.MoveType, 1);
// if (speed < 0)
// {
// PUSICANControl.WriteSDO(nodeid, CAN_Address.MoveDirection, 1);
// }
// else
// {
// PUSICANControl.WriteSDO(nodeid, CAN_Address.MoveDirection, 0);
// }
// SetMaxSpeed(nodeid, speed);
// result = PUSICANControl.WriteSDO(nodeid, CAN_Address.RelativeMove, Math.Abs(speed));
// return CheckWriteResult(result, " node [" + nodeid + "] CAN_Address.RelativeMove");
//}
/// <summary>
/// <summary>
/// 原点返回
/// 原点返回
,旋转轴原点返回使用的方法
/// </summary>
/// </summary>
public
static
bool
HomeMove
(
uint
nodeid
,
int
speed
)
public
static
bool
HomeMove
(
uint
nodeid
,
bool
isLineSlv
=
false
,
int
speed
=
0
)
{
{
//写模式
//如果是调宽电机回原点,已经回过原点,需要反向走2000
PUSIResult
result
;
if
(
isLineSlv
&&
IsEXT2High
(
nodeid
))
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
MoveType
,
1
);
if
(
speed
<
0
)
{
{
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
MoveDirection
,
1
);
LogUtil
.
info
(
"HomeMove["
+
nodeid
+
"],EXT2IsHigh,先相对走-1000"
);
RelMove
(
nodeid
,
-
1000
);
//相对走1000超时时间10秒
int
count
=
0
;
while
(
true
)
{
Thread
.
Sleep
(
200
);
count
++;
if
(
IsBusy
(
nodeid
))
{
if
(
count
>=
25
)
{
LogUtil
.
info
(
"HomeMove["
+
nodeid
+
"],EXT2IsHigh,先相对走-1000,超时5秒结算"
);
StopMove
(
nodeid
);
break
;
}
}
}
else
else
{
{
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
MoveDirection
,
0
);
LogUtil
.
info
(
"HomeMove["
+
nodeid
+
"],EXT2IsHigh,先相对走-1000,相对走-1000结束"
);
break
;
}
}
SetMaxSpeed
(
nodeid
,
speed
);
result
=
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
RelativeMove
,
Math
.
Abs
(
speed
));
return
CheckWriteResult
(
result
,
" node ["
+
nodeid
+
"] CAN_Address.RelativeMove"
);
}
}
/// <summary>
Thread
.
Sleep
(
SleepMS
);
/// 原点返回 ,旋转轴原点返回使用的方法
}
/// </summary>
if
(
speed
.
Equals
(
0
))
public
static
bool
HomeMove
(
uint
nodeid
,
bool
isLineSlv
=
false
)
{
{
int
speed
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
RotateNode_HomeSpeed
,
nodeid
.
ToString
());
speed
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
RotateNode_HomeSpeed
,
nodeid
.
ToString
());
if
(
isLineSlv
)
if
(
isLineSlv
)
{
{
speed
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Line_HomeSpeed
,
nodeid
.
ToString
());
speed
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Line_HomeSpeed
,
nodeid
.
ToString
());
}
}
}
//写模式
//写模式
PUSIResult
result
;
PUSIResult
result
;
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
MoveType
,
1
);
PUSICANControl
.
WriteSDO
(
nodeid
,
CAN_Address
.
MoveType
,
1
);
...
@@ -679,7 +712,7 @@ namespace PUSICANLibrary
...
@@ -679,7 +712,7 @@ namespace PUSICANLibrary
/// </summary>
/// </summary>
/// <param name="nodeId"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
/// <returns></returns>
public
static
bool
CheckStop2Is
High
(
uint
nodeId
)
public
static
bool
IsStop2
High
(
uint
nodeId
)
{
{
//判断 外部停止2=1
//判断 外部停止2=1
int
value
=
0
;
int
value
=
0
;
...
@@ -697,6 +730,25 @@ namespace PUSICANLibrary
...
@@ -697,6 +730,25 @@ namespace PUSICANLibrary
}
}
}
return
false
;
}
return
false
;
}
}
public
static
bool
IsBusy
(
uint
nodeId
)
{
//判断 外部停止2=1
int
value
=
0
;
//获取状态
if
(
PUSIResult
.
RET_SUCCESS
==
PUSICANControl
.
ReadSDO
(
nodeId
,
CAN_Address
.
ControlStatus
,
out
value
))
{
string
stop2Str
=
Convert
.
ToString
(
value
,
2
).
PadLeft
(
5
,
'0'
).
Substring
(
1
,
1
);
if
(
stop2Str
.
Equals
(
"1"
))
{
return
true
;
}
else
{
return
false
;
}
}
return
false
;
}
public
static
void
ClearStatus
(
uint
nodeId
)
public
static
void
ClearStatus
(
uint
nodeId
)
{
{
//清理驱动器状态
//清理驱动器状态
...
@@ -707,7 +759,7 @@ namespace PUSICANLibrary
...
@@ -707,7 +759,7 @@ namespace PUSICANLibrary
//清理驱动器状态
//清理驱动器状态
PUSIResult
result
=
PUSICANControl
.
WriteSDO
(
nodeId
,
CAN_Address
.
ControlStatus
,
1
);
PUSIResult
result
=
PUSICANControl
.
WriteSDO
(
nodeId
,
CAN_Address
.
ControlStatus
,
1
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
//重置位置
//重置位置
SetPosition
(
nodeId
,
0
);
SetPosition
(
nodeId
,
0
);
...
@@ -838,7 +890,7 @@ namespace PUSICANLibrary
...
@@ -838,7 +890,7 @@ namespace PUSICANLibrary
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
//设置为位置模式
//设置为位置模式
PUSICANControl
.
WriteSDO
(
node
,
CAN_Address
.
MoveType
,
movetype
);
PUSICANControl
.
WriteSDO
(
node
,
CAN_Address
.
MoveType
,
movetype
);
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
SleepMS
);
PUSICANControl
.
SetSpeed
(
node
,
isLineSlv
);
PUSICANControl
.
SetSpeed
(
node
,
isLineSlv
);
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
//所有轴走到待机点
//所有轴走到待机点
...
@@ -965,6 +1017,38 @@ namespace PUSICANLibrary
...
@@ -965,6 +1017,38 @@ namespace PUSICANLibrary
return
list
;
return
list
;
}
}
public
static
bool
IsEXT2High
(
uint
nodeId
)
{
//判断 外部停止2=1
int
value
=
0
;
//获取状态
if
(
PUSIResult
.
RET_SUCCESS
==
PUSICANControl
.
ReadSDO
(
nodeId
,
CAN_Address
.
GPIO_Value
,
out
value
))
{
string
ext2
=
Convert
.
ToString
(
value
,
2
).
PadLeft
(
12
,
'0'
).
Substring
(
4
,
1
);
if
(
ext2
.
Equals
(
"0"
))
{
return
true
;
}
else
{
return
false
;
}
}
return
false
;
}
public
static
string
GetGPIO
(
uint
nodeId
)
{
//判断 外部停止2=1
int
value
=
0
;
//获取状态
if
(
PUSIResult
.
RET_SUCCESS
==
PUSICANControl
.
ReadSDO
(
nodeId
,
CAN_Address
.
GPIO_Value
,
out
value
))
{
string
ext2
=
Convert
.
ToString
(
value
,
2
).
PadLeft
(
12
,
'0'
).
ToString
();
string
ext2v
=
Convert
.
ToString
(
value
,
2
).
PadLeft
(
12
,
'0'
).
Substring
(
4
,
1
);
return
" [P8,ETC2,ETC1,EXT2,EXT1,P7,P6,P5,P4,P3,P2,P1]=["
+
ext2
+
"],EXT2="
+
ext2v
;
}
return
""
;
}
}
}
}
}
TSA-V/Program.cs
查看文件 @
31d33c0
...
@@ -53,7 +53,7 @@ namespace TSA_V
...
@@ -53,7 +53,7 @@ namespace TSA_V
//DatumPoint datumPoint = new DatumPoint("YR1", "1", 2, 61.309f, 133.04f, "CRD", 0, 0);
//DatumPoint datumPoint = new DatumPoint("YR1", "1", 2, 61.309f, 133.04f, "CRD", 0, 0);
//LearningControl.TrainModel();
//LearningControl.TrainModel();
//datumPoint = LearningControl.TestData(datumPoint);
//datumPoint = LearningControl.TestData(datumPoint);
string
ext2v
=
"111101111111"
.
Substring
(
4
,
1
);
try
try
{
{
...
...
TSA-V/deviceDebug/FrmPusicanTest.Designer.cs
查看文件 @
31d33c0
...
@@ -98,18 +98,21 @@
...
@@ -98,18 +98,21 @@
//
//
// lblControlStatus
// lblControlStatus
//
//
this
.
lblControlStatus
.
AutoSize
=
true
;
this
.
lblControlStatus
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
lblControlStatus
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblControlStatus
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblControlStatus
.
ForeColor
=
System
.
Drawing
.
Color
.
Red
;
this
.
lblControlStatus
.
ForeColor
=
System
.
Drawing
.
Color
.
Red
;
this
.
lblControlStatus
.
Location
=
new
System
.
Drawing
.
Point
(
33
,
48
0
);
this
.
lblControlStatus
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
17
0
);
this
.
lblControlStatus
.
Name
=
"lblControlStatus"
;
this
.
lblControlStatus
.
Name
=
"lblControlStatus"
;
this
.
lblControlStatus
.
Size
=
new
System
.
Drawing
.
Size
(
0
,
20
);
this
.
lblControlStatus
.
Size
=
new
System
.
Drawing
.
Size
(
703
,
52
);
this
.
lblControlStatus
.
TabIndex
=
52
;
this
.
lblControlStatus
.
TabIndex
=
52
;
this
.
lblControlStatus
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
this
.
lblControlStatus
.
Click
+=
new
System
.
EventHandler
(
this
.
lblControlStatus_Click
);
//
//
// btnBack
// btnBack
//
//
this
.
btnBack
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnBack
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnBack
.
Location
=
new
System
.
Drawing
.
Point
(
564
,
5
26
);
this
.
btnBack
.
Location
=
new
System
.
Drawing
.
Point
(
564
,
5
79
);
this
.
btnBack
.
Name
=
"btnBack"
;
this
.
btnBack
.
Name
=
"btnBack"
;
this
.
btnBack
.
Size
=
new
System
.
Drawing
.
Size
(
136
,
45
);
this
.
btnBack
.
Size
=
new
System
.
Drawing
.
Size
(
136
,
45
);
this
.
btnBack
.
TabIndex
=
6
;
this
.
btnBack
.
TabIndex
=
6
;
...
@@ -138,7 +141,7 @@
...
@@ -138,7 +141,7 @@
this
.
groupBox2
.
Controls
.
Add
(
this
.
label18
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
label18
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
nudDelSpeed
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
nudDelSpeed
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnReadAll
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnReadAll
);
this
.
groupBox2
.
Location
=
new
System
.
Drawing
.
Point
(
14
,
15
4
);
this
.
groupBox2
.
Location
=
new
System
.
Drawing
.
Point
(
14
,
15
5
);
this
.
groupBox2
.
Name
=
"groupBox2"
;
this
.
groupBox2
.
Name
=
"groupBox2"
;
this
.
groupBox2
.
Size
=
new
System
.
Drawing
.
Size
(
716
,
171
);
this
.
groupBox2
.
Size
=
new
System
.
Drawing
.
Size
(
716
,
171
);
this
.
groupBox2
.
TabIndex
=
35
;
this
.
groupBox2
.
TabIndex
=
35
;
...
@@ -506,6 +509,7 @@
...
@@ -506,6 +509,7 @@
//
//
// groupBox5
// groupBox5
//
//
this
.
groupBox5
.
Controls
.
Add
(
this
.
lblControlStatus
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
txtHomeMoveSpeed
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
txtHomeMoveSpeed
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
label2
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
label2
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnHomeMove
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnHomeMove
);
...
@@ -517,9 +521,9 @@
...
@@ -517,9 +521,9 @@
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnGetStatus
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnGetStatus
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnClearStatus
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
btnClearStatus
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
label20
);
this
.
groupBox5
.
Controls
.
Add
(
this
.
label20
);
this
.
groupBox5
.
Location
=
new
System
.
Drawing
.
Point
(
14
,
33
0
);
this
.
groupBox5
.
Location
=
new
System
.
Drawing
.
Point
(
14
,
33
3
);
this
.
groupBox5
.
Name
=
"groupBox5"
;
this
.
groupBox5
.
Name
=
"groupBox5"
;
this
.
groupBox5
.
Size
=
new
System
.
Drawing
.
Size
(
716
,
178
);
this
.
groupBox5
.
Size
=
new
System
.
Drawing
.
Size
(
716
,
232
);
this
.
groupBox5
.
TabIndex
=
33
;
this
.
groupBox5
.
TabIndex
=
33
;
this
.
groupBox5
.
TabStop
=
false
;
this
.
groupBox5
.
TabStop
=
false
;
this
.
groupBox5
.
Text
=
"运动测试"
;
this
.
groupBox5
.
Text
=
"运动测试"
;
...
@@ -689,8 +693,7 @@
...
@@ -689,8 +693,7 @@
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
752
,
589
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
752
,
636
);
this
.
Controls
.
Add
(
this
.
lblControlStatus
);
this
.
Controls
.
Add
(
this
.
btnBack
);
this
.
Controls
.
Add
(
this
.
btnBack
);
this
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
...
@@ -720,7 +723,6 @@
...
@@ -720,7 +723,6 @@
this
.
groupBox5
.
ResumeLayout
(
false
);
this
.
groupBox5
.
ResumeLayout
(
false
);
this
.
groupBox5
.
PerformLayout
();
this
.
groupBox5
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
}
...
...
TSA-V/deviceDebug/FrmPusicanTest.cs
查看文件 @
31d33c0
...
@@ -164,6 +164,7 @@ namespace TSA_V
...
@@ -164,6 +164,7 @@ namespace TSA_V
lblControlStatus
.
Text
=
(
"status:stop 3:["
+
str
.
Substring
(
0
,
1
)
+
"],busy:["
+
str
.
Substring
(
1
,
1
)
+
"],Locked-rotor state:["
lblControlStatus
.
Text
=
(
"status:stop 3:["
+
str
.
Substring
(
0
,
1
)
+
"],busy:["
+
str
.
Substring
(
1
,
1
)
+
"],Locked-rotor state:["
+
str
.
Substring
(
2
,
1
)
+
"],stop 2:["
+
str
.
Substring
(
3
,
1
)
+
"],stop 1:["
+
str
.
Substring
(
4
,
1
)
+
"]"
);
+
str
.
Substring
(
2
,
1
)
+
"],stop 2:["
+
str
.
Substring
(
3
,
1
)
+
"],stop 1:["
+
str
.
Substring
(
4
,
1
)
+
"]"
);
}
}
lblControlStatus
.
Text
+=
PUSICANControl
.
GetGPIO
(
nodeid
);
}
}
private
void
btnClearStatus_Click
(
object
sender
,
EventArgs
e
)
private
void
btnClearStatus_Click
(
object
sender
,
EventArgs
e
)
...
@@ -238,8 +239,16 @@ namespace TSA_V
...
@@ -238,8 +239,16 @@ namespace TSA_V
private
void
btnHomeMove_Click
(
object
sender
,
EventArgs
e
)
private
void
btnHomeMove_Click
(
object
sender
,
EventArgs
e
)
{
{
uint
nodeid
=
GetSelectNode
();
uint
nodeid
=
GetSelectNode
();
if
(
nodeid
.
Equals
(
LWidthManager
.
Line_NodeAddr
))
{
int
homeSpeed
=
FormUtil
.
GetIntValue
(
txtHomeMoveSpeed
);
PUSICANControl
.
HomeMove
(
nodeid
,
true
,
homeSpeed
);
}
else
{
int
homeSpeed
=
FormUtil
.
GetIntValue
(
txtHomeMoveSpeed
);
int
homeSpeed
=
FormUtil
.
GetIntValue
(
txtHomeMoveSpeed
);
PUSICANControl
.
HomeMove
(
nodeid
,
homeSpeed
);
PUSICANControl
.
HomeMove
(
nodeid
,
false
,
homeSpeed
);
}
}
}
private
void
llblClearp_LinkClicked
(
object
sender
,
LinkLabelLinkClickedEventArgs
e
)
private
void
llblClearp_LinkClicked
(
object
sender
,
LinkLabelLinkClickedEventArgs
e
)
...
@@ -247,6 +256,11 @@ namespace TSA_V
...
@@ -247,6 +256,11 @@ namespace TSA_V
uint
nodeid
=
GetSelectNode
();
uint
nodeid
=
GetSelectNode
();
PUSICANControl
.
SetPosition
(
nodeid
,
0
);
PUSICANControl
.
SetPosition
(
nodeid
,
0
);
}
}
private
void
lblControlStatus_Click
(
object
sender
,
EventArgs
e
)
{
}
}
}
}
}
TSA-V/workForm/FrmTSAV.cs
查看文件 @
31d33c0
...
@@ -308,7 +308,7 @@ namespace TSA_V
...
@@ -308,7 +308,7 @@ namespace TSA_V
this
.
timer
.
Enabled
=
false
;
this
.
timer
.
Enabled
=
false
;
this
.
timerShowForm
.
Enabled
=
false
;
this
.
timerShowForm
.
Enabled
=
false
;
if
(
TSAVBean
.
Status
>
TSAVStatus
.
Wai
t
)
if
(
TSAVBean
.
Status
>
TSAVStatus
.
Rese
t
)
{
{
TSAVBean
.
StopWork
();
TSAVBean
.
StopWork
();
}
}
...
@@ -677,15 +677,15 @@ namespace TSA_V
...
@@ -677,15 +677,15 @@ namespace TSA_V
private
void
btnStop_Click
(
object
sender
,
EventArgs
e
)
private
void
btnStop_Click
(
object
sender
,
EventArgs
e
)
{
{
Task
.
Factory
.
StartNew
(
delegate
//
Task.Factory.StartNew(delegate
{
//
{
if
(
TSAVBean
.
Status
>
TSAVStatus
.
Wai
t
)
// if (TSAVBean.Status > TSAVStatus.Rese
t)
{
//
{
TSAVBean
.
StopWork
();
//
TSAVBean.StopWork();
}
//
}
//OpInfo op = OpInfo.GetOpInfo(BoardManager.CurrBoard);
//
//OpInfo op = OpInfo.GetOpInfo(BoardManager.CurrBoard);
//bool result = DB.db.AddHistory(op, out int id);
//
//bool result = DB.db.AddHistory(op, out int id);
});
//
});
this
.
Close
();
this
.
Close
();
}
}
...
...
TSA-V/记录.txt
查看文件 @
31d33c0
...
@@ -83,3 +83,8 @@ SmartWorkstation.exe.config文件需要增加参数:
...
@@ -83,3 +83,8 @@ SmartWorkstation.exe.config文件需要增加参数:
</dependentAssembly>
</dependentAssembly>
20210429 修改问题:
1.调宽电机速度混乱
2.增加通用IO端口值判断,调宽电机原点返回时如果已在原点,先相对走-1000.
3.原点返回过程中,工作界面点结束会卡死
4.主界面增加设备状态显示。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论