Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO908-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 850a2f8d
由
张东亮
编写于
2022-02-09 15:26:15 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
保存出入库关键节点图片
1 个父辈
b943a359
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
168 行增加
和
27 行删除
source/DeviceLibrary/baan/AxisBean.cs
source/DeviceLibrary/huichuan_config/errorcode.h
source/DeviceLibrary/huichuan_x64/IMC_API_x64.dll
source/DeviceLibrary/huichuan_x64/IMC_API_x64.lib
source/DeviceLibrary/huichuan_x86/IMC_API_x86.dll
source/DeviceLibrary/huichuan_x86/IMC_API_x86.lib
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Camera.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Partial.cs
source/HuichuanLibrary/HCBoardManager_Axis.cs
source/HuichuanLibrary/ImcApi.cs
source/HuichuanLibrary/huichuan_x64/IMC_API_x64.dll
source/HuichuanLibrary/huichuan_x64/IMC_API_x64.lib
source/HuichuanLibrary/huichuan_x86/IMC_API_x86.dll
source/HuichuanLibrary/huichuan_x86/IMC_API_x86.lib
source/DeviceLibrary/baan/AxisBean.cs
查看文件 @
850a2f8
...
@@ -149,11 +149,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -149,11 +149,11 @@ namespace OnlineStore.DeviceLibrary
int
outCount
=
AxisManager
.
instance
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
outCount
=
AxisManager
.
instance
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
targetCount
=
AxisManager
.
instance
.
GetTargetPosition
(
deviceName
,
axisNo
);
int
targetCount
=
AxisManager
.
instance
.
GetTargetPosition
(
deviceName
,
axisNo
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
string
state
=
AxisManager
.
instance
.
GetStatus
(
deviceName
,
axisNo
);
//实时打印轴状态
LogUtil
.
info
(
$
" {MoveInfo.SLog}{MoveInfo.Name}{axis.DisplayStr},目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}]轴状态[{state}]"
);
if
(
isOk
)
if
(
isOk
)
{
{
string
state
=
AxisManager
.
instance
.
GetStatus
(
deviceName
,
axisNo
);
//打印轴状态
LogUtil
.
info
(
$
" {MoveInfo.SLog}{MoveInfo.Name}{axis.DisplayStr},目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}]轴状态[{state}]"
);
if
(
errorCount
<=
axis
.
CanErrorCountMax
)
if
(
errorCount
<=
axis
.
CanErrorCountMax
)
{
{
return
true
;
return
true
;
...
@@ -241,6 +241,23 @@ namespace OnlineStore.DeviceLibrary
...
@@ -241,6 +241,23 @@ namespace OnlineStore.DeviceLibrary
return
false
;
return
false
;
}
}
/// <summary>
/// 运动过程中轴状态打印
/// </summary>
public
static
bool
ACAxisStsInMove
(
DeviceMoveInfo
MoveInfo
,
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
,
out
string
msg
)
{
msg
=
""
;
string
deviceName
=
axis
.
DeviceName
;
short
axisNo
=
axis
.
GetAxisValue
();
bool
isOk
=
AxisManager
.
instance
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
)
&&
AxisManager
.
instance
.
GetInPositionSingle
(
deviceName
,
axisNo
).
Equals
(
1
);
int
outCount
=
AxisManager
.
instance
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
targetCount
=
AxisManager
.
instance
.
GetTargetPosition
(
deviceName
,
axisNo
);
string
state
=
AxisManager
.
instance
.
GetStatus
(
deviceName
,
axisNo
);
//实时打印轴状态
LogUtil
.
LOGGER
.
Debug
(
$
" 轴实时状态打印:{MoveInfo.SLog}{MoveInfo.Name}{axis.DisplayStr},目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}]轴状态[{state}]"
);
return
false
;
}
public
int
GetAclPosition
()
public
int
GetAclPosition
()
{
{
int
p
=
AxisManager
.
instance
.
GetActualtPosition
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
int
p
=
AxisManager
.
instance
.
GetActualtPosition
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
...
...
source/DeviceLibrary/huichuan_config/errorcode.h
查看文件 @
850a2f8
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#define ERR_TRANSMIT (0x0001) // 指令传输错误
#define ERR_TRANSMIT (0x0001) // 指令传输错误
#define ERR_UNKNOWN (0x0002) // 不支持的指令
#define ERR_UNKNOWN (0x0002) // 不支持的指令
#define ERR_PARSE (0x0003) // 指令解析错误
#define ERR_PARSE (0x0003) // 指令解析错误
#define ERR_PARAM_OUTRANG (0x0007) // 传入参数不在范围
#define ERR_BGVEL_OUTRANG (0x0010) // 起始速度设置超出范围
#define ERR_BGVEL_OUTRANG (0x0010) // 起始速度设置超出范围
#define ERR_MAXVEL_OUTRANG (0x0011) // 最大速度设置超出范围
#define ERR_MAXVEL_OUTRANG (0x0011) // 最大速度设置超出范围
...
@@ -268,6 +269,7 @@
...
@@ -268,6 +269,7 @@
#define ERR_MAX_TORQ_LMT_PDO_NO_CFG (0x011c) // ECAT伺服中的最大转矩限制设置对象未配置
#define ERR_MAX_TORQ_LMT_PDO_NO_CFG (0x011c) // ECAT伺服中的最大转矩限制设置对象未配置
#define ERR_MPG_NOT_CFG (0x011d) // ECAT的手轮模块没有配置对象
#define ERR_MPG_NOT_CFG (0x011d) // ECAT的手轮模块没有配置对象
#define ERR_MPG_NOT_ENABLE (0x011e) // ECAT的手轮模块没有使能
#define ERR_MPG_NOT_ENABLE (0x011e) // ECAT的手轮模块没有使能
#define ERR_AX_DO_CFG (0x011f) // ECAT轴的do输出没有配置
#define ERR_EVENT_IO_INTYPE (0x0120) // IO事件的输入类型错误
#define ERR_EVENT_IO_INTYPE (0x0120) // IO事件的输入类型错误
#define ERR_EVENT_IO_INPORT (0x0121) // IO事件的输入端口错误
#define ERR_EVENT_IO_INPORT (0x0121) // IO事件的输入端口错误
...
@@ -343,6 +345,7 @@
...
@@ -343,6 +345,7 @@
#define ERR_ECAM_LIST_BUSY (0x025d) // 凸轮list被占用
#define ERR_ECAM_LIST_BUSY (0x025d) // 凸轮list被占用
#define ERR_ECAM_LIST_TABLE_DATA_FORMAT (0x025e) // 凸轮list模式中表格式错误
#define ERR_ECAM_LIST_TABLE_DATA_FORMAT (0x025e) // 凸轮list模式中表格式错误
#define ERR_AX_TYPE_DIFF (0x0270) // 轴类型不一致错误
//非标错误
//非标错误
#define ERR_READGCODE_DU (0x7000) // 重复检测
#define ERR_READGCODE_DU (0x7000) // 重复检测
...
@@ -417,4 +420,6 @@
...
@@ -417,4 +420,6 @@
#define ERR_ARM_CMP_ENCRY_CHIP (0x901e) // 板卡权限验证不通过
#define ERR_ARM_CMP_ENCRY_CHIP (0x901e) // 板卡权限验证不通过
#define NO_ENCRY_CHIP (0x901f) // 板卡没有加密芯片
#define NO_ENCRY_CHIP (0x901f) // 板卡没有加密芯片
#define ERR_EEPROM_INFO (0x9020) // 板卡上板载信息有误
#define ERR_EEPROM_INFO (0x9020) // 板卡上板载信息有误
#define ERR_PDO_OBJ_NOT_SUPPORTED (0x9021) // 自由访问PDO对象不支持
#define ERR_STATION_NOT_ALLOWED (0x9022) // 自由访问PDO的站点不允许访问
#define ERR_ECAT_STS_NOT_OP_STS (0x9023) // 主站未处于OP状态
source/DeviceLibrary/huichuan_x64/IMC_API_x64.dll
查看文件 @
850a2f8
此文件类型无法预览
source/DeviceLibrary/huichuan_x64/IMC_API_x64.lib
查看文件 @
850a2f8
此文件类型无法预览
source/DeviceLibrary/huichuan_x86/IMC_API_x86.dll
查看文件 @
850a2f8
此文件类型无法预览
source/DeviceLibrary/huichuan_x86/IMC_API_x86.lib
查看文件 @
850a2f8
此文件类型无法预览
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Camera.cs
查看文件 @
850a2f8
...
@@ -96,6 +96,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -96,6 +96,10 @@ namespace OnlineStore.DeviceLibrary
string
imgPath
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ImagePath
);
string
imgPath
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ImagePath
);
public
void
SaveImage
(
string
camName
)
public
void
SaveImage
(
string
camName
)
{
{
try
{
if
(
MoveInfo
.
MoveParam
==
null
)
{
string
path
=
Application
.
StartupPath
+
imgPath
+
camName
+
"\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
string
path
=
Application
.
StartupPath
+
imgPath
+
camName
+
"\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
);
if
(
AutoSaveImage
)
if
(
AutoSaveImage
)
{
{
...
@@ -104,6 +108,28 @@ namespace OnlineStore.DeviceLibrary
...
@@ -104,6 +108,28 @@ namespace OnlineStore.DeviceLibrary
camera
.
SaveImage
(
camName
,
path
,
DateTime
.
Now
.
ToString
(
"hhmmssfff"
),
System
.
Drawing
.
Imaging
.
ImageFormat
.
Bmp
);
camera
.
SaveImage
(
camName
,
path
,
DateTime
.
Now
.
ToString
(
"hhmmssfff"
),
System
.
Drawing
.
Imaging
.
ImageFormat
.
Bmp
);
}
}
}
}
else
{
if
(
MoveInfo
.
MoveParam
.
PosInfo
!=
null
)
{
InOutPosInfo
inOutPosInfo
=
MoveInfo
.
MoveParam
.
PosInfo
;
string
path
=
Application
.
StartupPath
+
imgPath
+
camName
+
"\\"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
)
+
"\\"
+
inOutPosInfo
.
PosId
;
if
(
AutoSaveImage
)
{
if
(!
System
.
IO
.
Directory
.
Exists
(
path
))
Directory
.
CreateDirectory
(
path
);
camera
.
SaveImage
(
camName
,
path
,
$
"{inOutPosInfo.barcode}-{MoveInfo.MoveType}-{DateTime.Now.ToString("
hhmmssfff
")}"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Bmp
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"保存{camName}图片失败"
,
ex
);
}
}
}
}
public
class
CameraArgs
:
EventArgs
public
class
CameraArgs
:
EventArgs
{
{
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
查看文件 @
850a2f8
...
@@ -270,6 +270,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -270,6 +270,7 @@ namespace OnlineStore.DeviceLibrary
PullAxis_Inout_To_P2_P4
();
PullAxis_Inout_To_P2_P4
();
CamDetectError
=
false
;
CamDetectError
=
false
;
IgnoreCamDect
=
false
;
IgnoreCamDect
=
false
;
SaveSpecifiedImage
();
}
}
break
;
break
;
case
StepEnum
.
SI_09_ToTray
:
case
StepEnum
.
SI_09_ToTray
:
...
@@ -287,6 +288,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -287,6 +288,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
$
"入库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
PullAxis_UpdownToMiddleP2
();
PullAxis_UpdownToMiddleP2
();
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
trayRows
[
GetPosRow
()],
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
trayRows
[
GetPosRow
()],
IO_VALUE
.
HIGH
));
SaveSpecifiedImage
();
break
;
break
;
case
StepEnum
.
SI_12_DropTrayToPos
:
case
StepEnum
.
SI_12_DropTrayToPos
:
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_13_GetReel
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_13_GetReel
);
...
@@ -326,7 +328,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -326,7 +328,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
$
"入库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4,移栽旋转轴到水平点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4,移栽旋转轴到水平点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
PullAxis_Inout_To_P2_P4
();
PullAxis_Inout_To_P2_P4
();
MiddleAxis_To_P2
();
MiddleAxis_To_P2
();
SaveSpecifiedImage
();
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//string res = rtn ? "OK" : "NG";
//string res = rtn ? "OK" : "NG";
...
@@ -367,11 +369,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -367,11 +369,12 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_19_InoutBack
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_19_InoutBack
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:料斗拉取进出轴到拍照点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:料斗拉取进出轴到拍照点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
PullAxis_Inout_To_Cam
();
PullAxis_Inout_To_Cam
();
SaveSpecifiedImage
();
break
;
break
;
case
StepEnum
.
SI_19_InoutBack
:
case
StepEnum
.
SI_19_InoutBack
:
if
(!
CheckInStoreOtherSideInfo
())
if
(!
CheckInStoreOtherSideInfo
())
{
{
if
(
InDoorSigCheck
())
if
(
InDoorSigCheck
())
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_20_ToStandby
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
SI_20_ToStandby
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:入料口有料,行走机构去待机点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"入库 {MoveInfo.SLog}:入料口有料,行走机构去待机点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
查看文件 @
850a2f8
...
@@ -69,6 +69,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -69,6 +69,7 @@ namespace OnlineStore.DeviceLibrary
PullAxis_Inout_To_P2_P4
();
PullAxis_Inout_To_P2_P4
();
CamDetectError
=
false
;
CamDetectError
=
false
;
IgnoreCamDect
=
false
;
IgnoreCamDect
=
false
;
SaveSpecifiedImage
();
}
}
break
;
break
;
case
StepEnum
.
SO_03_ToTray
:
case
StepEnum
.
SO_03_ToTray
:
...
@@ -86,6 +87,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -86,6 +87,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
$
"出库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"出库 {MoveInfo.SLog}:将抽屉降到库位提取点,料斗拉取升降轴到P2料屉提取水平点P2,到位后检测{trayRows[GetPosRow()]}=1[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
PullAxis_UpdownToMiddleP2
();
PullAxis_UpdownToMiddleP2
();
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
trayRows
[
GetPosRow
()],
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
trayRows
[
GetPosRow
()],
IO_VALUE
.
HIGH
));
SaveSpecifiedImage
();
break
;
break
;
case
StepEnum
.
SO_06_DropTrayToPos
:
case
StepEnum
.
SO_06_DropTrayToPos
:
MoveInfo
.
NextMoveStep
(
StepEnum
.
SO_07_GetReel
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
SO_07_GetReel
);
...
@@ -125,7 +127,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -125,7 +127,6 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
$
"出库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"出库 {MoveInfo.SLog}:推到抽屉提取点,料斗拉取进出轴到料屉提取点P2/P4[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
//Bitmap bitmap = AcqImage(CamPosSide(MoveInfo.MoveParam.PosInfo.PosId));
PullAxis_Inout_To_P2_P4
();
PullAxis_Inout_To_P2_P4
();
SaveSpecifiedImage
();
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//bool rtn = MatchAndSaveImg(bitmap, $"{DateTime.Now.ToString("HHmmss")}");
//string res = rtn ? "OK" : "NG";
//string res = rtn ? "OK" : "NG";
//LogInfo($"出库 {MoveInfo.SLog}:抓手检测结果:{res}");
//LogInfo($"出库 {MoveInfo.SLog}:抓手检测结果:{res}");
...
@@ -165,6 +166,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -165,6 +166,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
StepEnum
.
SO_13_InoutBack
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
SO_13_InoutBack
);
LogInfo
(
$
"出库 {MoveInfo.SLog}:料斗拉取进出轴到拍照点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
LogInfo
(
$
"出库 {MoveInfo.SLog}:料斗拉取进出轴到拍照点[{MoveInfo.MoveParam.PosInfo.GetPosSide()}面]"
);
PullAxis_Inout_To_Cam
();
PullAxis_Inout_To_Cam
();
SaveSpecifiedImage
();
break
;
break
;
case
StepEnum
.
SO_13_InoutBack
:
case
StepEnum
.
SO_13_InoutBack
:
//检查另一面是否有出库任务
//检查另一面是否有出库任务
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_Partial.cs
查看文件 @
850a2f8
...
@@ -932,6 +932,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -932,6 +932,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
MoveInfo
.
IsInWait
)
if
(
MoveInfo
.
IsInWait
)
{
{
PrintAxisSts
(
MoveInfo
);
CheckWait
(
MoveInfo
);
CheckWait
(
MoveInfo
);
}
}
if
(
MoveInfo
.
IsInWait
)
if
(
MoveInfo
.
IsInWait
)
...
@@ -940,6 +941,34 @@ namespace OnlineStore.DeviceLibrary
...
@@ -940,6 +941,34 @@ namespace OnlineStore.DeviceLibrary
}
}
InstoreExecute
();
InstoreExecute
();
}
}
/// <summary>
/// 打印轴状态
/// </summary>
/// <param name="moveInfo"></param>
private
void
PrintAxisSts
(
DeviceMoveInfo
moveInfo
)
{
List
<
WaitResultInfo
>
list
=
moveInfo
.
WaitList
;
int
cutWLcount
=
list
.
Count
;
if
(
list
.
Count
<=
0
)
{
return
;
}
foreach
(
WaitResultInfo
wait
in
list
)
{
if
(
wait
.
IsEnd
)
{
continue
;
}
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W001_AxisMove
))
{
string
msg
=
""
;
{
wait
.
IsEnd
=
AxisBean
.
ACAxisStsInMove
(
moveInfo
,
wait
.
AxisInfo
,
wait
.
TargetPosition
,
wait
.
TargetSpeed
,
out
msg
);
}
}
}
}
#
endregion
#
endregion
#
region
出库
#
region
出库
...
@@ -1074,6 +1103,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1074,6 +1103,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
MoveInfo
.
IsInWait
)
if
(
MoveInfo
.
IsInWait
)
{
{
PrintAxisSts
(
MoveInfo
);
CheckWait
(
MoveInfo
);
CheckWait
(
MoveInfo
);
}
}
if
(
MoveInfo
.
IsInWait
)
if
(
MoveInfo
.
IsInWait
)
...
@@ -1087,6 +1117,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1087,6 +1117,7 @@ namespace OnlineStore.DeviceLibrary
{
{
Task
.
Factory
.
StartNew
(
new
Action
(()
=>
Task
.
Factory
.
StartNew
(
new
Action
(()
=>
{
{
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
if
(
CheckASide
())
if
(
CheckASide
())
{
{
SaveImage
(
"box_A"
);
SaveImage
(
"box_A"
);
...
...
source/HuichuanLibrary/HCBoardManager_Axis.cs
查看文件 @
850a2f8
...
@@ -283,16 +283,32 @@ namespace HuichuanLibrary
...
@@ -283,16 +283,32 @@ namespace HuichuanLibrary
private
static
bool
StartPtpMove
(
short
axisNo
,
short
ptpType
,
double
ptpPos
)
private
static
bool
StartPtpMove
(
short
axisNo
,
short
ptpType
,
double
ptpPos
)
{
{
//【3】启动PTP
////【3】启动PTP
UInt32
ret
=
ImcApi
.
IMC_StartPtpMove
(
nCardHandle
,
axisNo
,
ptpPos
,
ptpType
);
//UInt32 ret = ImcApi.IMC_StartPtpMove(nCardHandle, axisNo, ptpPos, ptpType);
//if (ret != 0)
//{
// ShowErrorLog(" Axis[" + axisNo + "] ptpPos["+ ptpPos + "] StartPtpMove " + ptpType + " FAIL, ",ret);
// return false;
//}
//else
//{
// DebugLog(" Axis[" + axisNo + "] ptpPos[" + ptpPos + "] StartPtpMove " + ptpType + " OK",ret);
// return true;
//}
return
StartPtpMoveEx
(
axisNo
,
ptpType
,
ptpPos
);
}
private
static
bool
StartPtpMoveEx
(
short
axisNo
,
short
ptpType
,
double
ptpPos
)
{
//【3】启动PTP Ex
UInt32
ret
=
ImcApi
.
IMC_StartPtpMove_Ex
(
nCardHandle
,
axisNo
,
ptpPos
,
ptpType
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
{
{
ShowErrorLog
(
" Axis["
+
axisNo
+
"] ptpPos["
+
ptpPos
+
"] StartPtpMove "
+
ptpType
+
" FAIL, "
,
ret
);
ShowErrorLog
(
" Axis["
+
axisNo
+
"] ptpPos["
+
ptpPos
+
"] StartPtpMove_Ex "
+
ptpType
+
" FAIL, "
,
ret
);
return
false
;
return
false
;
}
}
else
else
{
{
DebugLog
(
" Axis["
+
axisNo
+
"] ptpPos["
+
ptpPos
+
"] StartPtpMove
"
+
ptpType
+
" OK"
,
ret
);
DebugLog
(
" Axis["
+
axisNo
+
"] ptpPos["
+
ptpPos
+
"] StartPtpMove
_Ex "
+
ptpType
+
" OK"
,
ret
);
return
true
;
return
true
;
}
}
}
}
...
@@ -468,16 +484,64 @@ namespace HuichuanLibrary
...
@@ -468,16 +484,64 @@ namespace HuichuanLibrary
/// <returns></returns>
/// <returns></returns>
public
static
AxisSts
GetAxisSts
(
short
axisNo
)
public
static
AxisSts
GetAxisSts
(
short
axisNo
)
{
{
//AxisSts sts = new AxisSts();
//if (!CardInitOk())
//{
// return sts;
//}
//Int32[] nTimerAxSts = { 0 };
//UInt32 ret = ImcApi.IMC_GetAxSts(nCardHandle, axisNo, nTimerAxSts, 1);
//if (ret != 0 || nTimerAxSts.Length <= 0)
//{
// ShowErrorLog(" Axis[" + axisNo + "] GetAxSts FAIL, ",ret);
// return sts;
//}
//int axisState = nTimerAxSts[0];
////【3】更新界面显示
//sts.ALM = ((axisState & 0x01) == 0x01) ? 1 : 0; //报警信号
//sts.ServoOn = ((axisState & 0x02) == 0x02) ? 1 : 0; //使能信号
//sts.BUSY = ((axisState & 0x04) == 0x04) ? 1 : 0; //轴忙信号
//sts.INP = ((axisState & 0x08) == 0x08) ? 1 : 0; //轴到位信号
//sts.EMG = ((axisState & 0x200) == 0x200) ? 1 : 0; //急停信号
//sts.WARN = ((axisState & 0x1000) == 0x1000) ? 1 : 0; //警告信号
//sts.ECAT = ((axisState & ImcApi.AX_ECAT_BIT) == ImcApi.AX_ECAT_BIT) ? 1 : 0;//总线轴标志
//Int16 nTimerAxInput = 0;
//ret = ImcApi.IMC_GetAxEcatDigitalInput(nCardHandle, axisNo, ref nTimerAxInput);
//if (ret != 0)
//{
// ShowErrorLog(" Axis[" + axisNo + "]GetAxEcatDigitalInput ,",ret);
// return sts;
//}
//sts.NEL = ((nTimerAxInput & 0x01) == 0x01) ? 1 : 0; //负限位信号
//sts.PEL = ((nTimerAxInput & 0x02) == 0x02) ? 1 : 0; //正限位信号
//sts.ORG = ((nTimerAxInput & 0x04) == 0x04) ? 1 : 0; //原点信号
//return sts;
return
GetAxisStsEx
(
axisNo
);
}
/// <summary>
/// 获取轴状态-新
/// </summary>
///<param name="axisNo">轴号</param>
/// <returns></returns>
public
static
AxisSts
GetAxisStsEx
(
short
axisNo
)
{
AxisSts
sts
=
new
AxisSts
();
AxisSts
sts
=
new
AxisSts
();
if
(!
CardInitOk
())
if
(!
CardInitOk
())
{
{
return
sts
;
return
sts
;
}
}
Int32
[]
nTimerAxSts
=
{
0
};
Int32
[]
nTimerAxSts
=
{
0
};
UInt32
ret
=
ImcApi
.
IMC_GetAxSts
(
nCardHandle
,
axisNo
,
nTimerAxSts
,
1
);
UInt32
ret
=
ImcApi
.
IMC_GetAxSts
Ex
(
nCardHandle
,
axisNo
,
nTimerAxSts
,
1
);
if
(
ret
!=
0
||
nTimerAxSts
.
Length
<=
0
)
if
(
ret
!=
0
||
nTimerAxSts
.
Length
<=
0
)
{
{
ShowErrorLog
(
" Axis["
+
axisNo
+
"] GetAxSts
FAIL, "
,
ret
);
ShowErrorLog
(
" Axis["
+
axisNo
+
"] GetAxSts
Ex FAIL, "
,
ret
);
return
sts
;
return
sts
;
}
}
...
@@ -489,26 +553,15 @@ namespace HuichuanLibrary
...
@@ -489,26 +553,15 @@ namespace HuichuanLibrary
sts
.
ServoOn
=
((
axisState
&
0x02
)
==
0x02
)
?
1
:
0
;
//使能信号
sts
.
ServoOn
=
((
axisState
&
0x02
)
==
0x02
)
?
1
:
0
;
//使能信号
sts
.
BUSY
=
((
axisState
&
0x04
)
==
0x04
)
?
1
:
0
;
//轴忙信号
sts
.
BUSY
=
((
axisState
&
0x04
)
==
0x04
)
?
1
:
0
;
//轴忙信号
sts
.
INP
=
((
axisState
&
0x08
)
==
0x08
)
?
1
:
0
;
//轴到位信号
sts
.
INP
=
((
axisState
&
0x08
)
==
0x08
)
?
1
:
0
;
//轴到位信号
sts
.
PEL
=
((
axisState
&
0x10
)
==
0x10
)
?
1
:
0
;
//正限位报警信号
sts
.
NEL
=
((
axisState
&
0x20
)
==
0x20
)
?
1
:
0
;
//负限位报警信号
sts
.
EMG
=
((
axisState
&
0x200
)
==
0x200
)
?
1
:
0
;
//急停信号
sts
.
EMG
=
((
axisState
&
0x200
)
==
0x200
)
?
1
:
0
;
//急停信号
sts
.
WARN
=
((
axisState
&
0x1000
)
==
0x1000
)
?
1
:
0
;
//警告信号
sts
.
WARN
=
((
axisState
&
0x1000
)
==
0x1000
)
?
1
:
0
;
//警告信号
sts
.
ECAT
=
((
axisState
&
ImcApi
.
AX_ECAT_BIT
)
==
ImcApi
.
AX_ECAT_BIT
)
?
1
:
0
;
//总线轴标志
sts
.
ECAT
=
((
axisState
&
ImcApi
.
AX_ECAT_BIT
)
==
ImcApi
.
AX_ECAT_BIT
)
?
1
:
0
;
//总线轴标志
sts
.
ORG
=
((
axisState
&
0x2000
)
==
0x2000
)
?
1
:
0
;
//原点信号
Int16
nTimerAxInput
=
0
;
ret
=
ImcApi
.
IMC_GetAxEcatDigitalInput
(
nCardHandle
,
axisNo
,
ref
nTimerAxInput
);
if
(
ret
!=
0
)
{
ShowErrorLog
(
" Axis["
+
axisNo
+
"]GetAxEcatDigitalInput ,"
,
ret
);
return
sts
;
return
sts
;
}
}
sts
.
NEL
=
((
nTimerAxInput
&
0x01
)
==
0x01
)
?
1
:
0
;
//负限位信号
sts
.
PEL
=
((
nTimerAxInput
&
0x02
)
==
0x02
)
?
1
:
0
;
//正限位信号
sts
.
ORG
=
((
nTimerAxInput
&
0x04
)
==
0x04
)
?
1
:
0
;
//原点信号
return
sts
;
}
/// <summary>
/// <summary>
/// 获取轴规划位置
/// 获取轴规划位置
/// </summary>
/// </summary>
...
...
source/HuichuanLibrary/ImcApi.cs
查看文件 @
850a2f8
...
@@ -1180,6 +1180,8 @@ namespace HuichuanLibrary
...
@@ -1180,6 +1180,8 @@ namespace HuichuanLibrary
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_GetAxSts"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_GetAxSts"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_GetAxSts
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
Int32
[]
pAxSts
,
Int16
count
=
1
);
public
static
extern
UInt32
IMC_GetAxSts
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
Int32
[]
pAxSts
,
Int16
count
=
1
);
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_GetAxStsEx"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_GetAxStsEx
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
Int32
[]
pAxSts
,
Int16
count
=
1
);
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_ClrAxSts"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_ClrAxSts"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_ClrAxSts
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
Int16
count
=
1
);
public
static
extern
UInt32
IMC_ClrAxSts
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
Int16
count
=
1
);
...
@@ -1372,6 +1374,8 @@ namespace HuichuanLibrary
...
@@ -1372,6 +1374,8 @@ namespace HuichuanLibrary
//_DLL_API UINT32 IMC_UpdatePtpTgtVel(HANDLETYPE cardHandle, INT16 axNo, double tgtVel);
//_DLL_API UINT32 IMC_UpdatePtpTgtVel(HANDLETYPE cardHandle, INT16 axNo, double tgtVel);
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_StartPtpMove"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_StartPtpMove"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_StartPtpMove
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
double
tgtPos
,
Int16
posType
=
0
);
public
static
extern
UInt32
IMC_StartPtpMove
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
double
tgtPos
,
Int16
posType
=
0
);
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_StartPtpMove_Ex"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_StartPtpMove_Ex
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
double
tgtPos
,
Int16
posType
=
0
);
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_UpdatePtpTgtPos"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
[
DllImport
(
EtherCATConfigApiDllName
,
EntryPoint
=
"IMC_UpdatePtpTgtPos"
,
ExactSpelling
=
false
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
public
static
extern
UInt32
IMC_UpdatePtpTgtPos
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
double
tgtPos
);
public
static
extern
UInt32
IMC_UpdatePtpTgtPos
(
HANDLETYPE
cardHandle
,
Int16
axNo
,
double
tgtPos
);
...
...
source/HuichuanLibrary/huichuan_x64/IMC_API_x64.dll
查看文件 @
850a2f8
此文件类型无法预览
source/HuichuanLibrary/huichuan_x64/IMC_API_x64.lib
查看文件 @
850a2f8
此文件类型无法预览
source/HuichuanLibrary/huichuan_x86/IMC_API_x86.dll
查看文件 @
850a2f8
此文件类型无法预览
source/HuichuanLibrary/huichuan_x86/IMC_API_x86.lib
查看文件 @
850a2f8
此文件类型无法预览
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论