Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5e87868b
由
张东亮
编写于
2024-02-21 15:57:44 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加打印回原完成后轴的状态
1 个父辈
ffef7a5f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
32 行增加
和
18 行删除
DeviceLibrary/DeviceLibrary/AxisBean.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/DeviceLibrary/AxisBean.cs
查看文件 @
5e87868
using
OnlineStore.Common
;
using
HuichuanLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -21,7 +22,7 @@ namespace DeviceLibrary
/// <summary>
/// 干涉检测回调 from, to
/// </summary>
public
event
Func
<
int
,
int
,(
bool
,
string
)>
interference
;
public
event
Func
<
int
,
int
,
(
bool
,
string
)>
interference
;
public
string
AxisName
;
public
bool
ForceSafeCheck
=
false
;
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
...
...
@@ -112,7 +113,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
"ServoOff【"
+
AxisName
+
"】"
);
AxisManager
.
ServoOff
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
}
public
void
HomeMove
(
MoveInfo
MoveInfo
,
bool
force
=
true
)
public
void
HomeMove
(
MoveInfo
MoveInfo
,
bool
force
=
true
)
{
if
(!
force
&&
AxisManager
.
GetHomeEndStatus
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
())
==
3
)
{
...
...
@@ -121,7 +122,7 @@ namespace DeviceLibrary
}
Config
.
TargetPosition
=
0
;
LogUtil
.
info
(
AxisName
+
"speed["
+
Config
.
HomeHighSpeed
+
"]开始原点返回"
);
if
(
MoveInfo
!=
null
)
if
(
MoveInfo
!=
null
)
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
true
));
var
HomeLowSpeed
=
Config
.
HomeLowSpeed
>
0
?
Config
.
HomeLowSpeed
:
Config
.
HomeHighSpeed
/
10
;
var
HomeAddSpeed
=
Config
.
HomeAddSpeed
>
0
?
Config
.
HomeAddSpeed
:
Config
.
HomeHighSpeed
*
5
;
...
...
@@ -140,7 +141,7 @@ namespace DeviceLibrary
return
;
}
if
(
ForceSafeCheck
&&
!
IsSafe
(
targetPosition
,
out
string
msg
))
if
(
ForceSafeCheck
&&
!
IsSafe
(
targetPosition
,
out
string
msg
))
{
Msg
.
add
(
msg
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
msg
);
...
...
@@ -208,7 +209,7 @@ namespace DeviceLibrary
AxisManager
.
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
Thread
.
Sleep
(
100
);
}
LogUtil
.
error
(
$
"{
MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
LogUtil
.
error
(
$
"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
var
AddSpeed
=
axis
.
AddSpeed
>
0
?
axis
.
AddSpeed
:
targetSpeed
*
4
;
var
DelSpeed
=
axis
.
DelSpeed
>
0
?
axis
.
DelSpeed
:
targetSpeed
*
4
;
AxisManager
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
AddSpeed
,
DelSpeed
);
// , axis.AddSpeed, axis.DelSpeed);
...
...
@@ -229,7 +230,11 @@ namespace DeviceLibrary
if
(
AxisManager
.
IsHomeMoveEnd
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
// || AxisManager.AxisStsINP(axis.DeviceName, axis.GetAxisValue()).Equals(1))
{
//原点完成并且位置=0
//编码器位置
int
outCount
=
AxisManager
.
GetActualtPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
//规划位置
int
outTarget
=
AxisManager
.
GetTargetPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
AxisSts
axisS
=
HCBoardManager
.
GetAxisSts
(
axis
.
GetAxisValue
());
int
errorCount
=
Math
.
Abs
(
outCount
);
if
(
errorCount
<=
axis
.
CanErrorCountMax
)
{
...
...
@@ -238,14 +243,15 @@ namespace DeviceLibrary
//判断是否需要重新运动
if
(
MoveInfo
.
CanWhileCount
>
0
)
{
LogUtil
.
error
(
MoveInfo
.
Name
+
axis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
msg
=
$
"{MoveInfo.Name} {axis.DisplayStr} 收到原点完成信号,当前位置{outCount},规划位置{outTarget},重新回原点,剩余[{MoveInfo.CanWhileCount}]]次。{axisS.ToStr()}"
;
LogUtil
.
error
(
msg
);
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
AxisManager
.
HomeMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
axis
.
HomeHighSpeed
,
axis
.
HomeLowSpeed
,
axis
.
HomeAddSpeed
);
MoveInfo
.
CanWhileCount
--;
}
else
{
msg
=
MoveInfo
.
Name
+
" "
+
MoveInfo
.
MoveStep
+
axis
.
DisplayStr
+
",收到原点完成信号,当前位置["
+
outCount
+
"],误差过大,需要报警
"
;
msg
=
$
"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr} ,收到原点完成信号,当前位置[{outCount}],规划位置{outTarget},误差过大,需要报警。{axisS.ToStr()}
"
;
LogUtil
.
error
(
msg
);
}
}
...
...
@@ -316,7 +322,8 @@ namespace DeviceLibrary
AxisManager
.
RelMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
targetSpeed
,
AddSpeed
,
DelSpeed
);
// , Config.AddSpeed, Config.DelSpeed);
}
public
bool
IsBusy
{
public
bool
IsBusy
{
get
=>
AxisManager
.
GetBusyStatus
(
Config
.
DeviceName
,
Config
.
GetAxisValue
())
==
1
;
}
public
bool
IsServeoOn
...
...
@@ -332,22 +339,26 @@ namespace DeviceLibrary
/// 判断轴运动是否安全
/// </summary>
/// <returns></returns>
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
)
{
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
)
{
msg
=
""
;
if
(
interference
==
null
)
return
true
;
bool
result
;
var
from
=
GetAclPosition
();
(
result
,
msg
)
=
interference
.
Invoke
(
from
,
Targetpos
);
(
result
,
msg
)
=
interference
.
Invoke
(
from
,
Targetpos
);
if
(
result
)
{
if
(
result
)
{
LogUtil
.
info
(
AxisName
+
$
" 干涉:{msg},From:{from},To:{Targetpos}"
);
}
return
!
result
;
}
public
void
MonitorAxisLoadRate
(
float
maxloadrate
)
{
Task
.
Run
(()
=>
{
public
void
MonitorAxisLoadRate
(
float
maxloadrate
)
{
Task
.
Run
(()
=>
{
Task
.
Delay
(
200
).
Wait
();
LogUtil
.
info
(
$
"{AxisName}-开始负载监控,最大负载阈值:{maxloadrate}"
);
List
<
float
>
loadrate
=
new
List
<
float
>();
...
...
@@ -355,15 +366,17 @@ namespace DeviceLibrary
{
var
loadval
=
((
HCAxisManager
)
AxisManager
.
instance
).
GetAxisLoadRate
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
loadrate
.
Add
(
loadval
);
if
(
loadval
>
maxloadrate
)
{
if
(
loadval
>
maxloadrate
)
{
LogUtil
.
info
(
$
"{AxisName}-{loadval}>{maxloadrate}超过负载,系统急停"
);
SuddenStop
();
Msg
.
add
(
AxisName
+
"-超过负载,系统急停"
,
MsgLevel
.
alarm
,
ErrInfo
.
SuddenStop
);
Msg
.
add
(
AxisName
+
"-超过负载,系统急停"
,
MsgLevel
.
alarm
,
ErrInfo
.
SuddenStop
);
break
;
}
Task
.
Delay
(
50
).
Wait
();
}
if
(
loadrate
.
Count
>
5
)
{
if
(
loadrate
.
Count
>
5
)
{
loadrate
.
Sort
();
int
middleIndex
=
loadrate
.
Count
/
2
;
LogUtil
.
info
(
$
"{AxisName}-本次负载监控:最小值:{loadrate.Min()}, 平均值:{loadrate.Average()}, 最大值{loadrate.Max()},中位数:{loadrate[middleIndex]}, 最大阈值:{maxloadrate}"
);
...
...
@@ -456,7 +469,7 @@ namespace DeviceLibrary
public
static
void
CloseMultiAxis
(
List
<
AxisBean
>
axisArray
)
{
foreach
(
AxisBean
axis
in
axisArray
)
{
{
axis
.
ServoOff
();
Thread
.
Sleep
(
10
);
}
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
5e87868
...
...
@@ -423,6 +423,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreTS17
:
//MoveInfo.NextMoveStep(MoveStep.StoreTS16);
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
MoveInfo
.
log
(
$
"{storeMoveType}:转移料盘完成"
);
MoveInfo
.
EndMove
();
ErrMsgTxt
=
""
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论