From 940b9c91609b4300d63a151bfc982599f9d7455b Mon Sep 17 00:00:00 2001 From: 17860779768 <3219079380@qq.com> Date: Fri, 31 Mar 2023 11:06:56 +0800 Subject: [PATCH] 20230331 --- A020.sln | 120 +- .../BRS.Common.Device.csproj | 10 + src/BRS.Common.Device/DeviceBase/RobotBase.cs | 583 +--- .../DeviceBase/TCPSeverBase.cs | 126 + src/BRS.Common.Device/app.config | 16 +- src/BRS.Common.Device/packages.config | 3 + src/BRS.Common.Model/BRS.Common.Model.csproj | 6 +- src/BRS.Common.Model/Helper/EnumHelper.cs | 165 +- .../Interface/IProcessConfig.cs | 4 +- src/BRS.Common.Model/Model/CustomizedPoint.cs | 152 + src/BRS.Common.Model/Model/DeviceOpBind.cs | 71 + src/BRS.Common.Model/app.config | 16 +- src/BRS.Common.Model/packages.config | 5 +- src/BRS.Process.A020/A020Config.cs | 10 +- src/BRS.Process.A020/A020Process.cs | 4 + .../A020Process_MachineState.cs | 48 +- src/BRS.Process.A020/A020Process_Operation.cs | 2533 +++++------------ .../A020Process_VisionProcessor.cs | 230 ++ src/BRS.Process.A020/BRS.Process.A020.csproj | 52 +- src/BRS.Process.A020/ContolPlc.cs | 28 +- .../UI/ContorlShaft.Designer.cs | 226 +- src/BRS.Process.A020/UI/ContorlShaft.cs | 9 +- .../UI/ControlSet.Designer.cs | 699 ----- src/BRS.Process.A020/UI/ControlSet.cs | 353 --- src/BRS.Process.A020/packages.config | 7 + src/BRS.Process/BRS.Process.csproj | 4 + src/BRS.Process/ProcessConfig.cs | 23 +- src/BRS.Process/app.config | 28 +- src/BRS.UI.Device.Winform/CtrlRobotRunBase.cs | 16 +- src/BRS.UI.Device.Winform/app.config | 16 +- src/BRS.UI.Main/App.config | 64 +- src/BRS.UI.Main/MainFrm.cs | 9 +- src/BRS.UI.Main/Program.cs | 2 +- src/BRS.UI.Model.Winform/app.config | 16 +- src/XKRS.Device.MelsecPLC/MelsecPLCDriver.cs | 1 - src/XKRS.Device.TCPSever/App.config | 22 + .../KawasakiTCPSeverRobotConfig.cs | 30 + .../KawasakiTCPSeverRobotDriver.cs | 58 + .../TCPSeverForm.Designer.cs | 202 ++ src/XKRS.Device.TCPSever/TCPSeverForm.cs | 84 + .../TCPSeverForm.resx} | 0 .../XKRS.Device.TCPSever.csproj | 85 + src/XKRS.Device.TCPSever/packages.config | 6 + 43 files changed, 2304 insertions(+), 3838 deletions(-) create mode 100644 src/BRS.Common.Device/DeviceBase/TCPSeverBase.cs delete mode 100644 src/BRS.Process.A020/UI/ControlSet.Designer.cs delete mode 100644 src/BRS.Process.A020/UI/ControlSet.cs create mode 100644 src/XKRS.Device.TCPSever/App.config create mode 100644 src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotConfig.cs create mode 100644 src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotDriver.cs create mode 100644 src/XKRS.Device.TCPSever/TCPSeverForm.Designer.cs create mode 100644 src/XKRS.Device.TCPSever/TCPSeverForm.cs rename src/{BRS.Process.A020/UI/ControlSet.resx => XKRS.Device.TCPSever/TCPSeverForm.resx} (100%) create mode 100644 src/XKRS.Device.TCPSever/XKRS.Device.TCPSever.csproj create mode 100644 src/XKRS.Device.TCPSever/packages.config diff --git a/A020.sln b/A020.sln index 224d38b..a2e337e 100644 --- a/A020.sln +++ b/A020.sln @@ -30,12 +30,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BRS.UI.Model.Winform", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BRS.Process.A020", "src\BRS.Process.A020\BRS.Process.A020.csproj", "{9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BRS.Device.OmronPLC", "src\BRS.Device.OmronPLC\BRS.Device.OmronPLC.csproj", "{560CC80B-389B-46FC-9B8C-DA1D62A555D9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XKRS.Device.NbtRobot", "src\BRS.Device.NbtRobot\XKRS.Device.NbtRobot.csproj", "{8FA74161-0D03-408F-811A-A244C9027BFB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XKRS.Device.MelsecPLC", "src\XKRS.Device.MelsecPLC\XKRS.Device.MelsecPLC.csproj", "{887F9454-B1F3-47B8-B9F7-48BEBA47193D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XKRS.Device.TCPSever", "src\XKRS.Device.TCPSever\XKRS.Device.TCPSever.csproj", "{91739E90-6A8E-433D-B244-5325F8848064}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +45,9 @@ Global Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 + ReleaseWithDbg|Any CPU = ReleaseWithDbg|Any CPU + ReleaseWithDbg|x64 = ReleaseWithDbg|x64 + ReleaseWithDbg|x86 = ReleaseWithDbg|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {987308DD-8BAA-463A-94E2-77D62E01A5BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -67,6 +68,12 @@ Global {987308DD-8BAA-463A-94E2-77D62E01A5BF}.Release|x64.Build.0 = Release|x64 {987308DD-8BAA-463A-94E2-77D62E01A5BF}.Release|x86.ActiveCfg = Release|Any CPU {987308DD-8BAA-463A-94E2-77D62E01A5BF}.Release|x86.Build.0 = Release|Any CPU + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {987308DD-8BAA-463A-94E2-77D62E01A5BF}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Debug|x64.ActiveCfg = Debug|x64 @@ -85,6 +92,12 @@ Global {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Release|x64.Build.0 = Release|x64 {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Release|x86.ActiveCfg = Release|Any CPU {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.Release|x86.Build.0 = Release|Any CPU + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Debug|Any CPU.Build.0 = Debug|Any CPU {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Debug|x64.ActiveCfg = Debug|x64 @@ -103,6 +116,12 @@ Global {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Release|x64.Build.0 = Release|x64 {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Release|x86.ActiveCfg = Release|Any CPU {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.Release|x86.Build.0 = Release|Any CPU + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {197C5AA8-9609-4D1C-B1E3-5879006EAAF4}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {E6429C64-92B3-46A2-B35E-579856D47F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E6429C64-92B3-46A2-B35E-579856D47F62}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6429C64-92B3-46A2-B35E-579856D47F62}.Debug|x64.ActiveCfg = Debug|x64 @@ -121,6 +140,12 @@ Global {E6429C64-92B3-46A2-B35E-579856D47F62}.Release|x64.Build.0 = Release|x64 {E6429C64-92B3-46A2-B35E-579856D47F62}.Release|x86.ActiveCfg = Release|Any CPU {E6429C64-92B3-46A2-B35E-579856D47F62}.Release|x86.Build.0 = Release|Any CPU + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {E6429C64-92B3-46A2-B35E-579856D47F62}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Debug|Any CPU.Build.0 = Debug|Any CPU {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Debug|x64.ActiveCfg = Debug|x64 @@ -139,6 +164,12 @@ Global {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Release|x64.Build.0 = Release|x64 {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Release|x86.ActiveCfg = Release|Any CPU {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.Release|x86.Build.0 = Release|Any CPU + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Debug|Any CPU.Build.0 = Debug|Any CPU {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Debug|x64.ActiveCfg = Debug|x64 @@ -157,6 +188,12 @@ Global {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x64.Build.0 = Release|x64 {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x86.ActiveCfg = Release|Any CPU {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x86.Build.0 = Release|Any CPU + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|x64.ActiveCfg = Release|x64 + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|x64.Build.0 = Release|x64 + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {741F6491-57C7-479A-B391-09BBA9FBA9DC}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -175,42 +212,12 @@ Global {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Release|x64.Build.0 = Release|Any CPU {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Release|x86.ActiveCfg = Release|Any CPU {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.Release|x86.Build.0 = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|x64.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|x64.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|x86.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug|x86.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|Any CPU.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|Any CPU.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|x64.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|x64.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|x86.ActiveCfg = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Debug1|x86.Build.0 = Debug|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|Any CPU.Build.0 = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|x64.ActiveCfg = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|x64.Build.0 = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|x86.ActiveCfg = Release|Any CPU - {560CC80B-389B-46FC-9B8C-DA1D62A555D9}.Release|x86.Build.0 = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|x64.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|x64.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|x86.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug|x86.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|Any CPU.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|Any CPU.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|x64.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|x64.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|x86.ActiveCfg = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Debug1|x86.Build.0 = Debug|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|Any CPU.Build.0 = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x64.ActiveCfg = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x64.Build.0 = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x86.ActiveCfg = Release|Any CPU - {8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x86.Build.0 = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|x64.ActiveCfg = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|x64.Build.0 = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|Any CPU.Build.0 = Debug|Any CPU {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -229,6 +236,36 @@ Global {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x64.Build.0 = Release|Any CPU {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x86.ActiveCfg = Release|Any CPU {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x86.Build.0 = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|x64.ActiveCfg = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|x64.Build.0 = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {887F9454-B1F3-47B8-B9F7-48BEBA47193D}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|x64.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|x64.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|x86.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug|x86.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|Any CPU.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|Any CPU.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|x64.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|x64.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|x86.ActiveCfg = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Debug1|x86.Build.0 = Debug|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|Any CPU.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|x64.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|x64.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|x86.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.Release|x86.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|Any CPU.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|Any CPU.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|x64.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|x64.Build.0 = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|x86.ActiveCfg = Release|Any CPU + {91739E90-6A8E-433D-B244-5325F8848064}.ReleaseWithDbg|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -241,9 +278,8 @@ Global {DD02C60E-560B-40C0-AD7F-523F0B4AA4FD} = {97C226B4-971C-4802-8D35-14E2980FF0C6} {741F6491-57C7-479A-B391-09BBA9FBA9DC} = {97C226B4-971C-4802-8D35-14E2980FF0C6} {9EB9DFC1-C78A-46C0-826A-5ED1A08232C0} = {DD1CE747-341A-4419-8398-0D482E02DE54} - {560CC80B-389B-46FC-9B8C-DA1D62A555D9} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B} - {8FA74161-0D03-408F-811A-A244C9027BFB} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B} {887F9454-B1F3-47B8-B9F7-48BEBA47193D} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B} + {91739E90-6A8E-433D-B244-5325F8848064} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4BF9CC66-BB0E-4400-BCF8-5BF7F5DA800A} diff --git a/src/BRS.Common.Device/BRS.Common.Device.csproj b/src/BRS.Common.Device/BRS.Common.Device.csproj index 22bdf4d..9bbf146 100644 --- a/src/BRS.Common.Device/BRS.Common.Device.csproj +++ b/src/BRS.Common.Device/BRS.Common.Device.csproj @@ -96,6 +96,15 @@ ..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + + ..\..\packages\STTech.BytesIO.Core.2.9.3\lib\net45\STTech.BytesIO.Core.dll + + + ..\..\packages\STTech.BytesIO.Tcp.2.9.3\lib\net45\STTech.BytesIO.Tcp.dll + + + ..\..\packages\STTech.CodePlus.1.4.0\lib\net45\STTech.CodePlus.dll + ..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll @@ -147,6 +156,7 @@ + diff --git a/src/BRS.Common.Device/DeviceBase/RobotBase.cs b/src/BRS.Common.Device/DeviceBase/RobotBase.cs index 7e0eb10..94e4be4 100644 --- a/src/BRS.Common.Device/DeviceBase/RobotBase.cs +++ b/src/BRS.Common.Device/DeviceBase/RobotBase.cs @@ -135,587 +135,8 @@ namespace BRS.Common.Base public class RobotInitialConfigBase : InitialConfigBase//, IWarningSetCollection { - [Category("驱动类型")] - [Description("驱动类型")] - [DisplayName("驱动类型")] - //[TypeConverter(typeof(DeviceTypeConverter))] - [TypeConverter(typeof(DeviceTypeSelectorConverter))] - public override string DriverType { get; set; } - - - #region 上料关键点位 - [Category("1.机械臂关键点位")] - [Description("机械臂起始位置P0")] - [DisplayName("机械臂起始位置P0")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotOriginPoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("1号机1号位抓取点位置P101")] - [DisplayName("1号机1号位抓取点位置P101")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance1GrabPoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("1号机2号位抓取点位置P201")] - [DisplayName("1号机2号位抓取点位置P201")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance2GrabPoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("2号机1号位抓取点位置P101")] - [DisplayName("2号机1号位抓取点位置P101")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance1GrabPoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("1号机2号位抓取点位置P201")] - [DisplayName("2号机2号位抓取点位置P201")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance2GrabPoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("1号机1号位放料位置P102")] - [DisplayName("1号机1号位放料位置P102")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance1UpPlacePoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("1号机2号位放料位置P202")] - [DisplayName("1号机2号位放料位置P202")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance2UpPlacePoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("2号机1号位放料位置P102")] - [DisplayName("2号机1号位放料位置P102")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance1UpPlacePoint { get; set; } = new RobotPoint(); - - [Category("2.机械臂上料关键点位")] - [Description("2号机2号位放料位置P202")] - [DisplayName("2号机2号位放料位置P202")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance2UpPlacePoint { get; set; } = new RobotPoint(); - #endregion - - - #region 上料点组 - [Category("3.机械臂上料项目")] - [Description("1号机1号位上料点组")] - [DisplayName("1号机1号位上料点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine1Entrance1UpPoints { get; set; } = new List(); - - [Category("3.机械臂上料项目")] - [Description("1号机2号位上料点组")] - [DisplayName("1号机2号位上料点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine1Entrance2UpPoints { get; set; } = new List(); - - [Category("3.机械臂上料项目")] - [Description("2号机1号位上料点组")] - [DisplayName("2号机1号位上料点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine2Entrance1UpPoints { get; set; } = new List(); - - [Category("3.机械臂上料项目")] - [Description("2号机2号位上料点组")] - [DisplayName("2号机2号位上料点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine2Entrance2UpPoints { get; set; } = new List(); - #endregion - - - #region 下料关键点位 - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机1号位取料(下料)点位置P107")] - [DisplayName("1号机1号位取料(下料)点位置P107")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance1TakeTyrePoint { get; set; } = new RobotPoint(); - - //P107点位斜向上 - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机1号位取料(下料)点位置P107斜上方")] - [DisplayName("1号机1号位取料(下料)点位置P107斜上方")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance1TakeTyreTiltUpperPoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机2号位取料(下料)点位置P207")] - [DisplayName("1号机2号位取料(下料)点位置P207")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance2TakeTyrePoint { get; set; } = new RobotPoint(); - - //P207斜上方 - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机2号位取料(下料)点位置P207斜上方")] - [DisplayName("1号机2号位取料(下料)点位置P207斜上方")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance2TakeTyreTiltUpperPoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("2号机1号位取料(下料)点位置P107")] - [DisplayName("2号机1号位取料(下料)点位置P107")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance1TakeTyrePoint { get; set; } = new RobotPoint(); - - //2号机1号位下料点斜上方 - [Category("4.机械臂取料(下料)关键点位")] - [Description("2号机1号位取料(下料)点位置P107斜上方")] - [DisplayName("2号机1号位取料(下料)点位置P107斜上方")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance1TakeTyreTiltUpperPoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机2号位取料(下料)点位置P207")] - [DisplayName("2号机2号位取料(下料)点位置P207")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance2TakeTyrePoint { get; set; } = new RobotPoint(); - - //2号机1号位下料点斜上方 - [Category("4.机械臂取料(下料)关键点位")] - [Description("2号机2号位取料(下料)点位置P207斜上方")] - [DisplayName("2号机2号位取料(下料)点位置P207斜上方")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance2TakeTyreTiltUpperPoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机1号位放置点位置P108")] - [DisplayName("1号机1号位放置点位置P108")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance1DownPlacePoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机2号位放置点位置P208")] - [DisplayName("1号机2号位放置点位置P208")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine1Entrance2DownPlacePoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("2号机1号位放置点位置P108")] - [DisplayName("2号机1号位放置点位置P108")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance1DownPlacePoint { get; set; } = new RobotPoint(); - - [Category("4.机械臂取料(下料)关键点位")] - [Description("1号机2号位放置点位置P208")] - [DisplayName("2号机2号位放置点位置P208")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotMachine2Entrance2DownPlacePoint { get; set; } = new RobotPoint(); - - #endregion - - - #region 下料点组 - [Category("5.机械臂取料(下料)项目")] - [Description("1号机1号位取料(下料)点组")] - [DisplayName("1号机1号位取料(下料)点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine1Entrance1DownPoints { get; set; } = new List(); - - [Category("5.机械臂取料(下料)项目")] - [Description("1号机2号位取料(下料)点组")] - [DisplayName("1号机2号位取料(下料)点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine1Entrance2DownPoints { get; set; } = new List(); - - [Category("5.机械臂取料(下料)项目")] - [Description("2号机1号位取料(下料)点组")] - [DisplayName("2号机1号位取料(下料)点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine2Entrance1DownPoints { get; set; } = new List(); - - [Category("5.机械臂取料(下料)项目")] - [Description("2号机2号位取料(下料)点组")] - [DisplayName("2号机2号位取料(下料)点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotMachine2Entrance2DownPoints { get; set; } = new List(); - #endregion - - - [Category("机械臂上料项目")] - [Description("路径上料移动点组")] - [DisplayName("路径上料移动点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotUpMovePoints { get; set; } = new List(); - - - [Category("机械臂上料项目")] - [Description("路径上料返回点组")] - [DisplayName("路径上料返回点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //[TypeConverter(typeof(SimpleCollectionConvert))] - public List RobotUPBackPoints { get; set; } = new List(); - - - [Category("机械臂下料项目")] - [Description("路径下料移动点组")] - [DisplayName("路径下料移动点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - public List RobotDownMovePoints { get; set; } = new List(); - - - [Category("机械臂下料项目")] - [Description("路径下料返回点组")] - [DisplayName("路径下料返回点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //[TypeConverter(typeof(SimpleCollectionConvert))] - public List RobotDownBackPoints { get; set; } = new List(); - - - [Category("机械臂下料项目")] - [Description("路径下料返回f辅助点组")] - [DisplayName("路径下料返回f辅助点组")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //[TypeConverter(typeof(SimpleCollectionConvert))] - public List ConfigRobotDownBackPoints { get; set; } = new List(); - - - [Category("机械臂项目")] - [Description("机械臂起始位置")] - [DisplayName("机械臂起始位置")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint RobotInitPosition { get; set; } = new RobotPoint(); - - - [Category("机械臂项目")] - [Description("机械臂运动点X1位")] - [DisplayName("机械臂运动点X1位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X1Point { get; set; } = new RobotPoint(); - - [Category("机械臂项目")] - [Description("机械臂运动点X2位")] - [DisplayName("机械臂运动点X2位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X2Point { get; set; } = new RobotPoint(); - - [Category("机械臂项目")] - [Description("轮胎半径")] - [DisplayName("轮胎半径")] - public string RobotTyReRadius { get; set; } - - [Category("机械臂项目")] - [Description("轮胎尺寸")] - [DisplayName("轮胎尺寸")] - // [TypeConverter(typeof(CollectionCountConvert))] - // [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //[TypeConverter(typeof(SimpleCollectionConvert))] - public string SetWhoolSize { get; set; } = "17"; - - [Category("机械臂夹爪项目")] - [Description("夹紧点")] - [DisplayName("夹紧点")] - public string GripperFastenPosition { get; set; } = "75000"; - - [Category("机械臂夹爪项目")] - [Description("放松点")] - [DisplayName("放松点")] - public string GripperLoosenPosition { get; set; } = "40000"; - - [Category("机械臂夹爪项目")] - [Description("全松点")] - [DisplayName("全松点")] - public string GripperAllLoosenPosition { get; set; } = "40000"; - - - [Category("机械臂夹爪项目")] - [Description("全紧点")] - [DisplayName("全紧点")] - public string GripperAllFastenPosition { get; set; } = "92000"; - - #region 12寸轮胎 - [Category("机械臂项目12寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel12GripperUpFasten { get; set; } = "40000"; - - [Category("机械臂项目12寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel12GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目12寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel12GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目12寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel12GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 13寸轮胎 - [Category("机械臂项目13寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel13GripperUpFasten { get; set; } = "40000"; - - [Category("机械臂项目13寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel13GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目13寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel13GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目13寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel13GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 14寸轮胎 - [Category("机械臂项目14寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel14GripperUpFasten { get; set; } = "40000"; - - [Category("机械臂项目14寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel14GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目14寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel14GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目14寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel14GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 15寸轮胎 - [Category("机械臂项目15寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel15GripperUpFasten { get; set; } = "40000"; - - [Category("机械臂项目15寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel15GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目15寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel15GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目15寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel15GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 16寸轮胎 - [Category("机械臂项目16寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel16GripperUpFasten { get; set; } = "40000"; - - [Category("机械臂项目16寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel16GripperUpLoosen { get; set; } = "75000"; - - - [Category("机械臂项目16寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel16GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目16寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel16GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 17寸轮胎 - [Category("机械臂项目17寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel17GripperUpFasten { get; set; } = "75000"; - - [Category("机械臂项目17寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel17GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目17寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel17GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目17寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel17GripperDownLoosen { get; set; } = "2000"; - #endregion - - #region 18寸轮胎 - [Category("机械臂项目18寸轮胎")] - [Description("上料夹紧点")] - [DisplayName("上料夹紧点")] - public string Wheel18GripperUpFasten { get; set; } = "75000"; - - [Category("机械臂项目18寸轮胎")] - [Description("上料放松点")] - [DisplayName("上料放松点")] - public string Wheel18GripperUpLoosen { get; set; } = "75000"; - - [Category("机械臂项目18寸轮胎")] - [Description("下料夹紧点")] - [DisplayName("下料夹紧点")] - public string Wheel18GripperDownFasten { get; set; } = "40000"; - - [Category("机械臂项目18寸轮胎")] - [Description("下料放松点")] - [DisplayName("下料放松点")] - public string Wheel18GripperDownLoosen { get; set; } = "2000"; - #endregion - - - [Category("机械臂项目")] - [Description("1号硫化机1号位")] - [DisplayName("1号硫化机1号位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X1_1Point { get; set; } = new RobotPoint(); - - [Category("机械臂项目")] - [Description("1号硫化机2号位")] - [DisplayName("1号硫化机2号位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X1_2Point { get; set; } = new RobotPoint(); - [Category("机械臂项目")] - [Description("2号硫化机1号位")] - [DisplayName("2号硫化机1号位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X2_1Point { get; set; } = new RobotPoint(); - [Category("机械臂项目")] - [Description("2号硫化机2号位")] - [DisplayName("2号硫化机2号位")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint X2_2Point { get; set; } = new RobotPoint(); - - [Category("机械臂项目")] - [Description("硫化轮胎取出位置")] - [DisplayName("硫化轮胎取出位置")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public RobotPoint TakeOutPoint { get; set; } = new RobotPoint(); - - - //[Category("机械臂项目")] - //[Description("路径移动")] - //[DisplayName("路径移动")] - - //[TypeConverter(typeof(CollectionCountConvert))] - //[Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //public List RobotMovePoints { get; set; } = new List(); - - //[Category("机械臂项目")] - //[Description("路径返回")] - //[DisplayName("路径返回")] - - //[TypeConverter(typeof(CollectionCountConvert))] - //[Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] - //public List RobotBackPoints { get; set; } = new List(); - - //[Category("驱动类型")] - //[Description("驱动类型")] - //[DisplayName("驱动类型")] - //[TypeConverter(typeof(DeviceTypeSelectorConverter))] - //public override string DriverType { get; set; } - - //[Category("机器人设置")] - //[Description("机器人通信IP")] - //[DisplayName("机器人通信IP")] - //public string RobotIP { get; set; } = "0.0.0.0"; - - //[Category("机器人设置")] - //[Description("机器人通信端口")] - //[DisplayName("机器人通信端口")] - //public int RobotPort { get; set; } - - //[Category("通信设置")] - //[Description("反馈超时设置,单位ms")] - //[DisplayName("反馈超时设置,单位ms")] - //public int ReplyTimeout { get; set; } = 1000; - - //[Category("通信设置")] - //[Description("反馈超时重试次数")] - //[DisplayName("反馈超时重试次数")] - //public int TimeoutRetryTimes { get; set; } = 5; - - //[Category("通信设置")] - //[Description("协议文本结束字符")] - //[DisplayName("协议文本结束字符")] - //public string EndChar { get; set; } = "#"; - - //[Category("通信设置")] - //[Description("协议内容分隔字符")] - //[DisplayName("协议内容分隔字符")] - //public string Seperator { get; set; } = ","; - - //[Category("动作设置")] - //[Description("动作超时设置,单位min")] - //[DisplayName("动作超时设置,单位min")] - //public float OperationTimeout { get; set; } = 1; - - - //[Category("警报配置")] - //[Description("警报配置列表")] - //[DisplayName("警报配置")] - //[TypeConverter(typeof(CollectionCountConvert))] - //[Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] - //public List WarningSetCollection { get; set; } = new List(); + + } diff --git a/src/BRS.Common.Device/DeviceBase/TCPSeverBase.cs b/src/BRS.Common.Device/DeviceBase/TCPSeverBase.cs new file mode 100644 index 0000000..5672523 --- /dev/null +++ b/src/BRS.Common.Device/DeviceBase/TCPSeverBase.cs @@ -0,0 +1,126 @@ +using BRS.Common.Base; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using STTech.BytesIO.Tcp; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BRS.Common.Base +{ + public class TCPSeverInitialConfigBase : InitialConfigBase + { + [Category("连接配置")] + [Description("远程IP地址")] + [DisplayName("远程IP")] + public string RemoteIP { get; set; } + + [Category("连接配置")] + [Description("远程端口")] + [DisplayName("远程端口")] + public int RemotePort { get; set; } + } + public abstract class TCPSeverBase : DeviceBase + { + public TCPSeverInitialConfigBase IConfig + { + get => InitialConfig as TCPSeverInitialConfigBase; + } + + + /// + /// 创建临时变量 + /// + public string KawasakiRobotResponse; + + public TcpServer server; + public event Action OnTcpDataReceived; + public event Action OnTirggeredConnectClose; + public event Action OnTirggeredConnectOpen; + protected override void Init() + { + server = new TcpServer(); + server.Host = IConfig.RemoteIP; + server.Port = IConfig.RemotePort; + + } + + protected override void Start() + { + + server.StartAsync(); + + server.Started += Server_Started; + + server.ClientConnected += Server_ClientConnected; + server.ClientDisconnected += Server_ClientDisconnected; + server.Closed += Server_Closed; + } + + protected override void Stop() + { + server.CloseAsync(); + + } + + private void Server_ClientDisconnected(object sender, STTech.BytesIO.Tcp.Entity.ClientDisconnectedEventArgs e) + { + Print($"客户端[{e.Client.Host}:{e.Client.Port}]断开连接"); + OnTirggeredConnectClose?.Invoke(); + } + + private void Server_ClientConnected(object sender, STTech.BytesIO.Tcp.Entity.ClientConnectedEventArgs e) + { + Print($"客户端[{e.Client.Host}:{e.Client.Port}]连接成功"); + OnTirggeredConnectOpen?.Invoke(); + e.Client.OnDataReceived += Client_OnDataReceived; + // e.Client.UseHeartbeatTimeout(3000); + } + + private void Client_OnDataReceived(object sender, STTech.BytesIO.Core.Entity.DataReceivedEventArgs e) + { + TcpClient tcpClient = (TcpClient)sender; + //Print($"来自客户端[{tcpClient.RemoteEndPoint}]的消息: {e.Data.EncodeToString("GBK")}"); + OnTcpDataReceived?.Invoke(e.Data); + //foreach (TcpClient client in server.Clients) + //{ + // if (client != tcpClient) + // { + // client.SendAsync(e.Data); + // } + //} + } + + + + private void Server_Closed(object sender, EventArgs e) + { + // TcpClient tcpClient = (TcpClient)sender; + + // Print("停止监听"); + } + + private void Server_Started(object sender, EventArgs e) + { + TcpClient tcpClient = (TcpClient)sender; + // tcpClient.Connect(); + //Print("开始监听"); + } + + + private void Print(string msg) + { + //tbLog.AppendText($"[{DateTime.Now}] {msg}\r\n"); + } + public void SendMessage(string msg) + { + foreach (TcpClient client in server.Clients) + { + byte[] sendBuff = System.Text.Encoding.ASCII.GetBytes(msg); + client.SendAsync(sendBuff); + } + } + + } +} diff --git a/src/BRS.Common.Device/app.config b/src/BRS.Common.Device/app.config index 4cd8ed8..e26e9d3 100644 --- a/src/BRS.Common.Device/app.config +++ b/src/BRS.Common.Device/app.config @@ -1,19 +1,19 @@ - + - - + + - - + + - - + + - + diff --git a/src/BRS.Common.Device/packages.config b/src/BRS.Common.Device/packages.config index 2d58c8d..12d9610 100644 --- a/src/BRS.Common.Device/packages.config +++ b/src/BRS.Common.Device/packages.config @@ -4,6 +4,9 @@ + + + diff --git a/src/BRS.Common.Model/BRS.Common.Model.csproj b/src/BRS.Common.Model/BRS.Common.Model.csproj index d14bdd5..29d83bc 100644 --- a/src/BRS.Common.Model/BRS.Common.Model.csproj +++ b/src/BRS.Common.Model/BRS.Common.Model.csproj @@ -1,6 +1,6 @@  - + Debug @@ -95,7 +95,7 @@ ..\..\packages\OpenCvSharp4.4.6.0.20220608\lib\netstandard2.0\OpenCvSharp.dll - ..\..\packages\OpenCvSharp4.Extensions.4.6.0.20220608\lib\netstandard2.0\OpenCvSharp.Extensions.dll + ..\..\packages\OpenCvSharp4.Extensions.4.5.5.20211231\lib\netstandard2.0\OpenCvSharp.Extensions.dll @@ -259,6 +259,6 @@ 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + \ No newline at end of file diff --git a/src/BRS.Common.Model/Helper/EnumHelper.cs b/src/BRS.Common.Model/Helper/EnumHelper.cs index 55f8d05..4b669b2 100644 --- a/src/BRS.Common.Model/Helper/EnumHelper.cs +++ b/src/BRS.Common.Model/Helper/EnumHelper.cs @@ -519,6 +519,19 @@ namespace BRS.Common.Model.Helper CameraRelativeMove = 12, } + public enum DownCirce + { + Unknown = 0, + /// + /// 标志着机械臂正在运动的状态 + /// + DownCirce, + /// + /// 标志着机械臂运动完成的状态 + /// + DownCirceRuning, + } + /// /// 马达/运动板卡运行模式 /// @@ -677,7 +690,67 @@ namespace BRS.Common.Model.Helper [Description("更新批次信息")] RequestBatchNO, } + public enum ProcessStatus + { + Unknown = 0, + PlcInit, + /// + /// 第七轴运动或者示教点移动 + /// + Init, + /// + /// 第七轴移动到位 + /// + InitPlc, + PMoldReady, + PPLCRobotInit, + MoveInit_Y, + MoveInit, + + /// + /// 机械臂相机离目标螺丝测距30CM + /// + Measure, + /// + /// 打开光源 + /// + OpenLight, + /// + /// 关闭光源 + /// + ClodeLight, + /// + /// 视觉定位 + /// + CVLocation, + /// + /// 拧紧轴发送启动命令 + /// + StartRun, + StartRunDown, + /// + /// 循环拧送螺丝 + /// + StartRuning, + Finish, + /// + /// 完成拧松螺丝并对下一螺丝做准备工作 + /// + RobotFinish, + /// + /// 机器人下电 所有第七轴回归初始位置 + /// + RobotPLCInit, + /// + /// 回归初始位置完成,流程结束 + /// + RobotPLCInitFinish, + ALLFinish, + Warning, + Waiting, + WaitingZLS, + } public enum MachineState { Unknown = 0, @@ -717,56 +790,68 @@ namespace BRS.Common.Model.Helper ClearProduct , } - + /// + /// 川崎机器人的状态,运动停止或者正在进行 + /// + public enum KawasakiRobotStatus + { + Unknown = 0, + /// + /// 机械臂正在运动的状态 + /// + Stoped, + /// + /// 机械臂运动完成的状态 + /// + Runing, + } public enum RobotsStatus { Unknown = 0, - Inplace , - Claming, - Relasing, - Moving , - Wating , - Pweroff, - Reset , - + PowerOn, + Move, + /// + /// 机械臂运动状态 + /// + Runing, + /// + /// 机械臂空闲状态 + /// + Release, + MoveInit, + PowerOff, + } - public enum ProcessStatus + public enum PLCStateWarm { Unknown = 0, /// - /// 初始化点 + /// 急停红灯 /// - Init, - - MesureingInit, - MesureingInitPLC, - Mesureing , - MesureingPLC, - Claim , - ClaimPLC, - Runing , - RunFinish, - Loosen, - LoosenPLC, - TakeOffMove, - TakeOffMovePLC, - TakeOffMovePLC_2, - TakeOff,/// - /// 取出轮胎 - /// - /// - TakeOffCaim, - TakeOffPLC, - TakeOffPoint, - TakeOffPointCaim, - TakeOffPointCaimFlag, - TakeOffWhool, - Resetting , - Closing , - ClearProduct , - } + ProStop, + /// + /// 程序运行绿灯 + /// + Running, + /// + /// 手动模式 + /// + HandModel, + /// + /// 自动模式 + /// + ResetModel, + /// + /// 程序不运行 + /// + Alarm, + XianWeiAram, + Robot1LeftAlarm, + Robot1RightAlarm, + + } public enum ResultState { diff --git a/src/BRS.Common.Model/Interface/IProcessConfig.cs b/src/BRS.Common.Model/Interface/IProcessConfig.cs index 3de7d95..b3bce79 100644 --- a/src/BRS.Common.Model/Interface/IProcessConfig.cs +++ b/src/BRS.Common.Model/Interface/IProcessConfig.cs @@ -38,8 +38,8 @@ namespace BRS.Common.Interface List PLCConfigCollection { get; set; } List DeviceConfigs { get; set; } - - List RobotConfigCollection { get; set; } + List KawasakiRobotConfigCollection { get; set; } + //List RobotConfigCollection { get; set; } #endregion diff --git a/src/BRS.Common.Model/Model/CustomizedPoint.cs b/src/BRS.Common.Model/Model/CustomizedPoint.cs index 537604d..eb0a9a5 100644 --- a/src/BRS.Common.Model/Model/CustomizedPoint.cs +++ b/src/BRS.Common.Model/Model/CustomizedPoint.cs @@ -7,6 +7,7 @@ using System.ComponentModel; using System.Drawing; using System.Threading.Tasks; using static BRS.Common.Model.Helper.EnumHelper; +using System.Drawing.Design; namespace BRS.Common.Model { @@ -716,6 +717,157 @@ namespace BRS.Common.Model public float B; public float C; } + public class CQRobotPoint : IComplexDisplay + { + [Category("点位信息")] + [Description("坐标X")] + public float X { get; set; } + + [Category("点位信息")] + [Description("坐标Y")] + public float Y { get; set; } + + [Category("点位信息")] + [Description("坐标Z")] + public float Z { get; set; } + + [Category("点位信息")] + [Description("角度O")] + public float O { get; set; } + + [Category("点位信息")] + [Description("角度A")] + public float A { get; set; } + + [Category("点位信息")] + [Description("角度T")] + public float T { get; set; } + + public string GetDisplayText() + { + return $"X:{X.ToString()} Y:{Y.ToString()} Z:{Z.ToString()} O:{O.ToString()} A:{A.ToString()} T:{T.ToString()}"; + } + + public double[] GetArray() + { + return new double[] { X, Y, Z, O, A, T }; + } + + public static CQRobotPoint GetRobotPointByArray(double[] array) + { + if (array.Length != 6) + { + return null; + } + + CQRobotPoint point = new CQRobotPoint + { + X = (float)array[0], + Y = (float)array[1], + Z = (float)array[2], + O = (float)array[3], + A = (float)array[4], + T = (float)array[5] + }; + + return point; + } + + public static float GetDistance(RobotPoint pointA, RobotPoint pointB) + { + return (float)Math.Sqrt(Math.Pow(pointA.X - pointB.X, 2) + Math.Pow(pointA.Y - pointB.Y, 2) + Math.Pow(pointA.Z - pointB.Z, 2)); + } + } + public class VPVRPoint : IComplexDisplay + { + + [Category("点位信息")] + [Description("坐标X")] + public float X { get; set; } + + [Category("点位信息")] + [Description("坐标Y")] + public float Y { get; set; } + + [Category("点位信息")] + [Description("坐标Z")] + public float Z { get; set; } + public string GetDisplayText() + { + return $"X:{X.ToString()} Y:{Y.ToString()} Z:{Z.ToString()}"; + } + } + public class XYPoint : IComplexDisplay + { + + [Category("点位信息")] + [Description("坐标X")] + public float X { get; set; } + + [Category("点位信息")] + [Description("坐标Y")] + public float Y { get; set; } + + + public string GetDisplayText() + { + return $"X:{X.ToString()} Y:{Y.ToString()} "; + } + } + public class DiffVPVRPoint : IComplexDisplay + { + [Category("标定组类型ID*")] + [Description("标定组类型ID")] + //[TypeConverter(typeof(DeviceIdSelectorConverter))] + [DisplayName("标定组类型ID")] + public int CVTypeID { get; set; } + + + [Category("点位信息")] + [Description("坐标X")] + public float X { get; set; } + + [Category("点位信息")] + [Description("坐标Y")] + public float Y { get; set; } + + [Category("点位信息")] + [Description("坐标Z")] + public float Z { get; set; } + + [Category("第七轴")] + [Description("第七轴")] + public float SevenDis { get; set; } + + [Category("是否启动第七轴配置")] + [Description("是否启用")] + [DisplayName("是否启用")] + public bool SevenDisIsLSEnabled { get; set; } = false; + + [Category("是否是两端特殊螺丝")] + [Description("是否启用")] + [DisplayName("是否启用")] + public bool SpecialIsLSEnabled { get; set; } = false; + + + [Category("特别螺丝配置")] + [Description("是否启用")] + [DisplayName("是否启用")] + public bool IsLSEnabled { get; set; } = false; + + [Category("特别螺丝配置")] + [Description("特别螺丝配置")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + [DisplayName("特别螺丝配置")] + public List CVCalibrationConfig { get; set; } = new List(); + public string GetDisplayText() + { + return $"X:{X.ToString()} Y:{Y.ToString()} Z:{Z.ToString()}"; + } + } + + public class RobotPoint : IComplexDisplay { [Category("点位信息")] diff --git a/src/BRS.Common.Model/Model/DeviceOpBind.cs b/src/BRS.Common.Model/Model/DeviceOpBind.cs index aa3b86e..a25c220 100644 --- a/src/BRS.Common.Model/Model/DeviceOpBind.cs +++ b/src/BRS.Common.Model/Model/DeviceOpBind.cs @@ -14,8 +14,79 @@ using System.Windows.Forms.Design; namespace BRS.Common.Model { + public class CVCalibrationConfig : IComplexDisplay + { + + [Category("标定组类型ID")] + [Description("标定组类型ID")] + //[TypeConverter(typeof(DeviceIdSelectorConverter))] + [DisplayName("标定组类型ID")] + public int CVTypeID { get; set; } + + [Category("相机标定设置")] + [Description("示教拍摄点")] + [DisplayName("示教拍摄点")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + //[TypeConverter(typeof(SimpleCollectionConvert))] + public List SHIJIao_deviation { get; set; } = new List(); + + [Category("相机标定设置")] + [Description("VP点组")] + [DisplayName("VP点组")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + //[TypeConverter(typeof(SimpleCollectionConvert))] + public List VPPoints { get; set; } = new List(); + + + [Category("相机标定设置")] + [Description("VR点组")] + [DisplayName("VR点组")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + //[TypeConverter(typeof(SimpleCollectionConvert))] + public List VRPoints { get; set; } = new List(); + + public string GetDisplayText() + { + return $"标定组类型ID:{CVTypeID.ToString()}"; + } + } + + public class DeviceModel : IComplexDisplay + { + [Category("模具类型")] + [Description("模具类型")] + //[TypeConverter(typeof(DeviceIdSelectorConverter))] + [DisplayName("模具类型")] + public string DeviceModelType { get; set; } + + [Category("视觉标定配置")] + [Description("视觉标定配置")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + [DisplayName("视觉标定配置")] + public List CVCalibrationConfig { get; set; } = new List(); + + + [Category("机械臂A配置项")] + [Description("偏移量:标定点减去拍摄点的坐标是偏移量")] + [DisplayName("偏移量")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + //[TypeConverter(typeof(SimpleCollectionConvert))] + public List A_deviation { get; set; } = new List(); + + public string GetDisplayText() + { + return $"模具类型:{DeviceModelType} "; + } + } + public class DeviceOpBind : IComplexDisplay { + [Category("设备名称")] [Description("设备名称")] [TypeConverter(typeof(DeviceIdSelectorConverter))] diff --git a/src/BRS.Common.Model/app.config b/src/BRS.Common.Model/app.config index 4cd8ed8..e26e9d3 100644 --- a/src/BRS.Common.Model/app.config +++ b/src/BRS.Common.Model/app.config @@ -1,19 +1,19 @@ - + - - + + - - + + - - + + - + diff --git a/src/BRS.Common.Model/packages.config b/src/BRS.Common.Model/packages.config index 3de1064..ab6c8fb 100644 --- a/src/BRS.Common.Model/packages.config +++ b/src/BRS.Common.Model/packages.config @@ -3,8 +3,9 @@ - - + + + diff --git a/src/BRS.Process.A020/A020Config.cs b/src/BRS.Process.A020/A020Config.cs index bf11f28..359c95a 100644 --- a/src/BRS.Process.A020/A020Config.cs +++ b/src/BRS.Process.A020/A020Config.cs @@ -22,7 +22,13 @@ namespace BRS.Process.A020 //[Description("OverdueDay:数据库保存天数,超出该值,则认为数据过期,会被清理")] //public int OverdueDay { get; set; } = 14; + [Category("流程动作配置")] + [Description("流程开始操作配置")] + [DisplayName("流程开始操作配置")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] + public List ProcessInitialOps { get; set; } = new List(); // [Category("触发配置")] //[Description("检测取像相关设置")] @@ -123,8 +129,8 @@ namespace BRS.Process.A020 //public int FullResetRequiredDuration { get; set; } = 3; - - + + } diff --git a/src/BRS.Process.A020/A020Process.cs b/src/BRS.Process.A020/A020Process.cs index ed43c8e..43a24f2 100644 --- a/src/BRS.Process.A020/A020Process.cs +++ b/src/BRS.Process.A020/A020Process.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Text; @@ -91,6 +92,9 @@ namespace BRS.Process.A020 #region event public event Action OnMachineStateChanged; + public event Action OnPLCStateChanged; + + public event Action OnBitmapChanged; #endregion #region ProcessControl diff --git a/src/BRS.Process.A020/A020Process_MachineState.cs b/src/BRS.Process.A020/A020Process_MachineState.cs index 3c00901..bf9e6e8 100644 --- a/src/BRS.Process.A020/A020Process_MachineState.cs +++ b/src/BRS.Process.A020/A020Process_MachineState.cs @@ -15,7 +15,10 @@ namespace BRS.Process.A020 { object machineStateLock = new object(); //object machineStateLock_R = new object(); + PLCStateWarm pLCStateWarm = PLCStateWarm.Unknown; MachineState machineState = MachineState.Unknown; + + DownCirce downCirce = DownCirce.Unknown; //MachineState machineState_R = MachineState.Unknown; public MachineState MachineState { @@ -134,17 +137,24 @@ namespace BRS.Process.A020 } } - WhoolSize whoolSize = WhoolSize.Size17; - public WhoolSize WhoolSize + public PLCStateWarm PLCStateWarm { - get => whoolSize; + get => pLCStateWarm; set { - whoolSize = value; + pLCStateWarm = value; } } - + KawasakiRobotStatus kawasakiRobotStatus = KawasakiRobotStatus.Unknown; + public KawasakiRobotStatus KawasakiRobotStatus + { + get => kawasakiRobotStatus; + set + { + kawasakiRobotStatus = value; + } + } MachineStateStep machineStateStep = MachineStateStep.Unknown; @@ -344,6 +354,32 @@ namespace BRS.Process.A020 } #endregion + public string MoveMoreNContinueRobot(List strPoints, ref StrRobotPoint CurrentPoint) + { + string strPointsStr = null; + for (int i = 0; i < strPoints.Count; i++) + { + string pointsStr = Convert.ToString(strPoints[i].X) + "," + Convert.ToString(strPoints[i].Y) + "," + Convert.ToString(strPoints[i].Z) + "," + + Convert.ToString(strPoints[i].A) + "," + Convert.ToString(strPoints[i].B) + "," + Convert.ToString(strPoints[i].C); + strPointsStr += pointsStr + "_"; + } + CurrentPoint = strPoints[strPoints.Count - 1]; + // string pointsStr2 = Convert.ToString(strPoint2.X) + "," + Convert.ToString(strPoint2.Y) + "," + Convert.ToString(strPoint2.Z) + "," + + //Convert.ToString(strPoint2.O) + "," + Convert.ToString(strPoint2.A) + "," + Convert.ToString(strPoint2.T); + string STRMove = "MoveLine_NULL_" + strPoints.Count.ToString() + "_" + strPointsStr; + //string PointInit1 = "MoveLine_NULL_1_462.915,1119.150,1530.227,90.043,90.003,0.040_"; + return STRMove; + } + + + public DownCirce DownCirce + { + get => downCirce; + set + { + downCirce = value; + } + } public override async Task RaisedAlarm(IWarningSet warningSet) { @@ -407,7 +443,7 @@ namespace BRS.Process.A020 warningSet.WarningCode = "急停按钮被拍下"; warningSet.WarningLvl = -1; warningSet.WarningDescription = "急停按钮被拍下"; - RobotsStatus = RobotsStatus.Pweroff; + RobotsStatus = RobotsStatus.PowerOff; MachineStateStep = MachineStateStep.Pause; RaisedAlarm(warningSet); } diff --git a/src/BRS.Process.A020/A020Process_Operation.cs b/src/BRS.Process.A020/A020Process_Operation.cs index ab73594..7d1ba30 100644 --- a/src/BRS.Process.A020/A020Process_Operation.cs +++ b/src/BRS.Process.A020/A020Process_Operation.cs @@ -3,7 +3,6 @@ using BRS.Common.Interface; using BRS.Common.Model; using BRS.Common.Model.Helper; using BRS.Common.PubSub; -using BRS.Device.OmronPLC; using System; using System.Collections.Generic; using System.Linq; @@ -12,8 +11,11 @@ using Timer = System.Threading.Timer; using static BRS.Common.Model.Helper.EnumHelper; using System.Diagnostics; using System.Threading; - - +using HZH_Controls; +using XKRS.Device.TCPSever; +using OpenCvSharp; +using System.Drawing; +using ThridLibray; namespace BRS.Process.A020 { public partial class A020Process @@ -21,853 +23,400 @@ namespace BRS.Process.A020 private bool IsTesting { get; set; } = false; public bool IsSingleStepOperating { get; set; } = false; - //切换硫化机手自动状态 - public void Machine1SwitchAutoManual(bool isAuto) + int ShiJiaoVecCountFlag1 = 0;// 相机1的示教点索引 + float A_Distance_DisD = 0;//拧紧轴推进距离100 + + + DeviceModel AModeTypeRun = new DeviceModel();//相机机械臂全局配置(务必要有) + private void StopMachineClosing(PLCBase MelsecPlc, TCPSeverBase TcpSeverBase1) { - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - if (OmronPlc == null) - return; - if (isAuto) - ProcessWriteInt(OmronPlc, "D103", "int", "1"); - else - ProcessWriteInt(OmronPlc, "D103", "int", "0"); - } -#if false - - public void Machine1Entrance1Up(int tyreSize) - { - // 设置设备 - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - - GripperInit(OmronPlc);//夹爪复位 - NbtRobotInit(NbtRobot);//机械臂复位 - - LogAsync(DateTime.Now, LogLevel.Detail, "开始进行上料过程"); - - PlcAddress addrs = new PlcAddress(); - string addrD09 = addrs.AddrMachine1MoldOpenInPlace;//1硫化机开模到位 - string addrD101 = addrs.AddrMachine1InnerPressureLight;//硫化完成 - string addrD81 = addrs.AddrMachine1Tyre1InPlace;//1号位轮胎就位 - - RobotPoint robotPointInitPos = NbtRobot.IConfig.RobotInitPosition;//初始位置 - StrRobotPoint initPoint = ClassChangeStruct(robotPointInitPos); - - RobotPoint robotPointMachine1Entrance1GrabPos = NbtRobot.IConfig.RobotMachine1Entrance1GrabPoint;//M1E1上料抓取点 - RobotPoint robotPointMachine1Entrance1UpPlacePos = NbtRobot.IConfig.RobotMachine1Entrance1UpPlacePoint;//M1E1上料放置点 - - //判断是否硫化完成 - string machine1VulcanStateD101 = ProcessReadInt(OmronPlc, addrD101, "int"); - //1号位硫化机开模到位状态,为1时:硫化机开模到位可以进行上下料动作 - string machine1OpenReadyStateD09 = ProcessReadInt(OmronPlc, addrD09, "int"); - - string machine1Entrance1TyreReadyStateD81 = ProcessReadInt(OmronPlc, addrD81, "int"); - - int Machine1Entrance1TyreSize = tyreSize; - - Task.Run(() => + if (MelsecPlc != null && MelsecPlc.InitialConfig.IsEnabled) { - //1号位上料,判断以下状态:D101:硫化完成、M1E1Enabled、D09:开模到位 - //if (machine1VulcanStateD101 == "0" && machine1OpenReadyStateD09 == "1") - if (machine1VulcanStateD101 == "0") + //Process_A020.ProcessWriteInt(MelsecPlc, "D241", "int", "0");//开始 + } + if (TcpSeverBase1 != null && TcpSeverBase1.InitialConfig.IsEnabled == true) + { + TcpSeverBase1.SendMessage("PowerOFF_");//机械臂获取状态 + } + } +#if true + #region 相机标定 + + MyPoint sswF = new MyPoint(); + List VP = new List(); + List VR = new List(); + #region 相机1 + /* 设备对象 */ + private ThridLibray.IDevice m_dev; + Mat Mat_CamA = new Mat(); + Bitmap Bit_Image = null; + // private ThridLibray.IDevice m_dev1; + // private ThridLibray.IDevice m_dev2; + List m_frameList = new List(); /* 图像缓存列表 */ + Thread renderThread = null; /* 显示线程 */ + bool m_bShowLoop = true; /* 线程控制变量 */ + Mutex m_mutex = new Mutex(); /* 锁,保证多线程安全 */ + // private Graphics _g = null; + bool m_bShowByGDI; + + public void OpenCam1() + { + + try + { + /* 设备搜索 */ + List li = Enumerator.EnumerateDevices(); + if (li.Count > 0) { - //读D81:1号上料抓取位胎坯就位,等待D81置1胎胚就位 - //while (machine1Entrance1TyreReadyStateD81 == "0") - //{ - // Thread.Sleep(1000); - // machine1Entrance1TyreReadyStateD81 = ProcessReadInt(OmronPlc, addrD81, "int"); - //} + string IP = "192.168.1.111"; + /* 获取搜索到的第一个设备 */ + // m_dev = Enumerator.GetDeviceByIndex(0); + m_dev = Enumerator.GetDeviceByGigeIP(IP); - LogAsync(DateTime.Now, LogLevel.Detail, "1号位胎胚就位,开始上料流程。"); - #region 1号机1号位上料流程 - //去抓料 - StrRobotPoint pointMachine1Entrance1GrabPos = ClassChangeStruct(robotPointMachine1Entrance1GrabPos); - StrRobotPoint pointMachine1Entrance1GrabPosUpper = pointMachine1Entrance1GrabPos; - pointMachine1Entrance1GrabPosUpper.Z = pointMachine1Entrance1GrabPos.Z + 200; - //运动到抓取点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance1GrabPosUpper, 1000); - ////夹爪运动到全松点 - //GripperMove(OmronPlc, NbtRobot.IConfig.GripperAllLoosenPosition); - NbtRobotMove(NbtRobot, pointMachine1Entrance1GrabPos, 1000);//移动到抓取点 - //夹爪夹紧 - string M1E1UpFastenPos = GetGripperPosByTyreSize(NbtRobot, Machine1Entrance1TyreSize, MoveState.UpFasten);//获取上料夹紧点 - if (M1E1UpFastenPos == "error") + /* 打开设备 */ + if (!m_dev.Open()) { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - return; - } - else - GripperMove(OmronPlc, M1E1UpFastenPos);//夹爪运动 - - //抓取轮胎后,根据预设点位移动到上料口 - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance1UpPoints, 1000, false); - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂移动到Machine1Entrance1上料口"); - - //运动到放料点 - StrRobotPoint pointMachine1Entrance1UpPlace = ClassChangeStruct(robotPointMachine1Entrance1UpPlacePos);//放料点 - StrRobotPoint pointMachine1Entrance1UpPlaceUpper = pointMachine1Entrance1UpPlace;//放料点上方200 - pointMachine1Entrance1UpPlaceUpper.Z = pointMachine1Entrance1UpPlace.Z + 200; - //运动到放料点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance1UpPlaceUpper, 1000); - //移动到放料点同时,硫化机上环升 - //VulcanizaMachineOperateOnce(OmronPlc, "D127", 5000);//上环升,硫化机程序内设置保持5S - - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1");//上环保持上升状态 - Thread.Sleep(2000); - NbtRobotMove(NbtRobot, pointMachine1Entrance1UpPlace, 1000);//运动到放料点 - - //上定型5秒,其中第2秒时松夹爪、机械臂移动出 - ProcessWriteInt(OmronPlc, "D113", "int", "0");//115改为113 - Thread.Sleep(500); - ProcessWriteInt(OmronPlc, "D113", "int", "1"); - Thread.Sleep(500); - - //第2秒时,松夹爪、机械臂移动 - //夹爪放松 - string M1E1UpLoosenPos = GetGripperPosByTyreSize(NbtRobot, Machine1Entrance1TyreSize, MoveState.UpLoosen);//获取上料放松点 - if (M1E1UpLoosenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - return; - } - else - GripperMove(OmronPlc, M1E1UpLoosenPos);//夹爪运动 - - - - //运动到放料点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance1UpPlaceUpper, 1000); - - //上定型结束 - ProcessWriteInt(OmronPlc, "D113", "int", "0"); - Thread.Sleep(500); - - VulcanizaMachineOperateKeep(OmronPlc, "D127", "0");//定型结束后,上环降。 - - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, "D109", 500); - //料仓门口点 - StrRobotPoint pointM1E1SiloDoor = ClassChangeStruct(NbtRobot.IConfig.RobotMachine1Entrance1UpPoints[3]); - //运动到料仓门口 - NbtRobotMove(NbtRobot, pointM1E1SiloDoor, 1000); - - //检测机械臂是否移动到料仓外 - StrRobotPoint currentP; - if (IsTesting) - currentP = pointM1E1SiloDoor; - else - currentP = NbtRobot.GetPosition(); - - if (!IsNumApproximateEqual(currentP.X, pointM1E1SiloDoor.X, 0.5f) || - !IsNumApproximateEqual(currentP.Y, pointM1E1SiloDoor.Y, 0.5f) || - !IsNumApproximateEqual(currentP.Z, pointM1E1SiloDoor.Z, 0.5f) || - !IsNumApproximateEqual(currentP.A, pointM1E1SiloDoor.A, 0.5f) || - !IsNumApproximateEqual(currentP.B, pointM1E1SiloDoor.B, 0.5f) || - !IsNumApproximateEqual(currentP.C, pointM1E1SiloDoor.C, 0.5f)) - { - LogAsync(DateTime.Now, LogLevel.Exception, "机械臂位置错误,可能未移动出料仓,当前流程停止"); - IsSingleStepOperating = false; + // MessageBox.Show(@"连接相机失败"); return; } - //硫化机进入自动状态,0为手动,1为自动 - ProcessWriteInt(OmronPlc, "D103", "int", "1"); - //硫化机合模 - VulcanizaMachineOperateOnce(OmronPlc, "D105", 500); + /* 打开Software Trigger */ + m_dev.TriggerSet.Open(TriggerSourceEnum.Software); - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance1UpPoints, 1000, true);//从料仓门口回原点 - GripperInit(OmronPlc);//夹爪复位 - LogAsync(DateTime.Now, LogLevel.Detail, "夹爪复位"); - //二号位不可用时,只硫化一号位 - NbtRobotMove(NbtRobot, initPoint, 1000);//回原点 - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂回原点,夹爪回原点。"); + /* 设置图像格式 */ + using (IEnumParameter p = m_dev.ParameterCollection[ParametrizeNameSet.ImagePixelFormat]) + { + p.SetValue("BayerRG8"); + } + + /* 设置曝光 */ + using (IFloatParameter p = m_dev.ParameterCollection[ParametrizeNameSet.ExposureTime]) + { + p.SetValue(1000); + } + + /* 设置增益 */ + using (IFloatParameter p = m_dev.ParameterCollection[ParametrizeNameSet.GainRaw]) + { + p.SetValue(1.0); + } + + /* 设置缓存个数为8(默认值为16) */ + m_dev.StreamGrabber.SetBufferCount(1); + + /* 注册码流回调事件 */ + m_dev.StreamGrabber.ImageGrabbed += OnImageGrabbed; + + /* 开启码流 */ + if (!m_dev.GrabUsingGrabLoopThread()) + { + // MessageBox.Show(@"开启码流失败"); + return; + } + } + } + catch (Exception exception) + { + Catcher.Show(exception); + } + } + + public void SoftTrigger1() + { + try + { + m_dev.ExecuteSoftwareTrigger(); + LogAsync(DateTime.Now, LogLevel.Action, $"SoftTrigger1——111111111111"); + } + catch (Exception exception) + { + Catcher.Show(exception); + } + } + bool CamA = false; + private void OnImageGrabbed(Object sender, GrabbedEventArgs e) + { + Mat_CamA = null; + m_mutex.WaitOne(); + m_frameList.Add(e.GrabResult.Clone()); + m_mutex.ReleaseMutex(); + + + IGrabbedRawData frame = m_frameList.ElementAt(m_frameList.Count - 1); + var bitmap = frame.ToBitmap(false); + Bit_Image = bitmap; + Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap);//用bitmap转换为mat + Mat_CamA = mat.Clone(); + LogAsync(DateTime.Now, LogLevel.Action, $"OnImageGrabbed Cam——222222222222"); + CamA = true; + + // Mat ss = Mat_CamA.Clone(); + // Cv2.ImWrite("D",ss); + + } #endregion - LogAsync(DateTime.Now, LogLevel.Detail, "1号位上料完成。"); - } - else - { - LogAsync(DateTime.Now, LogLevel.Error, "硫化未完成或硫化机未开模到位。"); - IsSingleStepOperating = false; - return; - } - IsSingleStepOperating = false; - }); - } - public void Machine1Entrance1Down(int tyreSize) + + public Mat AloghitomMat(Mat mat, ref MyPoint myPoint) { - // 设置设备 - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - GripperInit(OmronPlc);//夹爪复位 - NbtRobotInit(NbtRobot);//机械臂复位 + Mat src = mat.Clone(); + // Mat src = Cv2.ImRead("D:\\163033934.jpg"); + Mat[] channels; + Mat bChannel, gChannel, rChannel; - LogAsync(DateTime.Now, LogLevel.Detail, "开始进行下料过程"); - - PlcAddress addrs = new PlcAddress(); - string addrD101 = addrs.AddrMachine1InnerPressureLight;//硫化完成指示灯 - string addrD103 = addrs.AddrMachine1AutoManual;//切换手自动 - string addrD107 = addrs.AddrMachine1OpenMold;//开模 - string addrD109 = addrs.AddrMachine1Stop;//停止 - string addrD113 = addrs.AddrMachine1UpperStereotypes;//上定型 - string addrD117 = addrs.AddrMachine1AllStereotypes;//总定型 - string addrD125 = addrs.AddrMachine1Vacuumize;//抽真空 - string addrD127 = addrs.AddrMachine1UpperRingRise;//上环升 - - RobotPoint robotPointInitPos = NbtRobot.IConfig.RobotInitPosition;//初始位置 - StrRobotPoint initPoint = ClassChangeStruct(robotPointInitPos); - - RobotPoint robotPointMachine1Entrance1TakeTyrePos = NbtRobot.IConfig.RobotMachine1Entrance1TakeTyrePoint;//M1E1取料点 - RobotPoint robotPointMachine1Entrance1DownPlacePos = NbtRobot.IConfig.RobotMachine1Entrance1DownPlacePoint;//M1E1取料放置点 - RobotPoint robotPointMachine1Entrance1TakeTyreTiltUpperPos = NbtRobot.IConfig.RobotMachine1Entrance1TakeTyreTiltUpperPoint;//M1E1P107斜向上移动 + //float rr= src.At(1430, 888).Item0; + //float gg = src.At(1430, 888).Item1; + //float bb = src.At(1430, 888).Item2; + Cv2.Split(src, out channels); + bChannel = channels[0]; + gChannel = channels[1]; + rChannel = channels[2]; + Mat mDst = bChannel.Clone(); - //判断是否硫化完成 - string machine1VulcanStateD101 = ProcessReadInt(OmronPlc, addrD101, "int"); - - Task.Run(() => + for (int i = 0; i < bChannel.Height; i++)//遍历所有像素点 { - //开模,从界面操作,默认已处于开模状态,不再进行开模 - //VulcanizaMachineOperateOnce(OmronPlc, addrD107, 500); - //延时10秒 - //Thread.Sleep(10000); - //硫化机自动切换为手动,0为手动,1为自动 - ProcessWriteInt(OmronPlc, addrD103, "int", "0"); - //硫化机进行总定型动作,总定型3s - VulcanizaMachineOperateOnce(OmronPlc, addrD117, 3000); - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, addrD109, 500); - //硫化机进行抽真空动作,抽真空4s - VulcanizaMachineOperateOnce(OmronPlc, addrD125, 7000); - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, addrD109, 500); - - //移动到初始点 - NbtRobotMove(NbtRobot, initPoint, 1000); - - LogAsync(DateTime.Now, LogLevel.Detail, "开始1号位下料流程。"); - - //机械臂 从初始点移动到1号位料仓门口 - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance1DownPoints, 1000, false); - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂移动到Machine1Entrance1料仓门口"); - - //移动到取料点上方220 - StrRobotPoint strM1E1TakePoint = ClassChangeStruct(robotPointMachine1Entrance1TakeTyrePos);//取料点 - StrRobotPoint strM1E1TakePointUpper = strM1E1TakePoint;//取料点上方 - strM1E1TakePointUpper.Z = strM1E1TakePoint.Z + 350; - NbtRobotMove(NbtRobot, strM1E1TakePointUpper, 1000);//移动到取料点上方220 - - LogAsync(DateTime.Now, LogLevel.Detail, $"当前轮胎尺寸:{tyreSize}"); - - //夹爪运动到下料夹紧点,夹爪(D31,D33)夹紧 - string M1E1DownFastenPos = GetGripperPosByTyreSize(NbtRobot, tyreSize, MoveState.DownFasten); - if (M1E1DownFastenPos == "error") + for (int j = 0; j < bChannel.Width; j++) { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; + Vec3b RGBColor = src.Get(i, j); + byte colorB = RGBColor.Item0; + byte colorR = RGBColor.Item2; + float iDif = colorB - colorR; + if (iDif > 100) + mDst.Set(i, j, 255); + else + mDst.Set(i, j, 0); } - else - GripperMove(OmronPlc, M1E1DownFastenPos);//夹爪运动 + } - //移动到取料点 - NbtRobotMove(NbtRobot, strM1E1TakePoint, 500); + //Cv2.Threshold(bChannel, mDst, 150, 255, 0);//todo - //夹爪运动到下料放松点,夹爪(D31,D33)扩张 - //同时开始上定型 - string M1E1DownLoosenPos = GetGripperPosByTyreSize(NbtRobot, tyreSize, MoveState.DownLoosen); - if (M1E1DownLoosenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; + OpenCvSharp.Point point = new OpenCvSharp.Point(-1, -1); - return; - } - else - GripperMove(OmronPlc, M1E1DownLoosenPos);//夹爪运动 + OpenCvSharp.Size size = new OpenCvSharp.Size(5, 5); + Mat element = Cv2.GetStructuringElement(MorphShapes.Rect, size, point); + //getStructuringElement(cv::MORPH_RECT, cv::Size(5, 5), cv::Point(-1, -1)); + Cv2.Dilate(mDst, mDst, element); + // cv::dilate(mDst, mDst, element); + Cv2.Erode(mDst, mDst, element); + Vec4i[] hierarchy; - //先移动到夹爪水平或上挑的点 - StrRobotPoint strM1E1TakeTiltUpperPoint = ClassChangeStruct(robotPointMachine1Entrance1TakeTyreTiltUpperPos); - NbtRobotMove(NbtRobot, strM1E1TakeTiltUpperPoint, 500); + //获得轮廓 + OpenCvSharp.Point[][] contours = null; + HierarchyIndex[] hierarchly; + Cv2.FindContours(mDst, out contours, out hierarchly, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple, new OpenCvSharp.Point(0, 0)); + // public static HierarchyIndex FromVec4i(Vec4i vec); + // Cv2.FindContours(mDst, out contours,out HierarchyIndex(hierarchy), 0, 1); + // std::vector approx; + // 检测所找到的轮廓 + OpenCvSharp.Point2f center; float radius; + Array.Sort(contours, (x, y) => x.Length.CompareTo(y.Length)); - //硫化机进行上定型动作,上定型2s - VulcanizaMachineOperateOnce(OmronPlc, addrD113, 2000); - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, addrD109, 500); - //硫化机上环升,硫化机程序内设置保持5S - //VulcanizaMachineOperateOnce(OmronPlc, addrD127, 5000); - //硫化机上环升,并保持状态。 - VulcanizaMachineOperateKeep(OmronPlc, addrD127, "1"); + Cv2.MinEnclosingCircle(contours[contours.Length - 1], out center, out radius); - //水平放置点上方350 - StrRobotPoint strM1E1DownPlaceLevelPointUpper = strM1E1TakeTiltUpperPoint; - strM1E1DownPlaceLevelPointUpper.Z = strM1E1TakeTiltUpperPoint.Z + 350;//水平放置点上方 - //从取料点移出 - NbtRobotMove(NbtRobot, strM1E1DownPlaceLevelPointUpper, 1000); - // 降上环 - VulcanizaMachineOperateKeep(OmronPlc, addrD127, "0"); + // InputOutputArray data = src.; + InputOutputArray ss; + Scalar color = new Scalar(255, 255, 255); - //移动到放置点,反用DownPoints - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance1DownPoints, 1000, true); + OpenCvSharp.Point point1 = new OpenCvSharp.Point(center.X, center.Y); + // Cv2.Circle(src, (100, 60), 3, (0, 0, 213), -1); + Cv2.Circle(src, (int)center.X, (int)center.Y, (int)radius, color, 2, (LineTypes)8, 0); + Cv2.Circle(src, (int)center.X, (int)center.Y, (int)radius, color, 2, (LineTypes)8, 0); + myPoint.dX = center.X; + myPoint.dY = center.Y; - //移动到取料点上方220 - StrRobotPoint strM1E1DownPlacePoint = ClassChangeStruct(robotPointMachine1Entrance1DownPlacePos);//放置点 - StrRobotPoint strM1E1DownPlacePointUpper = strM1E1DownPlacePoint;//放置点上方 - strM1E1DownPlacePointUpper.Z = strM1E1DownPlacePoint.Z + 220; + return src; - - - //移动到放置点上方 - NbtRobotMove(NbtRobot, strM1E1DownPlacePointUpper, 1000); - LogAsync(DateTime.Now, LogLevel.Error, "是否在-<放置点>-加传感器,判断放置点是否已置空??"); - //移动到放置点 - NbtRobotMove(NbtRobot, strM1E1DownPlacePoint, 1000); - - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂从Machine1Entrance1料仓门口移动到放置点"); - - //开始放料 - //夹爪运动到下料夹紧点,夹爪(D31,D33)夹紧 - if (M1E1DownFastenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - else - GripperMove(OmronPlc, M1E1DownFastenPos);//夹爪运动 - Thread.Sleep(1000); - - //放料完,移走机械臂 - //移动到放置点上方 - NbtRobotMove(NbtRobot, strM1E1DownPlacePointUpper, 1000); - //夹爪运动到放松点 - GripperMove(OmronPlc, NbtRobot.IConfig.GripperLoosenPosition); - - LogAsync(DateTime.Now, LogLevel.Detail, "1号位下料完成。"); - - NbtRobotMove(NbtRobot, initPoint, 1000);//回原点 - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂回原点,夹爪回原点。"); - - IsSingleStepOperating = false; - }); } - public void Machine1Entrance2Up(int tyreSize) + void genCalibratePts1() { - // 设置设备 - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - - GripperInit(OmronPlc);//夹爪复位 - NbtRobotInit(NbtRobot);//机械臂复位 - - LogAsync(DateTime.Now, LogLevel.Detail, "开始进行上料过程"); - - PlcAddress addrs = new PlcAddress(); - string addrD09 = addrs.AddrMachine1MoldOpenInPlace;//1硫化机开模到位 - string addrD101 = addrs.AddrMachine1InnerPressureLight;//硫化完成 - string addrD83 = addrs.AddrMachine1Tyre2InPlace;//2号位轮胎就位 - - RobotPoint robotPointInitPos = NbtRobot.IConfig.RobotInitPosition;//初始位置 - StrRobotPoint initPoint = ClassChangeStruct(robotPointInitPos); - - RobotPoint robotPointMachine1Entrance2GrabPos = NbtRobot.IConfig.RobotMachine1Entrance2GrabPoint;//M1E2上料抓取点 - RobotPoint robotPointMachine1Entrance2UpPlacePos = NbtRobot.IConfig.RobotMachine1Entrance2UpPlacePoint;//M1E2上料放置点 - - //判断是否硫化完成 - string machine1VulcanStateD101 = ProcessReadInt(OmronPlc, addrD101, "int"); - //1号位硫化机开模到位状态,为1时:硫化机开模到位可以进行上下料动作 - string machine1OpenReadyStateD09 = ProcessReadInt(OmronPlc, addrD09, "int"); - //胎胚就位状态 - string machine1Entrance2TyreReadyStateD83 = ProcessReadInt(OmronPlc, addrD83, "int"); - - int Machine1Entrance2TyreSize = tyreSize; - - Task.Run(() => + try { - //if (machine1VulcanStateD101 == "0" && machine1OpenReadyStateD09 == "1") - if (machine1VulcanStateD101 == "0") + CVCalibrationConfig AcVCalibrationConfig = new CVCalibrationConfig(); //每一组的标定配置务必要有 + DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.A_deviation[ShiJiaoVecCountFlag1]; + //CVCalibrationConfig cVCalibrationConfig = ModeTypeRun.CVCalibrationConfig; + foreach (var CalNum in AModeTypeRun.CVCalibrationConfig) { - //读D83:1号上料抓取位胎坯就位,等待D83置1胎胚就位 - //while (machine1Entrance2TyreReadyStateD83 == "0") - //{ - // Thread.Sleep(1000); - // machine1Entrance2TyreReadyStateD83 = ProcessReadInt(OmronPlc, addrD83, "int"); - //} - LogAsync(DateTime.Now, LogLevel.Detail, "2号位胎胚就位,开始上料流程。"); - #region 1号机2号位上料流程 - - //去抓料 - StrRobotPoint pointMachine1Entrance2GrabPos = ClassChangeStruct(robotPointMachine1Entrance2GrabPos); - StrRobotPoint pointMachine1Entrance2GrabPosUpper = pointMachine1Entrance2GrabPos; - pointMachine1Entrance2GrabPosUpper.Z = pointMachine1Entrance2GrabPos.Z + 200; - //机械臂移动到抓取点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance2GrabPosUpper, 1000); - ////夹爪运动到全松点 - //GripperMove(OmronPlc, NbtRobot.IConfig.GripperAllLoosenPosition); - //机械臂移动到抓取点 - NbtRobotMove(NbtRobot, pointMachine1Entrance2GrabPos, 1000); - - //夹爪夹紧 - string M1E2UpFastenPos = GetGripperPosByTyreSize(NbtRobot, Machine1Entrance2TyreSize, MoveState.UpFasten);//获取上料夹紧点 - if (M1E2UpFastenPos == "error") + if (CalNum.CVTypeID == A_ShiJIaoPoint.CVTypeID)//若这个螺丝的标定ID存在标定组 则使用标定组的各种信息 { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; + AcVCalibrationConfig = CalNum; } - else - GripperMove(OmronPlc, M1E2UpFastenPos);//夹爪运动 - - //抓取轮胎后,根据预设点位移动到上料口 - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance2UpPoints, 1000, false); - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂移动到Machine1Entrance2上料口"); - - //运动到放料点 - StrRobotPoint pointMachine1Entrance2UpPlace = ClassChangeStruct(robotPointMachine1Entrance2UpPlacePos);//放料点 - StrRobotPoint pointMachine1Entrance2UpPlaceUpper = pointMachine1Entrance2UpPlace;//放料点上方200 - pointMachine1Entrance2UpPlaceUpper.Z = pointMachine1Entrance2UpPlace.Z + 200; - //运动到放料点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance2UpPlaceUpper, 1000); - //移动到放料点同时,硫化机上环升 - //VulcanizaMachineOperateOnce(OmronPlc, "D127 ", 5000);//上环升,硫化机程序内设置保持5S - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1");//上环保持上升状态 - Thread.Sleep(2000); - - NbtRobotMove(NbtRobot, pointMachine1Entrance2UpPlace, 1000);//运动到放料点 - - //下定型5秒,其中第2秒时松夹爪、机械臂移动出 - ProcessWriteInt(OmronPlc, "D115", "int", "0"); - Thread.Sleep(500); - ProcessWriteInt(OmronPlc, "D115", "int", "1"); - Thread.Sleep(500); - - //第2秒时,松夹爪、机械臂移动 - //夹爪放松 - string M1E2UpLoosenPos = GetGripperPosByTyreSize(NbtRobot, Machine1Entrance2TyreSize, MoveState.UpLoosen);//获取上料放松点 - if (M1E2UpLoosenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - else - GripperMove(OmronPlc, M1E2UpLoosenPos); - //运动到放料点上方200 - NbtRobotMove(NbtRobot, pointMachine1Entrance2UpPlaceUpper, 1000); - - //下定型结束 - ProcessWriteInt(OmronPlc, "D115", "int", "0"); - Thread.Sleep(500); - - VulcanizaMachineOperateKeep(OmronPlc, "D127", "0");//定型结束后,上环降 - - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, "D109", 500); - - //料仓门口点 - StrRobotPoint pointM1E2SiloDoor = ClassChangeStruct(NbtRobot.IConfig.RobotMachine1Entrance2UpPoints[3]); - NbtRobotMove(NbtRobot, pointM1E2SiloDoor, 1000);//运动到料仓门口 - - //检测机械臂是否移动到料仓外 - StrRobotPoint currentP; - if (IsTesting) - currentP = pointM1E2SiloDoor; - else - currentP = NbtRobot.GetPosition(); - - if (!IsNumApproximateEqual(currentP.X, pointM1E2SiloDoor.X, 0.5f) || - !IsNumApproximateEqual(currentP.Y, pointM1E2SiloDoor.Y, 0.5f) || - !IsNumApproximateEqual(currentP.Z, pointM1E2SiloDoor.Z, 0.5f) || - !IsNumApproximateEqual(currentP.A, pointM1E2SiloDoor.A, 0.5f) || - !IsNumApproximateEqual(currentP.B, pointM1E2SiloDoor.B, 0.5f) || - !IsNumApproximateEqual(currentP.C, pointM1E2SiloDoor.C, 0.5f)) - { - LogAsync(DateTime.Now, LogLevel.Exception, "机械臂位置错误,可能未移动出料仓,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance2UpPoints, 1000, true);//从料仓门口回原点 - - GripperInit(OmronPlc);//夹爪复位 - LogAsync(DateTime.Now, LogLevel.Detail, "夹爪复位"); - - //硫化机进入自动状态,0为手动,1为自动 - ProcessWriteInt(OmronPlc, "D103", "int", "1"); - //硫化机合模 - VulcanizaMachineOperateOnce(OmronPlc, "D105", 500); - - //机械臂回原点 - NbtRobotMove(NbtRobot, initPoint, 1000);//回原点 - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂回原点,夹爪回原点。"); - - #endregion - LogAsync(DateTime.Now, LogLevel.Detail, "2号位上料完成。"); } - else - { - LogAsync(DateTime.Now, LogLevel.Error, "硫化未完成或硫化机未开模到位。"); - IsSingleStepOperating = false; + List VPList = AcVCalibrationConfig.VPPoints; + List VRList = AcVCalibrationConfig.VRPoints; + VPVRPoint current_P = new VPVRPoint(); + current_P.X = A_ShiJIaoPoint.X; + current_P.Y = A_ShiJIaoPoint.Y; + current_P.Z = A_ShiJIaoPoint.Z; + float PYliangx = current_P.X; + float PYliangy = current_P.Z; - return; - } - IsSingleStepOperating = false; + VP.Clear(); + VR.Clear(); + /*************生成像素数据*********************/ + MyPoint tp; + tp.dX = VPList[0].X;//2054; + tp.dY = VPList[0].Y;// 1831; + VP.Add(tp); - }); + tp.dX = VPList[1].X;// 2033; + tp.dY = VPList[1].Y; //986; + VP.Add(tp); + + tp.dX = VPList[2].X;//2013; + tp.dY = VPList[2].Y;//168; + VP.Add(tp); + + tp.dX = VPList[3].X;// 1369; + tp.dY = VPList[3].Y; //235; + VP.Add(tp); + + + ////5-8 + tp.dX = VPList[4].X;// 1369; + tp.dY = VPList[4].Y; //235; + // tp.dX = 1403; + //tp.dY = 985; + VP.Add(tp); + + tp.dX = VPList[5].X;// 1327; + tp.dY = VPList[5].Y;// 1756; + VP.Add(tp); + + tp.dX = VPList[6].X;// 717; + tp.dY = VPList[6].Y;// 1701; + VP.Add(tp); + + tp.dX = VPList[7].X;// 879; + tp.dY = VPList[7].Y;// 947; + VP.Add(tp); + //// + + tp.dX = VPList[8].X;// 774; + tp.dY = VPList[8].Y;// 236; + VP.Add(tp); + + tp.dX = VPList[9].X;// 257; + tp.dY = VPList[9].Y;// ; + VP.Add(tp); + + tp.dX = VPList[10].X;// 307; + tp.dY = VPList[10].Y;// 994; + VP.Add(tp); + + tp.dX = VPList[11].X;// 303; + tp.dY = VPList[11].Y;// 1727; + VP.Add(tp); + + + + /*************生成三维数据*********************/ + + MyPoint tr; + tr.dX = VRList[0].X + PYliangx; + tr.dY = VRList[0].Y + PYliangy; + VR.Add(tr); + + + tr.dX = VRList[1].X + PYliangx; + tr.dY = VRList[1].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[2].X + PYliangx; + tr.dY = VRList[2].Y + PYliangy; + VR.Add(tr); + + ////////////// + + tr.dX = VRList[3].X + PYliangx; + tr.dY = VRList[3].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[4].X + PYliangx; + tr.dY = VRList[4].Y + PYliangy; + VR.Add(tr); + + + tr.dX = VRList[5].X + PYliangx; + tr.dY = VRList[5].Y + PYliangy; + VR.Add(tr); + + + //////////////7 + tr.dX = VRList[6].X + PYliangx; + tr.dY = VRList[6].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[7].X + PYliangx; + tr.dY = VRList[7].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[8].X + PYliangx; + tr.dY = VRList[8].Y + PYliangy; + VR.Add(tr); + + ////////////// + + tr.dX = VRList[9].X + PYliangx; + tr.dY = VRList[9].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[10].X + PYliangx; + tr.dY = VRList[10].Y + PYliangy; + VR.Add(tr); + + tr.dX = VRList[11].X + PYliangx; + tr.dY = VRList[11].Y + PYliangy; + VR.Add(tr); + } + catch (Exception e) + { + + } } - public void Machine1Entrance2Down(int tyreSize) + private void OnCameraImageOutput(ref MyPoint ssw1, ref Mat dd, int Pro1) { - // 设置设备 - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; + Stopwatch stopWatch2 = new Stopwatch(); + stopWatch2.Restart(); - GripperInit(OmronPlc);//夹爪复位 - NbtRobotInit(NbtRobot);//机械臂复位 + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Restart(); - LogAsync(DateTime.Now, LogLevel.Detail, "开始进行下料过程"); +#if true + genCalibratePts1(); + stopWatch2.Stop(); + Console.WriteLine(DateTime.Now + "==========配置=================" + stopWatch2.ElapsedMilliseconds + "==========================="); - PlcAddress addrs = new PlcAddress(); - string addrD101 = addrs.AddrMachine1InnerPressureLight;//硫化完成指示灯 - string addrD103 = addrs.AddrMachine1AutoManual;//切换手自动 - string addrD107 = addrs.AddrMachine1OpenMold;//开模 - string addrD109 = addrs.AddrMachine1Stop;//停止 - string addrD115 = addrs.AddrMachine1LowerStereotypes;//下定型 - string addrD117 = addrs.AddrMachine1AllStereotypes;//总定型 - string addrD125 = addrs.AddrMachine1Vacuumize;//抽真空 - string addrD129 = addrs.AddrMachine1LowerRingRise;//下环升 + MyPoint ssw = new MyPoint(); - RobotPoint robotPointInitPos = NbtRobot.IConfig.RobotInitPosition;//初始位置 - StrRobotPoint initPoint = ClassChangeStruct(robotPointInitPos); + Mat _mat = dd.Clone(); + string ss = "D:\\QT1\\" + DateTime.Now.ToString("HHmmssfff") + ".jpg"; + Cv2.ImWrite(ss, _mat); + Mat _mat2 = AloghitomMat(_mat, ref ssw);//根据拍摄的白纸定标图片确定二维到三维转换的关系 + ssw1 = Interpolation(VP, VR, ssw, true);//实际坐标值 - RobotPoint robotPointMachine1Entrance2TakeTyrePos = NbtRobot.IConfig.RobotMachine1Entrance2TakeTyrePoint;//M1E2取料点 - RobotPoint robotPointMachine1Entrance2DownPlacePos = NbtRobot.IConfig.RobotMachine1Entrance2DownPlacePoint;//M1E2取料放置点 - RobotPoint robotPointMachine1Entrance2TakeTyreTiltUpperPos = NbtRobot.IConfig.RobotMachine1Entrance2TakeTyreTiltUpperPoint;//M1E2P207斜向上移动 + string ss2 = "D:\\QT\\" + DateTime.Now.ToString("HHmmssfff") + ".jpg"; + Cv2.ImWrite(ss2, _mat2); + stopWatch.Stop(); + Console.WriteLine(DateTime.Now + "==========标定算法=================" + stopWatch.ElapsedMilliseconds + "==========================="); - - //判断是否硫化完成 - string machine1VulcanStateD101 = ProcessReadInt(OmronPlc, addrD101, "int"); - - Task.Run(() => + if (Pro1 == 1) { - //开模 - VulcanizaMachineOperateOnce(OmronPlc, addrD107, 500); - //延时10秒 - Thread.Sleep(10000); - //硫化机自动切换为手动,0为手动,1为自动 - ProcessWriteInt(OmronPlc, addrD103, "int", "0"); - //硫化机进行总定型动作,总定型3s - VulcanizaMachineOperateOnce(OmronPlc, addrD117, 3000); - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, addrD109, 500); - //硫化机进行抽真空动作,抽真空4s - VulcanizaMachineOperateOnce(OmronPlc, addrD125, 4000); - //硫化机停止 - VulcanizaMachineOperateOnce(OmronPlc, addrD109, 500); - - //移动到初始点 - NbtRobotMove(NbtRobot, initPoint, 1000); - - LogAsync(DateTime.Now, LogLevel.Detail, "开始2号位下料流程。"); - - //机械臂移动到二号位料仓门口 - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance2DownPoints, 1000, false); - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂移动到Machine1Entrance2料仓门口"); - - //移动到取料点上方220 - StrRobotPoint strM1E2TakePoint = ClassChangeStruct(robotPointMachine1Entrance2TakeTyrePos);//取料点 - StrRobotPoint strM1E2TakePointUpper = strM1E2TakePoint;//取料点上方 - strM1E2TakePointUpper.Z = strM1E2TakePoint.Z + 220; - NbtRobotMove(NbtRobot, strM1E2TakePointUpper, 1000);//移动到取料点上方220 - - LogAsync(DateTime.Now, LogLevel.Detail, $"当前轮胎尺寸:{tyreSize}"); - - //本台硫化机总定型1s,防止上环升不起来 - VulcanizaMachineOperateOnce(OmronPlc, "D117", 1000); - VulcanizaMachineOperateOnce(OmronPlc, "D123", 2000); - - //上环升保持 - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1"); - Thread.Sleep(3000);//保持5s - - ////硫化机进行抽真空动作,抽真空2s,使轮胎落下,防止夹爪按压轮胎 - //VulcanizaMachineOperateOnce(OmronPlc, addrD125, 2000); - - //放料点上方65 - strM1E2TakePointUpper.Z = strM1E2TakePoint.Z + 65; - //移动到取料点上方65 - NbtRobotMove(NbtRobot, strM1E2TakePointUpper, 1000); - - //上环升保持 - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1"); - - //硫化机进行抽真空动作,抽真空3s - VulcanizaMachineOperateOnce(OmronPlc, addrD125, 3000); - - //夹爪运动到下料夹紧点,夹爪(D31,D33)夹紧 - string M1E2DownFastenPos = GetGripperPosByTyreSize(NbtRobot, tyreSize, MoveState.DownFasten); - if (M1E2DownFastenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - else - GripperMove(OmronPlc, M1E2DownFastenPos);//夹爪运动 - //上环升保持 - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1"); - //移动到取料点 - NbtRobotMove(NbtRobot, strM1E2TakePoint, 1000); - - //夹爪运动到下料放松点,夹爪(D31,D33)扩张 - //同时开始上定型 - string M1E2DownLoosenPos = GetGripperPosByTyreSize(NbtRobot, tyreSize, MoveState.DownLoosen); - if (M1E2DownLoosenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - else - GripperMove(OmronPlc, M1E2DownLoosenPos);//夹爪运动 - - - //先移动到夹爪水平或上挑的点 robotPointMachine1Entrance2TakeTyreTiltUpperPos - StrRobotPoint strM1E2TakeTiltUpperPoint = ClassChangeStruct(robotPointMachine1Entrance2TakeTyreTiltUpperPos); - NbtRobotMove(NbtRobot, strM1E2TakeTiltUpperPoint, 500); - - - ////上环升保持 - VulcanizaMachineOperateKeep(OmronPlc, "D127", "1"); - Thread.Sleep(3000);//保持3s - - //取出轮胎之前先抽真空硫化机进行抽真空动作,抽真空2s - VulcanizaMachineOperateOnce(OmronPlc, addrD125, 3000); - - //从水平点移动到 - StrRobotPoint strM1E2DownPlaceLevelPointUpper = strM1E2TakeTiltUpperPoint; - strM1E2DownPlaceLevelPointUpper.Z = strM1E2TakeTiltUpperPoint.Z + 350; - - //从水平点移出 - NbtRobotMove(NbtRobot, strM1E2DownPlaceLevelPointUpper, 1000); - //降上环 - VulcanizaMachineOperateKeep(OmronPlc, "D127", "0"); - - - ////上方220再斜向上移动一点 - //StrRobotPoint strM1E2TakeTiltUpperPoint = ClassChangeStruct(robotPointMachine1Entrance2TakeTyreTiltUpperPos); - //NbtRobotMove(NbtRobot, strM1E2TakeTiltUpperPoint, 1000); - - //移动到放置点,反用DownPoints - NbtRobotMoves(NbtRobot, NbtRobot.IConfig.RobotMachine1Entrance2DownPoints, 1000, true); - - //移动到取料点上方220 - StrRobotPoint strM1E2DownPlacePoint = ClassChangeStruct(robotPointMachine1Entrance2DownPlacePos);//放置点 - StrRobotPoint strM1E2DownPlacePointUpper = strM1E2DownPlacePoint;//放置点上方 - strM1E2DownPlacePointUpper.Z = strM1E2DownPlacePoint.Z + 220; - //移动到放置点上方 - NbtRobotMove(NbtRobot, strM1E2DownPlacePointUpper, 1000); - LogAsync(DateTime.Now, LogLevel.Error, "是否在-<放置点>-加传感器,判断放置点是否已置空??"); - //移动到放置点 - NbtRobotMove(NbtRobot, strM1E2DownPlacePoint, 1000); - - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂从Machine1Entrance2料仓门口移动到放置点"); - - //开始放料 - //夹爪运动到下料夹紧点,夹爪(D31,D33)夹紧 - if (M1E2DownFastenPos == "error") - { - LogAsync(DateTime.Now, LogLevel.Error, "夹爪位置错误,当前流程停止"); - IsSingleStepOperating = false; - - return; - } - else - GripperMove(OmronPlc, M1E2DownFastenPos);//夹爪运动 - Thread.Sleep(1000); - - //放料完,移走机械臂 - //移动到放置点上方 - NbtRobotMove(NbtRobot, strM1E2DownPlacePointUpper, 1000); - //夹爪运动到放松点 - GripperMove(OmronPlc, NbtRobot.IConfig.GripperLoosenPosition); - - LogAsync(DateTime.Now, LogLevel.Detail, "2号位下料完成。"); - - NbtRobotMove(NbtRobot, initPoint, 1000);//回原点 - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂回原点,夹爪回原点。"); - - IsSingleStepOperating = false; - }); - } + // SnapshotState = SnapshotState.Finish; + ProcessStatus = ProcessStatus.ClodeLight; + } #endif - //PLC地址 - public class PlcAddress - { - //硫化机 开模到位 - public string AddrMachine1MoldOpenInPlace { get; } = "D09"; - public string AddrMachine2MoldOpenInPlace { get; } = "D11"; - - //上料 胎胚就位 - public string AddrMachine1Tyre1InPlace { get; } = "D81"; - public string AddrMachine1Tyre2InPlace { get; } = "D83"; - - //硫化机 内压指示灯 - public string AddrMachine1InnerPressureLight { get; } = "D101"; - public string AddrMachine2InnerPressureLight { get; } = "D201"; - - //硫化机 手动or自动 - public string AddrMachine1AutoManual { get; } = "D103"; - public string AddrMachine2AutoManual { get; } = "D203"; - - //硫化机 合模 - public string AddrMachine1CloseMold { get; } = "D105"; - public string AddrMachine2CloseMold { get; } = "D205"; - - //硫化机 开模 - public string AddrMachine1OpenMold { get; } = "D107"; - public string AddrMachine2OpenMold { get; } = "D207"; - - //硫化机 停止 - public string AddrMachine1Stop { get; } = "D109"; - public string AddrMachine2Stop { get; } = "D209"; - - //硫化机 上定型 - public string AddrMachine1UpperStereotypes { get; } = "D113"; - public string AddrMachine2UpperStereotypes { get; } = "D213"; - - //硫化机 下定型 - public string AddrMachine1LowerStereotypes { get; } = "D115"; - public string AddrMachine2LowerStereotypes { get; } = "D215"; - - //硫化机 总定型 - public string AddrMachine1AllStereotypes { get; } = "D117"; - public string AddrMachine2AllStereotypes { get; } = "D217"; - - //硫化机 上排气 - public string AddrMachine1UpperExhaust { get; } = "D119"; - public string AddrMachine2UpperExhaust { get; } = "D219"; - - //硫化机 下排气 - public string AddrMachine1LowerExhaust { get; } = "D121"; - public string AddrMachine2LowerExhaust { get; } = "D221"; - - //硫化机 总排气 - public string AddrMachine1AllExhaust { get; } = "D123"; - public string AddrMachine2AllExhaust { get; } = "D223"; - - //硫化机 抽真空 - public string AddrMachine1Vacuumize { get; } = "D125"; - public string AddrMachine2Vacuumize { get; } = "D225"; - - //硫化机 上环升 - public string AddrMachine1UpperRingRise { get; } = "D127"; - public string AddrMachine2UpperRingRise { get; } = "D227"; - - //硫化机 下环升 - public string AddrMachine1LowerRingRise { get; } = "D129"; - public string AddrMachine2LowerRingRise { get; } = "D229"; - - - - - - - } - public class DistanceRobot - { - public double testDs { get; set; } - public double x { get; set; } - public double y { get; set; } + #endregion +#endif - public DistanceRobot(double _testDs, double _x, double _y) - { - this.testDs = _testDs; - this.x = _x; - this.y = _y; - } - } - public double MoniToRealJS(double moni) - { - //cout << moni << endl; - moni = (moni - 819.0) * (16.0 / (4095.0 - 819.0)) + 4; - //cout << moni; - moni = (moni - 4) * ((5000.0 - 60.0) / 16.0) + 60; - //cout << moni; - return moni; - } - /// - /// - /// - /// 设备PLC - /// PLC写入的地址 - /// 地址初始值 - /// 地址结束值 - public void PcToPlcWrite(PLCBase PLCB, string adress, string original, string end) - { - string readinitrobot = ProcessReadInt(PLCB, adress, "int"); - if (readinitrobot == original) - { - ProcessWriteInt(PLCB, adress, "int", end); - } - } - public StrRobotPoint ComputeClampoint(StrRobotPoint x1, StrRobotPoint x2, List DistanceTyre, double time) - { - // 算出抓取点 - List keyValuePairs = new List(); - double x1d = x1.X; - double y1d = x1.Y; - - double x2d = x2.X; - double y2d = x2.Y; - - // double k = (y2d - y1d) / (x2d - x1d); - //double distancepow= Math.Pow((y2d - y1d), 2) + Math.Pow((x2d - x1d), 2); - // double distance = Math.Pow(distancepow, 1.0 / 2); - // time = sw.ElapsedMilliseconds; - double dV1 = (x2d - x1d) / time; - double dT1 = time / DistanceTyre.Count(); - double dV2 = (y2d - y1d) / time; - double dT2 = time / DistanceTyre.Count(); - - for (int i = 0; i < DistanceTyre.Count(); i++) - { - double dxTmp = x1d + dV1 * (dT1 * i); - double dyTmp = y1d + dV2 * (dT2 * i); - double dtestDs = DistanceTyre[i]; - //DistanceRobot distanceRobot = ; - //distanceRobot.testDs = DistanceTyre[i]; - //distanceRobot.x = dxTmp; - //distanceRobot.y = dyTmp; - keyValuePairs.Add(new DistanceRobot(dtestDs, dxTmp, dyTmp)); - Debug.WriteLine(i); - } - List dic1Ascsort = keyValuePairs.OrderBy(a => a.testDs).ToList(); - StrRobotPoint clamPoint = x1; - clamPoint.Z = x1.Z; ;// x1.Z; - clamPoint.A = x1.A; - clamPoint.B = x1.B; - clamPoint.C = x1.C; - clamPoint.X = (float)dic1Ascsort[0].x; - clamPoint.Y = (float)dic1Ascsort[0].y - (float)dic1Ascsort[0].testDs + 125; - return clamPoint; - } #region 流程操作 [BRS.Common.Model.Helper.ProcessMethod("", "StartProcess", "主流程启动", InvokeType.TestInvoke)] @@ -883,786 +432,198 @@ namespace BRS.Process.A020 return strRobotPoint; } - //private void Pause() - //{ - // while (MachineState == MachineState.Pause) - // { - // Thread.Sleep(50); - // continue; - // } - //} - private bool isMachineRobotRunning() + public ProcessResponse StartProcess(IOperationConfig config, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { - //if(MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff) - // LogAsync(DateTime.Now, LogLevel.Action, "硫化机、机械臂正常运行中。。。"); - //else - // LogAsync(DateTime.Now, LogLevel.Error, "硫化机或机械臂停止运行!!!"); - if (MachineState != MachineState.Running || RobotsStatus == RobotsStatus.Pweroff) - LogAsync(DateTime.Now, LogLevel.Error, "硫化机或机械臂停止运行!!!"); - return MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff; - } - - /// - /// 两数是否约等于,在tolerance的容许范围内 - /// - /// - /// - /// 数值比较所容许的范围 - private bool IsNumApproximateEqual(float num1, float num2, float tolerance) - { - float differ = num1 - num2; - if (Math.Abs(differ) <= Math.Abs(tolerance)) - return true; - else - return false; - } - - public ProcessResponse StartProcess(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) - { - LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!"); - PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null); - return new ProcessResponse(true); - - //if (MachineState != MachineState.Ready) - //{ - // LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动"); - // return new ProcessResponse(false); - //} + if (MachineState != MachineState.Ready) + { + LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动"); + return new ProcessResponse(false); + } LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候..."); - - PrepareBatchNO(); + var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; + var KawasakiRobot = DeviceCollection.Find(d => d is KawasakiTCPSeverRobotDriver) as KawasakiTCPSeverRobotDriver; + StrRobotPoint strPointInitA; + strPointInitA.X = 847.462F; + strPointInitA.Y = 891.623F; + strPointInitA.Z = 803.067F; + strPointInitA.A = 90F; + strPointInitA.B = 180F; + strPointInitA.C = 90F; - _productQueue = new List(); + + RobotPoint robotInitPoint = KawasakiRobot.IIConfig.RobotInitPosition;//机械臂初始点位 - // 触发配置 - //var temp = new List(); - //temp.AddRange(A020Config.TriggerConfigCollection); - //temp.AddRange(A020Config.DetectionTriggerConfigCollection); - //_triggerList = new List(); - //_triggerList.AddRange(temp.OrderBy(t => t.TriggerSort)); - //var firstDetection = _triggerList.FirstOrDefault(t => t.TriggerType == TriggerType.DetectionResultTrigger && t.IsEnableTrigger) as DetectionTrigger; - //var lastDetection = _triggerList.LastOrDefault(t => t.TriggerType == TriggerType.DetectionResultTrigger && t.IsEnableTrigger) as DetectionTrigger; - //_firstCameraId = firstDetection?.CameraId; - //_lastCameraId = lastDetection?.CameraId; + #region 驱动委托 + if (KawasakiRobot != null) + { + KawasakiRobot.OnTcpDataReceived -= TCPseverDriver_OnDataReceived; + KawasakiRobot.OnTcpDataReceived += TCPseverDriver_OnDataReceived; + } + #endregion - - // PrepareMLEngine(); - int TyrePos = 0; - var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - RobotPoint x1 = NbtRobot.IConfig.RobotInitPosition; //NbtRobot.IConfig.X1Point; - RobotPoint x2 = NbtRobot.IConfig.X2Point; - RobotPoint robotPoint = NbtRobot.IConfig.RobotInitPosition;//初始点 - - RobotPoint robotPointTyrePos1 = NbtRobot.IConfig.X1_1Point; //1号硫化机1号位 - RobotPoint robotPointTyrePos2 = NbtRobot.IConfig.X1_2Point; //1号硫化机2号位 - RobotPoint robotPointTyrePos3 = NbtRobot.IConfig.X2_1Point; //2号硫化机1号位 - RobotPoint robotPointTyrePos4 = NbtRobot.IConfig.X2_2Point; //2号硫化机2号位 - - RobotPoint RelaserobotPointTyrePos = NbtRobot.IConfig.TakeOutPoint; ;//1号硫化机1号位取出放置位置 - //RobotPoint RelaserobotPointTyrePos2 = null;//1号硫化机2号位取出放置位置 - //RobotPoint RelaserobotPointTyrePos3 = null;//2号硫化机1号位取出放置位置 - // RobotPoint RelaserobotPointTyrePos4 = null;//2号硫化机2号位取出放置位置 - string wheelspeed = NbtRobot.IConfig.GripperFastenPosition;// "75000";//机械臂运动速度 3600 r/s - string Lossenwheelspeed = NbtRobot.IConfig.GripperLoosenPosition;// "40000";//机械臂运动速度 3600 r/s - string allLossenwheelspeed = NbtRobot.IConfig.GripperAllFastenPosition; - - //17寸轮胎下料配置 - string wheel17speed = NbtRobot.IConfig.Wheel17GripperUpFasten;// "75000";//机械臂运动速度 3600 r/s - string Lossenwheel17speed = NbtRobot.IConfig.Wheel17GripperDownFasten;// "40000";//机械臂运动速度 3600 r/s - string allLossenwheel17speed = NbtRobot.IConfig.Wheel17GripperDownLoosen; - - //16寸轮胎下料配置 - string wheel16speed = NbtRobot.IConfig.Wheel16GripperUpFasten;// "75000";//机械臂运动速度 3600 r/s - string Lossenwheel16speed = NbtRobot.IConfig.Wheel16GripperDownFasten;// "40000";//机械臂运动速度 3600 r/s - string allLossenwheel16speed = NbtRobot.IConfig.Wheel16GripperDownLoosen; - - //18寸轮胎下料配置 - string wheel18speed = NbtRobot.IConfig.Wheel18GripperUpLoosen;// "75000";//机械臂运动速度 3600 r/s - string Lossenwheel18speed = NbtRobot.IConfig.Wheel18GripperDownFasten;// "40000";//机械臂运动速度 3600 r/s - string allLossenwheel18speed = NbtRobot.IConfig.Wheel18GripperDownLoosen; - - string takeIN = wheel17speed; - string Hooking = Lossenwheel17speed; - string takeLoose = allLossenwheel17speed; - - StrRobotPoint initPoint = ClassChangeStruct(robotPoint); - StrRobotPoint clamPoint = initPoint; - StrRobotPoint initx2Point = ClassChangeStruct(x2); - StrRobotPoint RelaserobotPointTyrePos1 = ClassChangeStruct(RelaserobotPointTyrePos); - // 初始化 oee - InitialOEEStatistic(); - WhoolSize = WhoolSize.Size17; + var sw = A020Config.ProcessInitialOps[0]; MachineState = MachineState.Running; - RobotsStatus = RobotsStatus.Relasing; - MachineStateStep = MachineStateStep.Ready; - ProcessStatus = ProcessStatus.Init; - string robotInitPoint = "D05";// - string SetSizeWhool = NbtRobot.IConfig.SetWhoolSize; - if (SetSizeWhool == "17") - WhoolSize = WhoolSize.Size17; - else if (SetSizeWhool == "16") - WhoolSize = WhoolSize.Size16; - else if (SetSizeWhool == "18") - WhoolSize = WhoolSize.Size18; + ProcessStatus = ProcessStatus.ALLFinish; + + //OpenCam1(); + Task.Run(() => { - while (MachineState == MachineState.Running && - RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) + while (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.PowerOff && MachineStateStep != MachineStateStep.Pause) { - int speed = 1000;//机械臂运动速度 m/s - string readint = ProcessReadInt(OmronPlc, robotInitPoint, "int"); - -#if true - #region 机械臂初始化 - ProcessStatus = ProcessStatus.Init; - //流程初始化 - if (ProcessStatus == ProcessStatus.Init && - readint == "1" && - RobotsStatus != RobotsStatus.Claming && - RobotsStatus != RobotsStatus.Moving) + switch (ProcessStatus) { - //机械手回到初始点 - NbtRobot.Move(initPoint, speed, true); - if (IsTesting) - RobotsStatus = RobotsStatus.Wating; - else - { - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving) + case ProcessStatus.Init: { - Thread.Sleep(1000); - if (NbtRobot.get_status() == 0) - RobotsStatus = RobotsStatus.Wating; - } - } - - if (MachineState == MachineState.Running && - RobotsStatus != RobotsStatus.Pweroff && - MachineStateStep != MachineStateStep.Pause) - { - - } - else { break; } - - //2.D11 1-0 PC→PLC //机械手复位回到初始点完成 - // 3.D21 0 - 1 PC → PLC //夹具打开回到初始位置 - PcToPlcWrite(OmronPlc, "D11", "1", "0"); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - Thread.Sleep(1000); - PcToPlcWrite(OmronPlc, "D11", "0", "1"); - PcToPlcWrite(OmronPlc, "D21", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - //Thread.Sleep(15000); - ProcessStatus = ProcessStatus.MesureingInitPLC; - - } - StrRobotPoint currentP; - if (IsTesting) - currentP = initPoint; - else - currentP = NbtRobot.GetPosition(); - string ClamInitPLC = ProcessReadInt(OmronPlc, "D23", "int");//夹具初始化成功 - - if (currentP.A == initPoint.A && currentP.B == initPoint.B && currentP.C == initPoint.C && - currentP.X == initPoint.X && currentP.Y == initPoint.Y && currentP.Z == initPoint.Z) - { - if (ClamInitPLC == "1" && ProcessStatus == ProcessStatus.MesureingInitPLC) - ProcessStatus = ProcessStatus.MesureingInit; - } - else if (ProcessStatus == ProcessStatus.MesureingInitPLC) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos}已在初始点"); - Thread.Sleep(15000); - ProcessStatus = ProcessStatus.MesureingInit; - } - else - { - - } - #endregion - #region 测距+抓取+放进硫化机+夹爪和机械臂回到原位 - { - #region 接收放轮胎位置指令 - if (ProcessStatus == ProcessStatus.MesureingInit) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos}接收放轮胎位置指令"); - //4.D23 0 - 1 PLC → PC //夹具回到初始位置完成+接收放轮胎位置指令 - string ClamInit = ProcessReadInt(OmronPlc, "D61", "int"); - //5.D25 0 - 1 PLC → PC //接收放轮胚指令 目前只放一个 上料信号触发使得流程变成测距 - // string ClamReady = ProcessReadInt(OmronPlc, "D25", "int"); - - if (ClamInit == "1") - ProcessStatus = ProcessStatus.Mesureing; - Thread.Sleep(20); - } - #endregion - #region 测距 - if (ProcessStatus == ProcessStatus.Mesureing && - RobotsStatus != RobotsStatus.Claming && - RobotsStatus != RobotsStatus.Moving) - { - ProcessWriteInt(OmronPlc, "D61", "int", "0"); - RobotsStatus = RobotsStatus.Relasing;//初始点位 - - List DistanceTyre = new List(); //测距点 - List DistanceList_List = new List();//程序查看测距点String - - if (NbtRobot.get_status() == 0) - { - Stopwatch sw = new Stopwatch(); - NbtRobot.Move(initx2Point, 100, true); - RobotsStatus = RobotsStatus.Moving; - sw.Start(); - while (RobotsStatus == RobotsStatus.Moving) + if (RobotsStatus.Release == RobotsStatus)//机器人复位,初始状态 { - //6.D31 xxxx PLC → PC //一边移动机械手一边读取测距信号 - string DistanceList = ProcessReadInt(OmronPlc, "D29", "int");//读出寄存器距离 - DistanceList_List.Add(DistanceList); - DistanceTyre.Add(Convert.ToDouble(DistanceList) / 10); - if (DistanceTyre.Count() > 1000 && NbtRobot.get_status() == 0) + //========移动到示教点(初始点)========== + int ShiJiaoVecCount = AModeTypeRun.A_deviation.Count;//相机1的偏移点组 + if (ShiJiaoVecCountFlag1 < ShiJiaoVecCount) { - RobotsStatus = RobotsStatus.Wating; - } - } - sw.Stop(); - - - if (MachineState == MachineState.Running && - RobotsStatus != RobotsStatus.Pweroff && - MachineStateStep != MachineStateStep.Pause) - { - - } - else { break; } - - //算出抓取点 - clamPoint = ComputeClampoint(initPoint, initx2Point, DistanceTyre, sw.ElapsedMilliseconds); - LogAsync(DateTime.Now, LogLevel.Detail, $"算出抓取点{clamPoint}"); - LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂移动时间:{sw.ElapsedMilliseconds}"); - StrRobotPoint x2Up = initx2Point; - x2Up.Y = x2.Y; - x2Up.A = x2.A; - x2Up.B = x2.B; - x2Up.C = x2.C; - x2Up.X = x2.X; - x2Up.Z = x2.Z + 280; - if (RobotsStatus == RobotsStatus.Wating) - NbtRobot.Move(x2Up, speed, true); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - Thread.Sleep(2000); - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } - - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - - StrRobotPoint clamPointUp = clamPoint; - clamPointUp.Y = clamPoint.Y; - clamPointUp.A = clamPoint.A; - clamPointUp.B = clamPoint.B; - clamPointUp.C = clamPoint.C; - clamPointUp.X = clamPoint.X; - clamPointUp.Z = clamPointUp.Z + 280; - Thread.Sleep(1000); - NbtRobot.Move(clamPointUp, speed, true);//移动到抓取点上面 - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving) - { - Thread.Sleep(2000); - - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } - - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - - if (RobotsStatus == RobotsStatus.Wating) - NbtRobot.Move(clamPoint, speed, true);//移动到抓取点 - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - Thread.Sleep(2000); - - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } - - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - Thread.Sleep(1000); - - LogAsync(DateTime.Now, LogLevel.Detail, $"机械手到达机械位置 控制夹具夹紧"); - //机械手到达机械位置 控制夹具夹紧 - //7.D33 xxxxxxxx &D31 0-1 PC → PLC //机械手到达轮胎位置后控制夹具夹紧 - // StrRobotPoint currentP = NbtRobot.GetPosition(); - ProcessWriteInt(OmronPlc, "D31", "int", "0");//转圈标识 - ProcessWriteInt(OmronPlc, "D33", "int", "0");//转圈 - ProcessWriteInt(OmronPlc, "D33", "int", wheelspeed);//转圈 - PcToPlcWrite(OmronPlc, "D31", "0", "1"); - Thread.Sleep(1000); - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 - LogAsync(DateTime.Now, LogLevel.Detail, $"{wheelspeed}机械手到达机械位置 控制夹具夹紧"); - Thread.Sleep(1000); - string DistanceList2 = ProcessReadInt(OmronPlc, "D29", "int"); - //ProcessWriteInt(OmronPlc, "D201", "int", DistanceList2); - TyrePos = 1; - if (Convert.ToDouble(DistanceList2) < 2000) - { - // ProcessStatus = ProcessStatus.Claim; - TyrePos = 1; - } - ProcessStatus = ProcessStatus.MesureingPLC; - - } - - } - #endregion - #region 放进硫化机+抓取 - string ClamInit8 = ProcessReadInt(OmronPlc, "D37", "int"); - if (ClamInit8 == "1" && ProcessStatus == ProcessStatus.MesureingPLC) - ProcessStatus = ProcessStatus.Claim; - if (ProcessStatus == ProcessStatus.Claim && TyrePos != 0) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos}放进硫化池"); - - //放进第几个硫化池中 - switch (TyrePos) - { - case 1: - { - LogAsync(DateTime.Now, LogLevel.Action, $"{TyrePos}移动电组 机械手将轮胚放进硫化机"); - Thread.Sleep(5000); - //通过移动电组移动到指定位置1 - StrRobotPoint clamPoint2 = clamPoint; - clamPoint2.Z += 200; - NbtRobot.Move(clamPoint2, speed, true); - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手升高"); - - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) + CQRobotPoint cQRobotPoint = new CQRobotPoint();//示教拍摄点 + + DiffVPVRPoint A_ShiJIaoPoint = AModeTypeRun.A_deviation[ShiJiaoVecCountFlag1]; + //CVCalibrationConfig cVCalibrationConfig = ModeTypeRun.CVCalibrationConfig; + foreach (var CalNum in AModeTypeRun.CVCalibrationConfig) { - - Thread.Sleep(2000); - if (NbtRobot.get_status() == 0) + if (CalNum.CVTypeID == A_ShiJIaoPoint.CVTypeID)//若这个螺丝的标定ID存在标定组 则使用标定组的各种信息 { - RobotsStatus = RobotsStatus.Wating; + cQRobotPoint = CalNum.SHIJIao_deviation[0]; } } - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 + VPVRPoint current_P = new VPVRPoint(); + current_P.X = A_ShiJIaoPoint.X; + current_P.Y = A_ShiJIaoPoint.Y; + current_P.Z = A_ShiJIaoPoint.Z; - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手上料移动组点移动"); + StrRobotPoint CurrentPointInit = CQRobotPointChangeStrRobotPoint(cQRobotPoint, current_P); + strPointInitA.X = CurrentPointInit.X; + strPointInitA.Y = CurrentPointInit.Y; + strPointInitA.Z = CurrentPointInit.Z; + strPointInitA.A = CurrentPointInit.A; + strPointInitA.B = CurrentPointInit.B; + strPointInitA.C = CurrentPointInit.C; + //string PointInitMove = KawasakiRobotMove(KawasakiRobot, strPointInitA); + //KawasakiRobot.SendMessage(PointInitMove); + //LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动到示教点"); + //RobotsStatus = RobotsStatus.Runing; + //DownCirce = DownCirce.DownCirce; + //while (true) + //{ + // if (DownCirce == DownCirce.DownCirceRuning) + // break; + // else + // Thread.Sleep(10); + //} + KawasakiRobotInit(KawasakiRobot); + } + } + } + break; + case ProcessStatus.OpenLight: + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Restart(); + LogAsync(DateTime.Now, LogLevel.Assist, $"打开光源,拍摄图片,视觉定位"); + //打开光源 + //JYDAMDriver1.WriteStrs(SerialOpenLight); + #region 拍摄图片 取图进行视觉定位 + SoftTrigger1(); + Thread.Sleep(200); + while (CamA == true) + { + //拍照视觉定位 + OnBitmapChanged?.Invoke(1, Bit_Image); + OnCameraImageOutput(ref sswF, ref Mat_CamA, 1); + stopWatch.Stop(); + Console.WriteLine(DateTime.Now + "=========拍照==================" + stopWatch.ElapsedMilliseconds + "==========================="); + CamA = false; + } + #endregion + } + break; + case ProcessStatus.ClodeLight: + { + //关闭光源 + // JYDAMDriver1.WriteStrs(SerialCloseLight); + LogAsync(DateTime.Now, LogLevel.Assist, $"关闭光源"); + Thread.Sleep(10); + ProcessStatus = ProcessStatus.CVLocation; + } + break; + case ProcessStatus.CVLocation: + { + if (RobotsStatus.Release == RobotsStatus) + { + #region 机械臂移动视觉定位点 - NbtRobot.IConfig.RobotUpMovePoints.ForEach(points => - { + strPointInitA.X = (float)sswF.dX; + strPointInitA.Z = (float)sswF.dY; + if (Math.Abs((float)strPointInitA.X) <= 100 || Math.Abs((float)strPointInitA.Z) <= 0) + { + StopMachineClosing(MelsecPLC, KawasakiRobot); - StrRobotPoint strRobotPoint = ClassChangeStruct(points); - NbtRobot.Move(strRobotPoint, speed, true); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { + MachineState = MachineState.Closing; - Thread.Sleep(2000); - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } - }); - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - if (NbtRobot.IConfig.RobotUpMovePoints.Count() == 0) - break; - // 9.D37 0 - 1 PC → PLC //放置轮胎完成 - //10.D33 xxxxxxxx &D31 0-1 PC → PLC //夹具松动以便机械手归位 - - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 夹具松动以便机械手归位"); - ProcessWriteInt(OmronPlc, "D31", "int", "0");//标识 - ProcessWriteInt(OmronPlc, "D33", "int", "0");//转圈 - ProcessWriteInt(OmronPlc, "D33", "int", Lossenwheelspeed);//转圈胎// 11.D49 0 - 1 PLC → PC //夹具松动完成 - PcToPlcWrite(OmronPlc, "D31", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 - Thread.Sleep(8000); - - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos}夹具松松完成"); - ProcessStatus = ProcessStatus.ClaimPLC; - - - //再在硫化中 + LogAsync(DateTime.Now, LogLevel.Assist, $"计算定位失败"); break; + } - } - } - #endregion - } - #endregion - #region 夹爪和机械臂回到原位 - string ClamInit11 = ProcessReadInt(OmronPlc, "D37", "int"); - if (ClamInit11 == "1" && ProcessStatus == ProcessStatus.ClaimPLC) - { + // + //==========平滑移动 + List _strRobotPointAs = new List(); + StrRobotPoint strPointInitA1 = new StrRobotPoint(); + strPointInitA1 = strPointInitA; + StrRobotPoint strPointInitA2 = new StrRobotPoint(); + strPointInitA2 = strPointInitA; + strPointInitA2.Y += A_Distance_DisD; + _strRobotPointAs.Add(strPointInitA1); + _strRobotPointAs.Add(strPointInitA2); + //KawasakiRobotMoves(KawasakiRobot, _strRobotPointAs, false); + string TestPoint = MoveMoreNContinueRobot(_strRobotPointAs, ref strPointInitA); - ProcessStatus = ProcessStatus.Loosen; - } - if (ProcessStatus == ProcessStatus.Loosen) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos}移动电组 机械手复位回到初始点"); - - //12.D51 0 - 1 PC → PLC //机械手回归初始位置 - //13.D11 1 - 0 PC→PLC //机械手复位回到初始点完成 - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手上料返回组点移动"); - NbtRobot.IConfig.RobotUPBackPoints.ForEach(points => - { - - StrRobotPoint strRobotPoint2 = ClassChangeStruct(points); - - NbtRobot.Move(strRobotPoint2, speed, true); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - //Task.Delay(200);//线程阻塞 - Thread.Sleep(2000); - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } + DownCirce = DownCirce.DownCirce; + KawasakiRobot.SendMessage(TestPoint);//机械臂移动视觉定位点 + LogAsync(DateTime.Now, LogLevel.Assist, $"机械臂A移动视觉定位点完成"); - }); - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - if (NbtRobot.IConfig.RobotUPBackPoints.Count() == 0) - return; - - LogAsync(DateTime.Now, LogLevel.Detail, $"回到起始位置"); - - NbtRobot.Move(initPoint, speed, true);//回到起始位置 - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - Thread.Sleep(1000);//线程阻塞 - - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } - } - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - // PcToPlcWrite(OmronPlc, "D51", "0", "1"); - //PcToPlcWrite(OmronPlc, "D11", "1", "0"); - //14.D21 0 - 1 PC → PLC //夹具打开回到初始位置 - //PcToPlcWrite(OmronPlc, "D21", "0", "1"); - - PcToPlcWrite(OmronPlc, "D11", "1", "0"); - ProcessWriteInt(OmronPlc, "D21", "int", "0"); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - Thread.Sleep(1000); - PcToPlcWrite(OmronPlc, "D11", "0", "1"); - PcToPlcWrite(OmronPlc, "D21", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - - Thread.Sleep(5000);//松动时间 - - //15.D23 0 - 1 PLC → PC //夹具回到初始位置完成 - RobotsStatus = RobotsStatus.Inplace; - ProcessStatus = ProcessStatus.LoosenPLC; - - } - if (RobotsStatus == RobotsStatus.Inplace && ProcessStatus == ProcessStatus.LoosenPLC) - { - string ClamInit = ProcessReadInt(OmronPlc, "D23", "int");//夹具初始化成功 - if (ClamInit == "1") - { - ProcessWriteInt(OmronPlc, "D63", "int", "0"); - Thread.Sleep(200); - ProcessWriteInt(OmronPlc, "D63", "int", "1"); - Thread.Sleep(200); - ProcessWriteInt(OmronPlc, "D63", "int", "0"); - //TyrePos = 0; - // ProcessStatus = ProcessStatus.TakeOffMove; - ProcessStatus = ProcessStatus.RunFinish; - RobotsStatus = RobotsStatus.Inplace; - MachineStateStep = MachineStateStep.Running; - } - - } - - #endregion -#endif - //并且夹具处于放松状态 机械手在初始位置 - //循环检测是否硫化成功 - //MachineStateStep = MachineStateStep.Running; - #region 判读硫化池下料 - - if (MachineStateStep == MachineStateStep.Running) - { - - if (WhoolSize == WhoolSize.Size17) - { - takeIN = wheel17speed; - Hooking = Lossenwheel17speed; - takeLoose = allLossenwheel17speed; - } - else if (WhoolSize == WhoolSize.Size16) - { - takeIN = wheel16speed; - Hooking = Lossenwheel16speed; - takeLoose = allLossenwheel16speed; - } - else if (WhoolSize == WhoolSize.Size18) - { - takeIN = wheel18speed; - Hooking = Lossenwheel18speed; - takeLoose = allLossenwheel18speed; - } - // 16.D61 0 - 1 PLC → PC //接收取出轮胎1指令并控制机械手到达轮胎位置+机械手在初始点 - #region 接收取出轮胎1指令并控制机械手到达轮胎位置 - String SucessPos = ProcessReadInt(OmronPlc, "D65", "int"); - if (SucessPos == "1")// && ProcessStatus == ProcessStatus.Finish) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"接受下料信号中"); - ProcessStatus = ProcessStatus.TakeOffMove; - - ProcessWriteInt(OmronPlc, "D65", "int", "0");//标识 - } - #endregion - #region 下料从硫化机抓料 - if (ProcessStatus == ProcessStatus.TakeOffMove) - { - ProcessWriteInt(OmronPlc, "D31", "int", "0");//标识 - ProcessWriteInt(OmronPlc, "D33", "int", "0");//转圈 - //ProcessWriteInt(OmronPlc, "D33", "int", "94000");//转圈 - //string TextLossenwheelspeed = "20000"; - ProcessWriteInt(OmronPlc, "D33", "int", takeIN);//转圈抓轮披测试 - PcToPlcWrite(OmronPlc, "D31", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 - ProcessStatus = ProcessStatus.TakeOffMovePLC; - // Thread.Sleep(5000);//转圈所需时间 - - } - - string ClamInit1Down = ProcessReadInt(OmronPlc, "D37", "int"); - if (ClamInit1Down == "1" && ProcessStatus == ProcessStatus.TakeOffMovePLC) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"伺服移动到位,开始下料移动"); - ProcessStatus = ProcessStatus.TakeOffMovePLC_2; - } - - - if (ProcessStatus == ProcessStatus.TakeOffMovePLC_2) - { - //通过移动电组移动到下料指定位置1 - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手下料移动进硫化机 抓住轮胎组点移动"); - NbtRobot.IConfig.RobotDownMovePoints.ForEach(points => - { - - StrRobotPoint strRobotPoint3 = ClassChangeStruct(points); - - NbtRobot.Move(strRobotPoint3, speed, true); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - Thread.Sleep(2000);//线程阻塞 - - if (NbtRobot.get_status() == 0) + RobotsStatus = RobotsStatus.Runing; + while (true) { - RobotsStatus = RobotsStatus.Wating; + if (DownCirce == DownCirce.DownCirceRuning) + break; + else + Thread.Sleep(10); } + #endregion } - - }); - if (NbtRobot.IConfig.RobotDownMovePoints.Count() == 0) - ProcessStatus = ProcessStatus.Resetting; - if (MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff && MachineStateStep != MachineStateStep.Pause) { } - else { break; } - - //机械手到达机械位置 控制夹具夹紧 - //17.D33 xxxxxxxx &D31 0-1 PC → PLC //控制夹具夹紧 - // 18.D35 0 - 1 PLC → PC //夹具夹紧完成 - //19.D33 xxxxxxxx & D31 0 - 1 PC → PLC //控制夹具夹紧 - //20.D35 0 - 1 PLC → PC //夹具夹紧完成 - ProcessStatus = ProcessStatus.TakeOff; - } - if (ProcessStatus == ProcessStatus.TakeOff) - { - - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 夹具勾紧状态以便机械手进入硫化机"); - ProcessWriteInt(OmronPlc, "D31", "int", "0");//标识 - ProcessWriteInt(OmronPlc, "D33", "int", "0");//转圈 - - //ProcessWriteInt(OmronPlc, "D33", "int", "88000"); - ProcessWriteInt(OmronPlc, "D33", "int", Hooking);//夹紧转圈测试 - //todo 松开轮胎// 11.D49 0 - 1 PLC → PC //夹具松动完成 - PcToPlcWrite(OmronPlc, "D31", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 - - - // Thread.Sleep(2000); - ProcessStatus = ProcessStatus.TakeOffCaim; - - - - - } - #endregion - - - #region 下料放到固定位置 - - String TyplcTakeup = ProcessReadInt(OmronPlc, "D37", "int"); - - if (TyplcTakeup == "1" && ProcessStatus == ProcessStatus.TakeOffCaim) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"伺服移动到位,开始下料返回指定位置"); - ProcessStatus = ProcessStatus.TakeOffPLC; - } - - if (ProcessStatus == ProcessStatus.TakeOffPLC) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手下料返回组点移动"); - //通过移动电组移动到指定位置1 - //21.D41 0 - 1 PLC → PC //机械臂取出轮胎 - NbtRobot.IConfig.RobotDownBackPoints.ForEach(points => - { - - Thread.Sleep(200);//线程阻塞 - StrRobotPoint strRobotPoint3 = ClassChangeStruct(points); - - NbtRobot.Move(strRobotPoint3, speed, true); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) + else { - Thread.Sleep(1000);//线程阻塞 - - if (NbtRobot.get_status() == 0) - { - RobotsStatus = RobotsStatus.Wating; - } + Thread.Sleep(10); } - - - // table[camera.Id] = points.X; - }); - //没有下料返回移动点组 - if (NbtRobot.IConfig.RobotDownBackPoints.Count() == 0) - ProcessStatus = ProcessStatus.Resetting; - //放置硫化好的轮胎位置 todo - //NbtRobot.Move(initPoint, speed, true); - - //RabotsStatus = RabotsStatus.Moving; - //while (RabotsStatus == RabotsStatus.Moving)//NbtRobot.get_status() !=0) - //{ - // Thread.Sleep(1000);//线程阻塞 - - // if (NbtRobot.get_status() == 0) - // { - // RabotsStatus = RabotsStatus.Wating; - // } - //} - ProcessStatus = ProcessStatus.TakeOffPoint; - } - - if (ProcessStatus == ProcessStatus.TakeOffPoint) - { - - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 夹具抓紧以便机械手进入硫化机"); - ProcessWriteInt(OmronPlc, "D31", "int", "0");//标识 - ProcessWriteInt(OmronPlc, "D33", "int", "0");//转圈 - - //ProcessWriteInt(OmronPlc, "D33", "int", "94000"); - // string TextLossenwheelspeed = "20000"; - ProcessWriteInt(OmronPlc, "D33", "int", takeLoose);//夹紧转圈测试 - //todo 松开轮胎// 11.D49 0 - 1 PLC → PC //夹具松动完成 - PcToPlcWrite(OmronPlc, "D31", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D31", "1", "0");//重置转圈PLC标识 - - - // Thread.Sleep(2000); - ProcessStatus = ProcessStatus.TakeOffPointCaim; - - - - } - - String TyplcTakeup2 = ProcessReadInt(OmronPlc, "D37", "int"); - - if (TyplcTakeup2 == "1" && ProcessStatus == ProcessStatus.TakeOffPointCaim) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"伺服移动到位,开始下料返回指定位置"); - ProcessStatus = ProcessStatus.TakeOffPointCaimFlag; - } - if (ProcessStatus == ProcessStatus.TakeOffPointCaimFlag) - { - LogAsync(DateTime.Now, LogLevel.Detail, $"{TyrePos} 机械手初始化"); - //22.D43 0 - 1 PC → PLC //取出轮胎完成 - //23.D21 0 - 1 PC → PLC //夹具打开放下轮胎 - //24.D23 0 - 1 PLC → PC //夹具打开放下轮胎完成 - //25.D11 0 - 1 PC → PLC //机械手回归初始位置…… - ProcessWriteInt(OmronPlc, "D67", "int", "0"); - ProcessWriteInt(OmronPlc, "D21", "int", "0"); - - PcToPlcWrite(OmronPlc, "D67", "0", "1"); - PcToPlcWrite(OmronPlc, "D21", "0", "1"); - Thread.Sleep(200);//线程阻塞 - ProcessWriteInt(OmronPlc, "D67", "int", "0"); - ProcessWriteInt(OmronPlc, "D21", "int", "0"); - ProcessStatus = ProcessStatus.TakeOffWhool; - } - String TyplcScuessing = ProcessReadInt(OmronPlc, "D23", "int"); - if (TyplcScuessing == "1" && ProcessStatus == ProcessStatus.TakeOffWhool) - { - ProcessStatus = ProcessStatus.Init; - MachineStateStep = MachineStateStep.Ready;//跳出循环 - Thread.Sleep(2000);//线程阻塞 - } - - //17.Dxx 0 - 1 PC → PLC //机械手回归初始位置且夹具打开回到初始位置(= 第二步)下一次循环 - - #endregion + } + break; } - - #endregion - - - - }; - - Thread.Sleep(200); + } }); - //LogAsync(DateTime.Now, LogLevel.Information, $"产品{p.Id}获取结果:{p.ProductResult} {(p.IsA2B ? "产品IsA2B" : "")}"); + LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!"); PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null); return new ProcessResponse(true); } + + #region 手动操作流程 /// /// 手动拧紧鼠标按下 @@ -1711,7 +672,7 @@ namespace BRS.Process.A020 else { ProcessWriteInt(MelsecPLC, addD3, "int", "0");//D3置0 - + ProcessWriteInt(MelsecPLC, addD171, "int", "3000");//最大扭矩3000 ProcessWriteInt(MelsecPLC, addD51, "int", "1");//手动拧紧螺丝D51置1 @@ -1806,7 +767,7 @@ namespace BRS.Process.A020 { ShaftOperateOnce(MelsecPLC, addD1, 500);//D1置1延时500后置0 - + }); @@ -1859,7 +820,7 @@ namespace BRS.Process.A020 else { ProcessWriteInt(MelsecPLC, addD3, "int", "1");//D3置0 - + ProcessWriteInt(MelsecPLC, addD51, "int", "0");//手动拧紧螺丝D51置1 machineState = MachineState.Pause;//设备暂停 LogAsync(DateTime.Now, LogLevel.Detail, "设备已关闭"); @@ -1967,7 +928,7 @@ namespace BRS.Process.A020 machineState = MachineState.Running; ProcessStatus = ProcessStatus.Init; MachineStateStep = MachineStateStep.Ready; - Task.Run(()=> + Task.Run(() => { while (machineState == MachineState.Running && MachineStateStep != MachineStateStep.Pause) { @@ -2082,7 +1043,6 @@ namespace BRS.Process.A020 } #endregion - /// /// 进入自动化控制进程,完成系列动作 /// @@ -2097,6 +1057,7 @@ namespace BRS.Process.A020 LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候..."); var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; + var TcpSeverBase1 = DeviceCollection.Find(d => d is TCPSeverBase && d.InitialConfig.Name == "ListenerA") as TCPSeverBase; string addD201 = "D201";//通讯故障检查地址 string addD19 = "D19";//急停状态检查地址 @@ -2150,6 +1111,172 @@ namespace BRS.Process.A020 return new ProcessResponse(true); } + + + /// + /// 使机器人回到初始位置 + /// + /// + /// + public void KawasakiRobotInit(KawasakiTCPSeverRobotDriver kawasakiRobot) + { + RobotPoint robotInitPoint = kawasakiRobot.IIConfig.RobotInitPosition;//机器人初始点 + StrRobotPoint initPoint = ClassChangeStruct(robotInitPoint); + StrRobotPoint currentP; + if (IsTesting) + currentP = initPoint; + else + currentP = KawasakiRobotGetPose(kawasakiRobot);//获取机械臂当前位置 + + if (currentP.A != initPoint.A || currentP.B != initPoint.B || currentP.C != initPoint.C || + currentP.X != initPoint.X || currentP.Y != initPoint.Y || currentP.Z != initPoint.Z) + KawasakiRobotMove(kawasakiRobot, initPoint); + + LogAsync(DateTime.Now, LogLevel.Detail, "机械臂已在初始点"); + } + /// + /// 川崎机械臂按照单点位移动 + /// + /// 机械臂实例 + /// 需要移动到的点 + public void KawasakiRobotMove(TCPSeverBase kawasakiRobot, StrRobotPoint strPoint) + { + string strMovePoints = MoveRobotCommandLine(strPoint); + kawasakiRobot.SendMessage(strMovePoints); + LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂运动到{strMovePoints}位置"); + KawasakiRobotStatus = KawasakiRobotStatus.Runing; + while (true) + { + if (KawasakiRobotStatus == KawasakiRobotStatus.Stoped) + break; + else + Thread.Sleep(10); + } + LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂运动到{strMovePoints}位置完成!!!!"); + } + /// + /// 川崎机械臂按照规划的路径多点运动 + /// + /// 机械臂实例 + /// 移动的路径点 + /// 当前点 + public void KawasakiRobotMoves(TCPSeverBase kawasakiRobot, List points, bool isReturn) + { + //string points = MoveRobotCommandLine(strPoint); + if (isReturn) //机械手根据原路径返回,重新排列list点位 + points.Reverse(); //反序 + List strPoints = new List(); + points.ForEach(point => + { + strPoints.Add(ClassChangeStruct(point)); + //StrRobotPoint strRobotPoint = ClassChangeStruct(point); + //KawasakiRobotMove(kawasakiRobot, strRobotPoint); + }); + StrRobotPoint currentP = KawasakiRobotGetPose(kawasakiRobot); + string strMovePoints = MoveMoreNContinueRobotCommandLine(strPoints, ref currentP); + kawasakiRobot.SendMessage(strMovePoints); + LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂连续运动到{strMovePoints}位置"); + KawasakiRobotStatus = KawasakiRobotStatus.Runing; + while (true) + { + if (KawasakiRobotStatus == KawasakiRobotStatus.Stoped) + break; + else + Thread.Sleep(10); + } + LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂运动到{strMovePoints}位置完成!!!!"); + if (isReturn) //机械手根据原路径返回,重新排列list点位 + points.Reverse(); //反序 + } + /// + /// 合成川崎机器人移动路径命令 + /// + /// 需要移动的点列表 + /// 合成好的字符串命令 + public string MoveRobotCommandLine(StrRobotPoint strPoint) + { + string pointsStr = Convert.ToString(strPoint.X) + "," + Convert.ToString(strPoint.Y) + "," + Convert.ToString(strPoint.Z) + "," + + Convert.ToString(strPoint.A) + "," + Convert.ToString(strPoint.B) + "," + Convert.ToString(strPoint.C); + string STRMove = "MoveLine_NULL_1_" + pointsStr + "_"; + //string PointInit1 = "MoveLine_NULL_1_462.915,1119.150,1530.227,90.043,90.003,0.040_"; + return STRMove; + } + /// + /// 获取当前位置,返回在回调函数中 + /// + /// + public StrRobotPoint KawasakiRobotGetPose(TCPSeverBase kawasakiRobot) + { + //string points = MoveRobotCommandLine(strPoint); + StrRobotPoint strRobotPoint = new StrRobotPoint(); + kawasakiRobot.SendMessage("GetPose_"); + //LogAsync(DateTime.Now, LogLevel.Detail, $"获取机械臂当前位置"); + while (kawasakiRobot.KawasakiRobotResponse.IsEmpty() || kawasakiRobot.KawasakiRobotResponse.Equals("wanbi")) + { + LogAsync(DateTime.Now, LogLevel.Detail, $"获取机械臂当前位置"); + Thread.Sleep(500); + } + //while (kawasakiRobot.KawasakiRobotResponse.Equals("wanbi")) + //{ + // LogAsync(DateTime.Now, LogLevel.Detail, $"获取机械臂当前位置"); + // Thread.Sleep(500); + //} + if (!kawasakiRobot.KawasakiRobotResponse.IsEmpty()) + { + string[] sArray = kawasakiRobot.KawasakiRobotResponse.Split('_'); + if (sArray[0].Equals("Pose")) + { + sArray = sArray[1].Split(','); + + strRobotPoint.A = float.Parse(sArray[0]); + strRobotPoint.B = float.Parse(sArray[1]); + strRobotPoint.C = float.Parse(sArray[2]); + strRobotPoint.X = float.Parse(sArray[3]); + strRobotPoint.Y = float.Parse(sArray[4]); + strRobotPoint.Z = float.Parse(sArray[5]); + LogAsync(DateTime.Now, LogLevel.Detail, $"获取到机械臂当前位置"); + //return strRobotPoint; + } + else + { + LogAsync(DateTime.Now, LogLevel.Detail, $"未获取到机械臂当前位置"); + LogAsync(DateTime.Now, LogLevel.Detail, $"获取到的信息为{kawasakiRobot.KawasakiRobotResponse}"); + //return strRobotPoint; + } + } + + else + { + LogAsync(DateTime.Now, LogLevel.Detail, $"没有返回值"); + + } + return strRobotPoint; + + } + /// + /// 合成川崎机器人持续运动命令 + /// + /// 需要移动的点列表 + /// 当前位置 + /// 合成好的字符串命令 + public string MoveMoreNContinueRobotCommandLine(List strPoints, ref StrRobotPoint CurrentPoint) + { + string strPointsStr = null; + for (int i = 0; i < strPoints.Count; i++) + { + string pointsStr = Convert.ToString(strPoints[i].X) + "," + Convert.ToString(strPoints[i].Y) + "," + Convert.ToString(strPoints[i].Z) + "," + + Convert.ToString(strPoints[i].A) + "," + Convert.ToString(strPoints[i].B) + "," + Convert.ToString(strPoints[i].C); + strPointsStr += pointsStr + "_"; + } + //CurrentPoint = strPoints[strPoints.Count - 1]; + CurrentPoint = strPoints.Last(); + // string pointsStr2 = Convert.ToString(strPoint2.X) + "," + Convert.ToString(strPoint2.Y) + "," + Convert.ToString(strPoint2.Z) + "," + + //Convert.ToString(strPoint2.O) + "," + Convert.ToString(strPoint2.A) + "," + Convert.ToString(strPoint2.T); + string STRMove = "MoveLine_NULL_" + strPoints.Count.ToString() + "_" + strPointsStr; + //string PointInit1 = "MoveLine_NULL_1_462.915,1119.150,1530.227,90.043,90.003,0.040_"; + return STRMove; + } + /// /// 根据PLC地址操作一次扭矩轴 /// @@ -2181,52 +1308,6 @@ namespace BRS.Process.A020 ProcessWriteInt(PLC, Address, "int", status); } - - /// - /// 初始化夹爪,夹爪松开到原始位置 - /// - /// - private void GripperInit(PLCBase PLC) - { - ProcessWriteInt(PLC, "D21", "int", "0"); - ProcessWriteInt(PLC, "D21", "int", "1"); - Thread.Sleep(1000); - ProcessWriteInt(PLC, "D21", "int", "0"); - - string addr23 = ProcessReadInt(PLC, "D23", "int"); - //D23 0→1 说明夹爪初始化完成 - while (addr23 == "0") - { - Thread.Sleep(100); - addr23 = ProcessReadInt(PLC, "D23", "int"); - } - } - - /// - /// 移动夹爪 - /// - /// PLC驱动 - /// 运动距离 - private void GripperMove(PLCBase PLC, string distence) - { - PcToPlcWrite(PLC, "D31", "1", "0");//夹爪置0 - ProcessWriteInt(PLC, "D33", "int", distence);//设置夹爪运动距离 - ProcessWriteInt(PLC, "D31", "int", "1");//夹爪开始运动 - Thread.Sleep(2000); - - string addr37 = ProcessReadInt(PLC, "D37", "int"); - //D37 0→1 说明夹爪运动完成 - while (addr37 == "0") - { - Thread.Sleep(10); - //addr37 = ProcessReadInt(PLC, "D23", "int"); - addr37 = ProcessReadInt(PLC, "D37", "int"); - } - - LogAsync(DateTime.Now, LogLevel.Detail, $"夹爪运动到{distence}位置"); - PcToPlcWrite(PLC, "D31", "1", "0");//夹爪置0 - } - enum MoveState { UpFasten = 0, @@ -2235,179 +1316,12 @@ namespace BRS.Process.A020 DownLoosen, } - /// - /// 根据轮胎尺寸、要移动的位置,获取夹爪移动绝对位置 - /// - /// robot驱动 - /// 轮胎尺寸 - /// 要移动的位置,0为上料夹紧点,1为上料放松点,2为下料夹紧点,3为下料放松点 - private string GetGripperPosByTyreSize(RobotBase robot, int tyreSize, MoveState state) - { - string position = "error"; - switch (tyreSize) - { - case 12: - List listPositionWheel12 = new List(); - listPositionWheel12.Add(robot.IConfig.Wheel12GripperUpFasten); - listPositionWheel12.Add(robot.IConfig.Wheel12GripperUpLoosen); - listPositionWheel12.Add(robot.IConfig.Wheel12GripperDownFasten); - listPositionWheel12.Add(robot.IConfig.Wheel12GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel12); - break; - case 13: - List listPositionWheel13 = new List(); - listPositionWheel13.Add(robot.IConfig.Wheel13GripperUpFasten); - listPositionWheel13.Add(robot.IConfig.Wheel13GripperUpLoosen); - listPositionWheel13.Add(robot.IConfig.Wheel13GripperDownFasten); - listPositionWheel13.Add(robot.IConfig.Wheel13GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel13); - break; - case 14: - List listPositionWheel14 = new List(); - listPositionWheel14.Add(robot.IConfig.Wheel14GripperUpFasten); - listPositionWheel14.Add(robot.IConfig.Wheel14GripperUpLoosen); - listPositionWheel14.Add(robot.IConfig.Wheel14GripperDownFasten); - listPositionWheel14.Add(robot.IConfig.Wheel14GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel14); - break; - case 15: - List listPositionWheel15 = new List(); - listPositionWheel15.Add(robot.IConfig.Wheel15GripperUpFasten); - listPositionWheel15.Add(robot.IConfig.Wheel15GripperUpLoosen); - listPositionWheel15.Add(robot.IConfig.Wheel15GripperDownFasten); - listPositionWheel15.Add(robot.IConfig.Wheel15GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel15); - break; - case 16: - List listPositionWheel16 = new List(); - listPositionWheel16.Add(robot.IConfig.Wheel16GripperUpFasten); - listPositionWheel16.Add(robot.IConfig.Wheel16GripperUpLoosen); - listPositionWheel16.Add(robot.IConfig.Wheel16GripperDownFasten); - listPositionWheel16.Add(robot.IConfig.Wheel16GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel16); - break; - case 17: - List listPositionWheel17 = new List(); - listPositionWheel17.Add(robot.IConfig.Wheel17GripperUpFasten); - listPositionWheel17.Add(robot.IConfig.Wheel17GripperUpLoosen); - listPositionWheel17.Add(robot.IConfig.Wheel17GripperDownFasten); - listPositionWheel17.Add(robot.IConfig.Wheel17GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel17); - break; - case 18: - List listPositionWheel18 = new List(); - listPositionWheel18.Add(robot.IConfig.Wheel18GripperUpFasten); - listPositionWheel18.Add(robot.IConfig.Wheel18GripperUpLoosen); - listPositionWheel18.Add(robot.IConfig.Wheel18GripperDownFasten); - listPositionWheel18.Add(robot.IConfig.Wheel18GripperDownLoosen); - position = GetGripperPosByMoveState(robot, state, listPositionWheel18); - break; - default: - break; - } - return position; - } - - private string GetGripperPosByMoveState(RobotBase robot, MoveState state, List listPosition) - { - string position = "error"; - switch (state) - { - case MoveState.UpFasten: - position = listPosition[0]; - break; - case MoveState.UpLoosen: - position = listPosition[1]; - break; - case MoveState.DownFasten: - position = listPosition[2]; - break; - case MoveState.DownLoosen: - position = listPosition[3]; - break; - default: - break; - } - - return position; - } - /// - /// 机器人移动至单点 - /// - /// 机器人实例 - /// 需要移动到的点位 - /// 移动速度 - private void NbtRobotMove(RobotBase robot, StrRobotPoint point, int speed) - { - if (RobotsStatus != RobotsStatus.Pweroff) - robot.Move(point, speed, true); - LogAsync(DateTime.Now, LogLevel.Detail, $"机械臂运动到X:{point.X}, Y:{point.Y}, Z:{point.Z}位置"); - RobotsStatus = RobotsStatus.Moving; - while (RobotsStatus == RobotsStatus.Moving)//NbtRobot.get_status() !=0) - { - Thread.Sleep(2000); - - if (IsTesting) - RobotsStatus = RobotsStatus.Wating; - else if (robot.get_status() == 0) - RobotsStatus = RobotsStatus.Wating; - } - } - - /// - /// 机器人按照设置中的移动路径多点运动 - /// - /// 机器人实例 - /// List 配置中定义的路径点 - /// 移动速度 - private void NbtRobotMoves(RobotBase robot, List points, int speed, bool isReturn) - { - if (isReturn) //机械手根据原路径返回,重新排列list点位 - { - points.Reverse(); //反序 - } - points.ForEach(point => - { - StrRobotPoint strRobotPoint = ClassChangeStruct(point); - NbtRobotMove(robot, strRobotPoint, speed); - }); - if (isReturn) //机械手根据原路径返回,重新排列list点位 - { - points.Reverse(); //反序 - } - } - - /// - /// 机器人初始化,回到原位置 - /// - /// - private void NbtRobotInit(RobotBase robot) - { - int speed = 1000; - RobotPoint robotInitPoint = robot.IConfig.RobotInitPosition;//机器人初始点 - StrRobotPoint initPoint = ClassChangeStruct(robotInitPoint); - StrRobotPoint currentP; - if (IsTesting) - currentP = initPoint; - else - currentP = robot.GetPosition();//获取机械臂当前位置 - - if (currentP.A != initPoint.A || currentP.B != initPoint.B || currentP.C != initPoint.C || - currentP.X != initPoint.X || currentP.Y != initPoint.Y || currentP.Z != initPoint.Z) - NbtRobotMove(robot, initPoint, speed); - LogAsync(DateTime.Now, LogLevel.Detail, "机械臂已在初始点"); - } - - - enum DataType { INT = 0, STRING, FLOAT, - } - private string ProcessReadInt(PLCBase PLC, string address, string type, ushort length = 10) { Stopwatch sw = new Stopwatch(); @@ -2469,30 +1383,9 @@ namespace BRS.Process.A020 // lblElapsed.Text = sw.ElapsedMilliseconds.ToString(); } - private void ProcessStartTimer(object state) - { - //isMidFeedingProductFlag = true; - //UpdateTriggerCount(DateTime.Now, "中转推料上料触发"); - //LogAsync(DateTime.Now, LogLevel.Information, $"中转推料上料触发"); - //if (state is MidFeedingProductOpConfig midFeedingConfig) - //{ - // Stopwatch stopWatch = new Stopwatch(); - // stopWatch.Start(); - // MotionCardOperationConfigBase operationConfig = new MotionCardOperationConfigBase(); - // midFeedingConfig.FeedingProductMotionCardOperationSet.DelayAfter = midFeedingConfig.FeedingInterval; - // operationConfig.OperationCollection.Add(midFeedingConfig.FeedingProductMotionCardOperationSet); - // operationConfig.OperationCollection.Add(midFeedingConfig.MoveBackMotionCardOperationSet); - // _mainMotion.Run(operationConfig); - // stopWatch.Stop(); - // LogAsync(DateTime.Now, LogLevel.Information, $"中转推料上料耗时{stopWatch.ElapsedMilliseconds}ms"); - //} - - //isMidFeedingProductFlag = false; - } - [ProcessMethod("", "ResetProcess", "主流程复位", InvokeType.TestInvoke)] - public ProcessResponse ResetProcess(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) + public ProcessResponse ResetProcess(IOperationConfig config, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { if (MachineState == MachineState.Running) { @@ -2530,69 +1423,23 @@ namespace BRS.Process.A020 LogAsync(DateTime.Now, LogLevel.Warning, $"警告:当前状态,无法大复位"); return; } - MachineState = MachineState.Resetting; WarningRemains.Clear(); - - //清除报警 ResetAlarm(true); //清料流程 ClearProduct(null, null, null); - ////流程 关闭 操作配置 //A020Config.ProcessCloseOps.FindAll(u => u.IsEnabled).ForEach(bind => //{ // var device = DeviceCollection.FirstOrDefault(u => u.Id == bind.Device); // device.RunWrap(bind.OpConfig); //}); - MachineState = MachineState.Ready; } - private void PrepareMLEngine() - { - //_cameraRelatedVisionEngine = new Dictionary(); - //_cameraRelatedDetectionDict = new Dictionary(); - //// List detectionList=new List(); - //DeviceCollection.Where(d => d is VisionEngineBase && d.InitialConfig.IsEnabled) - // .ForEach(d => - //{ - // var _visionEngine = d as VisionEngineBase;// DeviceCollection.FirstOrDefault(u => u is VisionEngineBase) as VisionEngineBase; - - // _visionEngine.BatchNO = BatchNO; - - // // 将配置中的检测配置与相机配置关联为字典 - // List detectionList = _visionEngine.IConfig.DetectionConfigs.Where(u => u.IsEnabled).ToList(); - // if (0 == detectionList.Count) - // { - // throw new Exception(" 没有启用的检测配置"); - // } - - // detectionList.ForEach(detectConf => - // { - // string camId = detectConf.CameraSourceId; - // // 相机与VisionEngine关联字典 - // if (!_cameraRelatedVisionEngine.Keys.Contains(camId)) - // { - // _cameraRelatedVisionEngine.Add(detectConf.CameraSourceId, _visionEngine); - // } - // // 相机与检测配置关联字典 - // if (!_cameraRelatedDetectionDict.Keys.Contains(camId)) - // { - // _cameraRelatedDetectionDict.Add(detectConf.CameraSourceId, detectConf.Id); - // } - // }); - - - //}); - - } - - - private void PrepareMotion() { ResetTimer = new System.Threading.Timer(FullResetProcessExcute, null, -1, -1); @@ -2600,26 +1447,9 @@ namespace BRS.Process.A020 // this.OnUpdateResult += UpdateResult; } - - [ProcessMethod("", "CloseProcess", "主流程停止", InvokeType.TestInvoke)] - public BRS.Common.Model.ProcessResponse CloseProcess(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) + public BRS.Common.Model.ProcessResponse CloseProcess(IOperationConfig config, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { - var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - if (!IsTesting) - NbtRobot.power_off(); - - MachineState = MachineState.Ready; - MachineStateStep = MachineStateStep.Pause; - - RobotsStatus = RobotsStatus.Pweroff;//初始点位 - ProcessStatus = ProcessStatus.Resetting; - - PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), false, null); - return new ProcessResponse(true); - - - if (_productQueue.Count > 0) { //var res = UIMessageDialog.ShowMessageDialog("警告:当前产品队列个数大于0,产品还未检测完成,或触发计数不一致,确定停止流程?", UILocalize.ErrorTitle, false, UIStyle.Red, true, false); @@ -2628,20 +1458,32 @@ namespace BRS.Process.A020 // return new ProcessResponse(true); //} } - //ProcessState = DeviceState.DSClose; + //关闭相机 + //try + //{ + // if (m_dev == null) + // { + // throw new InvalidOperationException("Device is invalid"); + // } + + // m_dev.StreamGrabber.ImageGrabbed -= OnImageGrabbed; /* 反注册回调 */ + // m_dev.ShutdownGrab(); /* 停止码流 */ + // m_dev.Close(); /* 关闭相机 */ + //} + //catch (Exception exception) + //{ + + //} + + PLCStateWarm = PLCStateWarm.ProStop; + OnPLCStateChanged?.Invoke(PLCStateWarm); MachineState = MachineState.Closing; - MachineStateStep = MachineStateStep.Pause; - RobotsStatus = RobotsStatus.Pweroff;//初始点位 - ProcessStatus = ProcessStatus.Resetting; + LogAsync(DateTime.Now, LogLevel.Information, "流程停止,清料中..."); - - //保存 生产数据 CloseStatisticTimers(); - //var OmronPlc = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - //var NbtRobot = DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - NbtRobot.power_off(); + //SaveProductionStatisticsAsync(); if (_productQueue.Count > 0) { @@ -2652,11 +1494,8 @@ namespace BRS.Process.A020 return new ProcessResponse(true); } #endregion - - - [ProcessMethod("", "ClearProduct", "设备清料", InvokeType.TestInvoke)] - public ProcessResponse ClearProduct(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) + public ProcessResponse ClearProduct(IOperationConfig opConfig, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { if (MachineState != MachineState.Ready && MachineState != MachineState.Resetting) { @@ -2670,7 +1509,7 @@ namespace BRS.Process.A020 } [ProcessMethod("", "PrintLog", "打印日志", InvokeType.TestInvoke)] - public ProcessResponse PrintLog(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) + public ProcessResponse PrintLog(IOperationConfig opConfig, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { LogAsync(DateTime.Now, LogLevel.Warning, $"打印日志志0000"); if (MachineState != MachineState.Ready && MachineState != MachineState.Resetting) @@ -2685,7 +1524,7 @@ namespace BRS.Process.A020 } [ProcessMethod("", "PrintLog2", "打印日志2", InvokeType.TestInvoke)] - public ProcessResponse PrintLog2(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) + public ProcessResponse PrintLog2(IOperationConfig opConfig, Common.Interface.IDevice invokeDevice, Common.Interface.IDevice sourceDevice) { LogAsync(DateTime.Now, LogLevel.Warning, $"打印日志志000022222222222222"); if (MachineState != MachineState.Ready && MachineState != MachineState.Resetting) diff --git a/src/BRS.Process.A020/A020Process_VisionProcessor.cs b/src/BRS.Process.A020/A020Process_VisionProcessor.cs index f15a140..994414f 100644 --- a/src/BRS.Process.A020/A020Process_VisionProcessor.cs +++ b/src/BRS.Process.A020/A020Process_VisionProcessor.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; using static BRS.Common.Model.Helper.EnumHelper; @@ -17,8 +18,151 @@ namespace BRS.Process.A020 { // public HTuple ModelIds; + double CurrentDgree = 0;//累加的角度 + int CurrentQuanShu = 0;//当前转的圈数 + int SpecicalLs1 = 0;//侧模特殊螺丝的数组索引 + + void GetCornerPoint(List VP, List VR, MyPoint Tp, ref Corner CP, ref Corner CR) + { + List vPLU = new List(); + List vPRU = new List(); + List vPLD = new List(); + List vPRD = new List(); + for (int i = 0; i < VP.Count; i++) + { + if (VP[i].dX <= Tp.dX && VP[i].dY <= Tp.dY) + vPLU.Add(VP[i]); + if (VP[i].dX > Tp.dX && VP[i].dY < Tp.dY) + vPRU.Add(VP[i]); + if (VP[i].dX < Tp.dX && VP[i].dY > Tp.dY) + vPLD.Add(VP[i]); + if (VP[i].dX > Tp.dX && VP[i].dY > Tp.dY) + vPRD.Add(VP[i]); + } + + if (vPLU.Count() == 0 || vPRU.Count() == 0 || vPLD.Count() == 0 || vPRD.Count() == 0) + { + CP.LU.dX = -99999; + return; + } + int iIndex = 0; + GetNerastPoint(vPLU, Tp, ref CP.LU, ref iIndex); + GetNerastPoint(vPRU, Tp, ref CP.RU, ref iIndex); + GetNerastPoint(vPLD, Tp, ref CP.LD, ref iIndex); + GetNerastPoint(vPRD, Tp, ref CP.RD, ref iIndex); + MyPoint MP; + MP.dX = 0; + MP.dY = 0; + GetNerastPoint(VP, CP.LU, ref MP, ref iIndex); + CR.LU = VR[iIndex]; + + GetNerastPoint(VP, CP.RU, ref MP, ref iIndex); + CR.RU = VR[iIndex]; + + GetNerastPoint(VP, CP.LD, ref MP, ref iIndex); + CR.LD = VR[iIndex]; + + GetNerastPoint(VP, CP.RD, ref MP, ref iIndex); + CR.RD = VR[iIndex]; + } + void GetNerastPoint(List VP, MyPoint Tp, ref MyPoint VN, ref int Index) + { + int iL = 100000000; + VN = VP[0]; + Index = 0; + for (int i = 0; i < VP.Count(); i++) + { + int iL2 = (int)((VP[i].dX - Tp.dX) * (VP[i].dX - Tp.dX) + (VP[i].dY - Tp.dY) * (VP[i].dY - Tp.dY)); + if (iL2 < iL) + { + iL = iL2; + VN = VP[i]; + Index = i; + } + } + } + MyPoint Interpolation(List VP, List VR, MyPoint Tp, bool bTran) + { + + Corner CP = new Corner(); + + Corner CR = new Corner(); + GetCornerPoint(VP, VR, Tp, ref CP, ref CR); + MyPoint MR; + if (CP.LU.dX < -99998) + { + MR.dX = -9999999; + MR.dY = -9999999; + return MR; + } + if (bTran == true) + { + double dTm; + dTm = CR.LU.dX; + CR.LU.dX = CR.LU.dY; + CR.LU.dY = dTm; + + dTm = CR.RU.dX; + CR.RU.dX = CR.RU.dY; + CR.RU.dY = dTm; + + dTm = CR.LD.dX; + CR.LD.dX = CR.LD.dY; + CR.LD.dY = dTm; + + dTm = CR.RD.dX; + CR.RD.dX = CR.RD.dY; + CR.RD.dY = dTm; + } + + MyPoint PU; + PU.dX = 0; PU.dY = 0; + MyPoint RU; + RU.dX = 0; RU.dY = 0; + MyPoint PD; + PD.dX = 0; PD.dY = 0; + MyPoint RD; + RD.dX = 0; RD.dY = 0; + GetUpPoint(CP, CR, Tp, ref PU, ref RU); + GetDownPoint(CP, CR, Tp, ref PD, ref RD); + + float fDU = (float)(Tp.dY - PU.dY); + float fDA = (float)(PD.dY - PU.dY); + + float fX = (float)(RU.dX * (1 - fDU / fDA) + RD.dX * fDU / fDA); + float fY = (float)(RU.dY * (1 - fDU / fDA) + RD.dY * fDU / fDA); ; + + + if (bTran == true) + { + MR.dX = fY; + MR.dY = fX; + } + else + { + MR.dX = fX; + MR.dY = fY; + } + return MR; + } + + void GetUpPoint(Corner CP, Corner CR, MyPoint Tp, ref MyPoint PU, ref MyPoint RU) + { + PU.dX = Tp.dX; + PU.dY = (Tp.dX - CP.LU.dX) * 1.0 / (CP.RU.dX - CP.LU.dX) * (CP.RU.dY - CP.LU.dY) + CP.LU.dY; + RU.dX = (PU.dX - CP.LU.dX) * 1.0 / (CP.RU.dX - CP.LU.dX) * (CR.RU.dX - CR.LU.dX) + CR.LU.dX; + RU.dY = (PU.dY - CP.LU.dY) * 1.0 / (CP.RU.dY - CP.LU.dY) * (CR.RU.dY - CR.LU.dY) + CR.LU.dY; + } + + void GetDownPoint(Corner CP, Corner CR, MyPoint Tp, ref MyPoint PD, ref MyPoint RD) + { + PD.dX = Tp.dX; + PD.dY = (Tp.dX - CP.LD.dX) * 1.0 / (CP.RD.dX - CP.LD.dX) * (CP.RD.dY - CP.LD.dY) + CP.LD.dY; + RD.dX = (PD.dX - CP.LD.dX) * 1.0 / (CP.RD.dX - CP.LD.dX) * (CR.RD.dX - CR.LD.dX) + CR.LD.dX; + RD.dY = (PD.dY - CP.LD.dY) * 1.0 / (CP.RD.dY - CP.LD.dY) * (CR.RD.dY - CR.LD.dY) + CR.LD.dY; + } /// /// 相机拍摄图片后的回调函数 /// @@ -190,8 +334,94 @@ namespace BRS.Process.A020 // }); //} + private void TCPseverDriver_OnDataReceived(byte[] obj) + { + bool fin = false; + string msg = string.Empty; + // LogAsync(DateTime.Now, LogLevel.Action, obj.); + msg = Encoding.Default.GetString(obj); + LogAsync(DateTime.Now, LogLevel.Action, msg); + if (obj.Length > 0) + fin = true; + + Console.WriteLine(DateTime.Now + "=============================================================wanbi" + CurrentDgree.ToString() + " " + CurrentQuanShu.ToString() + " 次数" + SpecicalLs1.ToString()); + + #region 流程2边移动第七轴边动边机械臂移动到某个点 + if (ProcessStatus == ProcessStatus.Init && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + ProcessStatus = ProcessStatus.InitPlc; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + #endregion + #region 初始示教点移动 + + if (ProcessStatus == ProcessStatus.MoveInit && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + ProcessStatus = ProcessStatus.Measure; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + #endregion + #region 测距信息正常则流程打开光源 若不正常继续移动机械臂直到正常 + if (ProcessStatus == ProcessStatus.Measure && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + DownCirce = DownCirce.DownCirceRuning; + ProcessStatus = ProcessStatus.OpenLight; + RobotsStatus = RobotsStatus.Release; + } + #endregion + #region 视觉定位 + if (ProcessStatus == ProcessStatus.CVLocation && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + //ProcessStatus = ProcessStatus.StartRunDown; + ProcessStatus = ProcessStatus.StartRun; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + if (ProcessStatus == ProcessStatus.StartRunDown && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + ProcessStatus = ProcessStatus.StartRun; + RobotsStatus = RobotsStatus.Release; + DownCirce = DownCirce.DownCirceRuning; + } + if (ProcessStatus == ProcessStatus.StartRun && RobotsStatus == RobotsStatus.Runing && msg == "wanbi") + { + msg = string.Empty; + ProcessStatus = ProcessStatus.StartRuning; + RobotsStatus = RobotsStatus.Release; + } + #endregion + + + } + /// + /// 示教标定点+偏移量=拍摄螺丝点 + /// + /// + /// + /// + public StrRobotPoint CQRobotPointChangeStrRobotPoint(CQRobotPoint cQRobotPoint, VPVRPoint vPVRPoint) + { + float X_dev = vPVRPoint.X; + float Y_dev = vPVRPoint.Y; + float Z_dev = vPVRPoint.Z; + StrRobotPoint strRobotPoint = new StrRobotPoint(); + strRobotPoint.X = cQRobotPoint.X + X_dev; + strRobotPoint.Y = cQRobotPoint.Y + Y_dev; + strRobotPoint.Z = cQRobotPoint.Z + Z_dev; + strRobotPoint.A = cQRobotPoint.O; + strRobotPoint.B = cQRobotPoint.A; + strRobotPoint.C = cQRobotPoint.T; + return strRobotPoint; + } private void BlowTaskExcute(int delayBlow) { diff --git a/src/BRS.Process.A020/BRS.Process.A020.csproj b/src/BRS.Process.A020/BRS.Process.A020.csproj index af81fcd..2be75d3 100644 --- a/src/BRS.Process.A020/BRS.Process.A020.csproj +++ b/src/BRS.Process.A020/BRS.Process.A020.csproj @@ -1,5 +1,6 @@  + Debug @@ -13,6 +14,8 @@ 512 true + + true @@ -43,6 +46,10 @@ False ..\Release\BRS.UI.Device.Winform.dll + + False + C:\Program Files\DahuaTech\MV Viewer\Development\DOTNET DLL\DOTNET_4.0\x86\CLIDelegate.dll + ..\..\packages\HZH_Controls.1.0.14\lib\net40\HZH_Controls.dll @@ -56,6 +63,18 @@ ..\..\packages\OpenCvSharp4.4.6.0.20220608\lib\netstandard2.0\OpenCvSharp.dll True + + ..\..\packages\OpenCvSharp4.Extensions.4.5.5.20211231\lib\netstandard2.0\OpenCvSharp.Extensions.dll + + + ..\..\packages\STTech.BytesIO.Core.2.9.3\lib\net45\STTech.BytesIO.Core.dll + + + ..\..\packages\STTech.BytesIO.Tcp.2.9.3\lib\net45\STTech.BytesIO.Tcp.dll + + + ..\..\packages\STTech.CodePlus.1.4.0\lib\net45\STTech.CodePlus.dll + ..\..\packages\SunnyUI.3.3.1\lib\net40\SunnyUI.dll @@ -73,6 +92,9 @@ ..\..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + ..\..\packages\System.Drawing.Common.5.0.3\lib\net461\System.Drawing.Common.dll + ..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll @@ -95,6 +117,10 @@ + + False + C:\Program Files\DahuaTech\MV Viewer\Development\DOTNET DLL\DOTNET_4.0\x86\ThridLibray.dll + ..\..\packages\DockPanelSuite.3.1.0\lib\net40\WeifenLuo.WinFormsUI.Docking.dll @@ -130,12 +156,6 @@ ContorlShaft.cs - - Form - - - ControlSet.cs - Form @@ -164,10 +184,6 @@ {1a3cbfe7-3f78-42c3-95c5-10360450dbea} BRS.Common.Model - - {560cc80b-389b-46fc-9b8c-da1d62a555d9} - BRS.Device.OmronPLC - {197c5aa8-9609-4d1c-b1e3-5879006eaaf4} BRS.Process @@ -176,6 +192,10 @@ {741f6491-57c7-479a-b391-09bba9fba9dc} BRS.UI.Model.Winform + + {91739e90-6a8e-433d-b244-5325f8848064} + XKRS.Device.TCPSever + @@ -196,9 +216,6 @@ ContorlShaft.cs - - ControlSet.cs - OperationFrm.cs @@ -209,10 +226,19 @@ VisionDebugForm.cs + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + \ No newline at end of file diff --git a/src/BRS.Process.A020/ContolPlc.cs b/src/BRS.Process.A020/ContolPlc.cs index d53cdeb..6f36303 100644 --- a/src/BRS.Process.A020/ContolPlc.cs +++ b/src/BRS.Process.A020/ContolPlc.cs @@ -192,33 +192,7 @@ namespace BRS.Process.A020.UI /// private void button2_2_Click(object sender, EventArgs e) { - var OmronPlc = Process_A020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - var NbtRobot = Process_A020.DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - RobotPoint x1 = NbtRobot.IConfig.RobotInitPosition; //NbtRobot.IConfig.X1Point; - StrRobotPoint initPoint = ClassChangeStruct(x1); - int speed = 1000;//机械臂运动速度 m/s - //机械手回到初始点 - NbtRobot.Move(initPoint, speed, true); - int stop_ss=1; - while (stop_ss==1) - { - Thread.Sleep(1000); - - if (NbtRobot.get_status() == 0) - { - stop_ss = 0; ; - } - } - //2.D11 1-0 PC→PLC //机械手复位回到初始点完成 - // 3.D21 0 - 1 PC → PLC //夹具打开回到初始位置 - PcToPlcWrite(OmronPlc, "D11", "1", "0"); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - Thread.Sleep(1000); - PcToPlcWrite(OmronPlc, "D11", "0", "1"); - PcToPlcWrite(OmronPlc, "D21", "0", "1"); - Thread.Sleep(200); - PcToPlcWrite(OmronPlc, "D21", "1", "0"); - //Thread.Sleep(15000); + } /// diff --git a/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs b/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs index 7a79165..12af6d6 100644 --- a/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs +++ b/src/BRS.Process.A020/UI/ContorlShaft.Designer.cs @@ -69,12 +69,21 @@ namespace BRS.Process.A020.UI this.LightSeries = new Sunny.UI.UIPanel(); this.label12 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); + this.ManualLight = new BRS.Process.A020.UI.CircleButton(); + this.AutoLight = new BRS.Process.A020.UI.CircleButton(); + this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton(); + this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton(); + this.ToughLight1 = new BRS.Process.A020.UI.CircleButton(); + this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.uiPanel2 = new Sunny.UI.UIPanel(); this.label14 = new System.Windows.Forms.Label(); + this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton(); + this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton(); + this.ESBtn = new BRS.Process.A020.UI.CircleButton(); this.TestBtn = new Sunny.UI.UIButton(); this.StopBtn2 = new Sunny.UI.UIButton(); this.StartBtn1 = new Sunny.UI.UIButton(); @@ -86,15 +95,6 @@ namespace BRS.Process.A020.UI this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.uiButton1 = new Sunny.UI.UIButton(); this.timer2 = new System.Windows.Forms.Timer(this.components); - this.ManualLight = new BRS.Process.A020.UI.CircleButton(); - this.AutoLight = new BRS.Process.A020.UI.CircleButton(); - this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton(); - this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton(); - this.ToughLight1 = new BRS.Process.A020.UI.CircleButton(); - this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton(); - this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton(); - this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton(); - this.ESBtn = new BRS.Process.A020.UI.CircleButton(); ((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit(); this.uiPanel1.SuspendLayout(); this.BtnSeries.SuspendLayout(); @@ -258,11 +258,11 @@ namespace BRS.Process.A020.UI this.BtnSeries.Controls.Add(this.AutoLoosenBtn1); this.BtnSeries.Controls.Add(this.ManualToughBtn); this.BtnSeries.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.BtnSeries.Location = new System.Drawing.Point(335, 201); + this.BtnSeries.Location = new System.Drawing.Point(352, 155); this.BtnSeries.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.BtnSeries.MinimumSize = new System.Drawing.Size(1, 1); this.BtnSeries.Name = "BtnSeries"; - this.BtnSeries.Size = new System.Drawing.Size(368, 345); + this.BtnSeries.Size = new System.Drawing.Size(367, 391); this.BtnSeries.TabIndex = 40; this.BtnSeries.Text = null; this.BtnSeries.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -353,11 +353,11 @@ namespace BRS.Process.A020.UI this.ParameterSetting.Controls.Add(this.textBox3); this.ParameterSetting.Controls.Add(this.label8); this.ParameterSetting.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.ParameterSetting.Location = new System.Drawing.Point(12, 201); + this.ParameterSetting.Location = new System.Drawing.Point(12, 152); this.ParameterSetting.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.ParameterSetting.MinimumSize = new System.Drawing.Size(1, 1); this.ParameterSetting.Name = "ParameterSetting"; - this.ParameterSetting.Size = new System.Drawing.Size(317, 345); + this.ParameterSetting.Size = new System.Drawing.Size(332, 394); this.ParameterSetting.TabIndex = 39; this.ParameterSetting.Text = null; this.ParameterSetting.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -522,7 +522,7 @@ namespace BRS.Process.A020.UI this.LightSeries.Controls.Add(this.label3); this.LightSeries.Controls.Add(this.label4); this.LightSeries.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LightSeries.Location = new System.Drawing.Point(189, 12); + this.LightSeries.Location = new System.Drawing.Point(219, 5); this.LightSeries.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.LightSeries.MinimumSize = new System.Drawing.Size(1, 1); this.LightSeries.Name = "LightSeries"; @@ -554,6 +554,64 @@ namespace BRS.Process.A020.UI this.label11.Text = "自动拧紧状态\r\n指示灯"; this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // ManualLight + // + this.ManualLight.BackColor = System.Drawing.Color.Gray; + this.ManualLight.Cursor = System.Windows.Forms.Cursors.Hand; + this.ManualLight.Enabled = false; + this.ManualLight.Location = new System.Drawing.Point(672, 7); + this.ManualLight.Name = "ManualLight"; + this.ManualLight.Size = new System.Drawing.Size(90, 90); + this.ManualLight.TabIndex = 25; + this.ManualLight.UseVisualStyleBackColor = false; + // + // AutoLight + // + this.AutoLight.BackColor = System.Drawing.Color.Gray; + this.AutoLight.Cursor = System.Windows.Forms.Cursors.Hand; + this.AutoLight.Enabled = false; + this.AutoLight.Location = new System.Drawing.Point(541, 7); + this.AutoLight.Name = "AutoLight"; + this.AutoLight.Size = new System.Drawing.Size(90, 90); + this.AutoLight.TabIndex = 24; + this.AutoLight.UseVisualStyleBackColor = false; + // + // MoveStateLight1 + // + this.MoveStateLight1.BackColor = System.Drawing.Color.Gray; + this.MoveStateLight1.Location = new System.Drawing.Point(17, 7); + this.MoveStateLight1.Name = "MoveStateLight1"; + this.MoveStateLight1.Size = new System.Drawing.Size(90, 90); + this.MoveStateLight1.TabIndex = 3; + this.MoveStateLight1.UseVisualStyleBackColor = false; + // + // StopStateLight1 + // + this.StopStateLight1.BackColor = System.Drawing.Color.Gray; + this.StopStateLight1.Location = new System.Drawing.Point(148, 7); + this.StopStateLight1.Name = "StopStateLight1"; + this.StopStateLight1.Size = new System.Drawing.Size(90, 90); + this.StopStateLight1.TabIndex = 15; + this.StopStateLight1.UseVisualStyleBackColor = false; + // + // ToughLight1 + // + this.ToughLight1.BackColor = System.Drawing.Color.Gray; + this.ToughLight1.Location = new System.Drawing.Point(279, 7); + this.ToughLight1.Name = "ToughLight1"; + this.ToughLight1.Size = new System.Drawing.Size(90, 90); + this.ToughLight1.TabIndex = 16; + this.ToughLight1.UseVisualStyleBackColor = false; + // + // LoosenLight1 + // + this.LoosenLight1.BackColor = System.Drawing.Color.Gray; + this.LoosenLight1.Location = new System.Drawing.Point(410, 7); + this.LoosenLight1.Name = "LoosenLight1"; + this.LoosenLight1.Size = new System.Drawing.Size(90, 90); + this.LoosenLight1.TabIndex = 17; + this.LoosenLight1.UseVisualStyleBackColor = false; + // // label1 // this.label1.AutoSize = true; @@ -605,11 +663,11 @@ namespace BRS.Process.A020.UI this.uiPanel2.Controls.Add(this.ManualBtn1); this.uiPanel2.Controls.Add(this.ESBtn); this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel2.Location = new System.Drawing.Point(711, 201); + this.uiPanel2.Location = new System.Drawing.Point(728, 155); this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel2.Name = "uiPanel2"; - this.uiPanel2.Size = new System.Drawing.Size(290, 345); + this.uiPanel2.Size = new System.Drawing.Size(303, 391); this.uiPanel2.TabIndex = 37; this.uiPanel2.Text = null; this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; @@ -626,6 +684,42 @@ namespace BRS.Process.A020.UI this.label14.Text = "操作按钮"; this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // AutoBtn1 + // + this.AutoBtn1.BackColor = System.Drawing.Color.Gray; + this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand; + this.AutoBtn1.Location = new System.Drawing.Point(3, 73); + this.AutoBtn1.Name = "AutoBtn1"; + this.AutoBtn1.Size = new System.Drawing.Size(104, 104); + this.AutoBtn1.TabIndex = 18; + this.AutoBtn1.Text = "自动按钮"; + this.AutoBtn1.UseVisualStyleBackColor = false; + this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click); + // + // ManualBtn1 + // + this.ManualBtn1.BackColor = System.Drawing.Color.Gray; + this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand; + this.ManualBtn1.Location = new System.Drawing.Point(3, 183); + this.ManualBtn1.Name = "ManualBtn1"; + this.ManualBtn1.Size = new System.Drawing.Size(104, 104); + this.ManualBtn1.TabIndex = 19; + this.ManualBtn1.Text = "手动按钮"; + this.ManualBtn1.UseVisualStyleBackColor = false; + this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click); + // + // ESBtn + // + this.ESBtn.BackColor = System.Drawing.Color.Red; + this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand; + this.ESBtn.Location = new System.Drawing.Point(150, 107); + this.ESBtn.Name = "ESBtn"; + this.ESBtn.Size = new System.Drawing.Size(137, 137); + this.ESBtn.TabIndex = 0; + this.ESBtn.Text = "急停"; + this.ESBtn.UseVisualStyleBackColor = false; + this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click); + // // TestBtn // this.TestBtn.Cursor = System.Windows.Forms.Cursors.Hand; @@ -643,10 +737,10 @@ namespace BRS.Process.A020.UI // this.StopBtn2.Cursor = System.Windows.Forms.Cursors.Hand; this.StopBtn2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.StopBtn2.Location = new System.Drawing.Point(12, 105); + this.StopBtn2.Location = new System.Drawing.Point(116, 12); this.StopBtn2.MinimumSize = new System.Drawing.Size(1, 1); this.StopBtn2.Name = "StopBtn2"; - this.StopBtn2.Size = new System.Drawing.Size(96, 85); + this.StopBtn2.Size = new System.Drawing.Size(96, 141); this.StopBtn2.TabIndex = 8; this.StopBtn2.Text = "停止"; this.StopBtn2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -660,7 +754,7 @@ namespace BRS.Process.A020.UI this.StartBtn1.Location = new System.Drawing.Point(12, 12); this.StartBtn1.MinimumSize = new System.Drawing.Size(1, 1); this.StartBtn1.Name = "StartBtn1"; - this.StartBtn1.Size = new System.Drawing.Size(96, 85); + this.StartBtn1.Size = new System.Drawing.Size(96, 141); this.StartBtn1.TabIndex = 7; this.StartBtn1.Text = "开始"; this.StartBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -758,100 +852,6 @@ namespace BRS.Process.A020.UI this.timer2.Interval = 1000; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // - // ManualLight - // - this.ManualLight.BackColor = System.Drawing.Color.Gray; - this.ManualLight.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualLight.Enabled = false; - this.ManualLight.Location = new System.Drawing.Point(672, 7); - this.ManualLight.Name = "ManualLight"; - this.ManualLight.Size = new System.Drawing.Size(90, 90); - this.ManualLight.TabIndex = 25; - this.ManualLight.UseVisualStyleBackColor = false; - // - // AutoLight - // - this.AutoLight.BackColor = System.Drawing.Color.Gray; - this.AutoLight.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoLight.Enabled = false; - this.AutoLight.Location = new System.Drawing.Point(541, 7); - this.AutoLight.Name = "AutoLight"; - this.AutoLight.Size = new System.Drawing.Size(90, 90); - this.AutoLight.TabIndex = 24; - this.AutoLight.UseVisualStyleBackColor = false; - // - // MoveStateLight1 - // - this.MoveStateLight1.BackColor = System.Drawing.Color.Gray; - this.MoveStateLight1.Location = new System.Drawing.Point(17, 7); - this.MoveStateLight1.Name = "MoveStateLight1"; - this.MoveStateLight1.Size = new System.Drawing.Size(90, 90); - this.MoveStateLight1.TabIndex = 3; - this.MoveStateLight1.UseVisualStyleBackColor = false; - // - // StopStateLight1 - // - this.StopStateLight1.BackColor = System.Drawing.Color.Gray; - this.StopStateLight1.Location = new System.Drawing.Point(148, 7); - this.StopStateLight1.Name = "StopStateLight1"; - this.StopStateLight1.Size = new System.Drawing.Size(90, 90); - this.StopStateLight1.TabIndex = 15; - this.StopStateLight1.UseVisualStyleBackColor = false; - // - // ToughLight1 - // - this.ToughLight1.BackColor = System.Drawing.Color.Gray; - this.ToughLight1.Location = new System.Drawing.Point(279, 7); - this.ToughLight1.Name = "ToughLight1"; - this.ToughLight1.Size = new System.Drawing.Size(90, 90); - this.ToughLight1.TabIndex = 16; - this.ToughLight1.UseVisualStyleBackColor = false; - // - // LoosenLight1 - // - this.LoosenLight1.BackColor = System.Drawing.Color.Gray; - this.LoosenLight1.Location = new System.Drawing.Point(410, 7); - this.LoosenLight1.Name = "LoosenLight1"; - this.LoosenLight1.Size = new System.Drawing.Size(90, 90); - this.LoosenLight1.TabIndex = 17; - this.LoosenLight1.UseVisualStyleBackColor = false; - // - // AutoBtn1 - // - this.AutoBtn1.BackColor = System.Drawing.Color.Gray; - this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.AutoBtn1.Location = new System.Drawing.Point(3, 73); - this.AutoBtn1.Name = "AutoBtn1"; - this.AutoBtn1.Size = new System.Drawing.Size(104, 104); - this.AutoBtn1.TabIndex = 18; - this.AutoBtn1.Text = "自动按钮"; - this.AutoBtn1.UseVisualStyleBackColor = false; - this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click); - // - // ManualBtn1 - // - this.ManualBtn1.BackColor = System.Drawing.Color.Gray; - this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand; - this.ManualBtn1.Location = new System.Drawing.Point(3, 183); - this.ManualBtn1.Name = "ManualBtn1"; - this.ManualBtn1.Size = new System.Drawing.Size(104, 104); - this.ManualBtn1.TabIndex = 19; - this.ManualBtn1.Text = "手动按钮"; - this.ManualBtn1.UseVisualStyleBackColor = false; - this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click); - // - // ESBtn - // - this.ESBtn.BackColor = System.Drawing.Color.Red; - this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand; - this.ESBtn.Location = new System.Drawing.Point(150, 107); - this.ESBtn.Name = "ESBtn"; - this.ESBtn.Size = new System.Drawing.Size(137, 137); - this.ESBtn.TabIndex = 0; - this.ESBtn.Text = "急停"; - this.ESBtn.UseVisualStyleBackColor = false; - this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click); - // // 扭矩轴控制 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/BRS.Process.A020/UI/ContorlShaft.cs b/src/BRS.Process.A020/UI/ContorlShaft.cs index 65f1151..db11d28 100644 --- a/src/BRS.Process.A020/UI/ContorlShaft.cs +++ b/src/BRS.Process.A020/UI/ContorlShaft.cs @@ -565,6 +565,7 @@ namespace BRS.Process.A020.UI this.StopStateLight1.BackColor = Color.Red; this.MoveStateLight1.BackColor = Color.Gray; + this.AutoLight.BackColor = Color.Red; timer1.Stop(); timer2.Stop(); isOpenAuto = false; @@ -720,6 +721,7 @@ namespace BRS.Process.A020.UI ProcessWriteInt(MelsecPLC, "D7", "int", "1"); AutoBtn1.BackColor = Color.GreenYellow; ManualBtn1.BackColor = Color.Gray; + AutoLight.BackColor = Color.Red; is_btn_manual = false; } } @@ -795,6 +797,7 @@ namespace BRS.Process.A020.UI isOpenAuto = true; ProcessA020.IsSingleStepOperating = true; ProcessA020.ShaftAutoTough(MachineState.Ready); + AutoLight.BackColor = Color.GreenYellow; timer1.Start(); timer2.Start(); } @@ -936,6 +939,7 @@ namespace BRS.Process.A020.UI this.MoveStateLight1.BackColor = Color.Gray; this.ToughLight1.BackColor = Color.Gray; this.LoosenLight1.BackColor = Color.Gray; + this.AutoLight.BackColor = Color.Gray; //将急停按钮变为复位按钮 ESBtn.Text = "复位"; ESBtn.BackColor = Color.GreenYellow; @@ -1046,8 +1050,9 @@ namespace BRS.Process.A020.UI private void 扭矩轴控制_FormClosing(object sender, FormClosingEventArgs e) { - var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; - ProcessWriteInt(MelsecPLC, "D7", "int", "0"); + + //var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; + //ProcessWriteInt(MelsecPLC, "D7", "int", "0"); } } } diff --git a/src/BRS.Process.A020/UI/ControlSet.Designer.cs b/src/BRS.Process.A020/UI/ControlSet.Designer.cs deleted file mode 100644 index 744a258..0000000 --- a/src/BRS.Process.A020/UI/ControlSet.Designer.cs +++ /dev/null @@ -1,699 +0,0 @@ - -namespace BRS.Process.A020.UI -{ - partial class ControlSet - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.uiTitlePanel1 = new Sunny.UI.UITitlePanel(); - this.uiPanel2 = new Sunny.UI.UIPanel(); - this.btn_down1_2 = new Sunny.UI.UIButton(); - this.btn_load1_2 = new Sunny.UI.UIButton(); - this.cmb_sizechoose1_2 = new Sunny.UI.UIComboBox(); - this.uiPanel4 = new Sunny.UI.UIPanel(); - this.uiPanel1 = new Sunny.UI.UIPanel(); - this.btn_down1_1 = new Sunny.UI.UIButton(); - this.cmb_sizechoose1_1 = new Sunny.UI.UIComboBox(); - this.btn_load1_1 = new Sunny.UI.UIButton(); - this.uiPanel3 = new Sunny.UI.UIPanel(); - this.uiTitlePanel2 = new Sunny.UI.UITitlePanel(); - this.uiPanel5 = new Sunny.UI.UIPanel(); - this.btn_down2_2 = new Sunny.UI.UIButton(); - this.btn_load2_2 = new Sunny.UI.UIButton(); - this.cmb_sizechoose2_2 = new Sunny.UI.UIComboBox(); - this.uiPanel6 = new Sunny.UI.UIPanel(); - this.uiPanel7 = new Sunny.UI.UIPanel(); - this.btn_down2_1 = new Sunny.UI.UIButton(); - this.btn_load2_1 = new Sunny.UI.UIButton(); - this.cmb_sizechoose2_1 = new Sunny.UI.UIComboBox(); - this.uiPanel8 = new Sunny.UI.UIPanel(); - this.btn_robotset = new Sunny.UI.UIButton(); - this.btn_plcset = new Sunny.UI.UIButton(); - this.btn_reset = new Sunny.UI.UIButton(); - this.btn_auto = new Sunny.UI.UIButton(); - this.btn_manual = new Sunny.UI.UIButton(); - this.btn_stop = new Sunny.UI.UIButton(); - this.btn_pause = new Sunny.UI.UIButton(); - this.btn_start = new Sunny.UI.UIButton(); - this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.uiTitlePanel1.SuspendLayout(); - this.uiPanel2.SuspendLayout(); - this.uiPanel1.SuspendLayout(); - this.uiTitlePanel2.SuspendLayout(); - this.uiPanel5.SuspendLayout(); - this.uiPanel7.SuspendLayout(); - this.uiTableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(112, 0); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.uiTitlePanel1); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.uiTitlePanel2); - this.splitContainer1.Size = new System.Drawing.Size(908, 545); - this.splitContainer1.SplitterDistance = 442; - this.splitContainer1.TabIndex = 8; - // - // uiTitlePanel1 - // - this.uiTitlePanel1.Controls.Add(this.uiPanel2); - this.uiTitlePanel1.Controls.Add(this.uiPanel1); - this.uiTitlePanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.uiTitlePanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiTitlePanel1.Location = new System.Drawing.Point(0, 0); - this.uiTitlePanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiTitlePanel1.MinimumSize = new System.Drawing.Size(1, 1); - this.uiTitlePanel1.Name = "uiTitlePanel1"; - this.uiTitlePanel1.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); - this.uiTitlePanel1.Radius = 0; - this.uiTitlePanel1.ShowText = false; - this.uiTitlePanel1.Size = new System.Drawing.Size(442, 545); - this.uiTitlePanel1.TabIndex = 7; - this.uiTitlePanel1.Text = "1号硫化机"; - this.uiTitlePanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiTitlePanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // uiPanel2 - // - this.uiPanel2.Controls.Add(this.btn_down1_2); - this.uiPanel2.Controls.Add(this.btn_load1_2); - this.uiPanel2.Controls.Add(this.cmb_sizechoose1_2); - this.uiPanel2.Controls.Add(this.uiPanel4); - this.uiPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel2.Location = new System.Drawing.Point(0, 296); - this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel2.Name = "uiPanel2"; - this.uiPanel2.Radius = 4; - this.uiPanel2.Size = new System.Drawing.Size(442, 249); - this.uiPanel2.TabIndex = 1; - this.uiPanel2.Text = null; - this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_down1_2 - // - this.btn_down1_2.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_down1_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down1_2.Location = new System.Drawing.Point(184, 144); - this.btn_down1_2.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_down1_2.Name = "btn_down1_2"; - this.btn_down1_2.Size = new System.Drawing.Size(100, 35); - this.btn_down1_2.TabIndex = 3; - this.btn_down1_2.Text = "下料"; - this.btn_down1_2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down1_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_down1_2.Click += new System.EventHandler(this.btn_down1_2_Click); - // - // btn_load1_2 - // - this.btn_load1_2.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_load1_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load1_2.Location = new System.Drawing.Point(184, 72); - this.btn_load1_2.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_load1_2.Name = "btn_load1_2"; - this.btn_load1_2.Size = new System.Drawing.Size(100, 35); - this.btn_load1_2.TabIndex = 2; - this.btn_load1_2.Text = "上料"; - this.btn_load1_2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load1_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_load1_2.Click += new System.EventHandler(this.btn_load1_2_Click); - // - // cmb_sizechoose1_2 - // - this.cmb_sizechoose1_2.DataSource = null; - this.cmb_sizechoose1_2.Dock = System.Windows.Forms.DockStyle.Top; - this.cmb_sizechoose1_2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.cmb_sizechoose1_2.FillColor = System.Drawing.Color.White; - this.cmb_sizechoose1_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cmb_sizechoose1_2.Items.AddRange(new object[] { - "", - "12", - "13", - "14", - "15", - "16", - "17", - "18"}); - this.cmb_sizechoose1_2.Location = new System.Drawing.Point(116, 0); - this.cmb_sizechoose1_2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.cmb_sizechoose1_2.MinimumSize = new System.Drawing.Size(63, 0); - this.cmb_sizechoose1_2.Name = "cmb_sizechoose1_2"; - this.cmb_sizechoose1_2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); - this.cmb_sizechoose1_2.Size = new System.Drawing.Size(326, 29); - this.cmb_sizechoose1_2.TabIndex = 1; - this.cmb_sizechoose1_2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.cmb_sizechoose1_2.Watermark = ""; - this.cmb_sizechoose1_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.cmb_sizechoose1_2.SelectedIndexChanged += new System.EventHandler(this.cmb_sizechoose1_2_SelectedIndexChanged); - // - // uiPanel4 - // - this.uiPanel4.Dock = System.Windows.Forms.DockStyle.Left; - this.uiPanel4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel4.Location = new System.Drawing.Point(0, 0); - this.uiPanel4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel4.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel4.Name = "uiPanel4"; - this.uiPanel4.Radius = 0; - this.uiPanel4.Size = new System.Drawing.Size(116, 249); - this.uiPanel4.TabIndex = 0; - this.uiPanel4.Text = "2号位"; - this.uiPanel4.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel4.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // uiPanel1 - // - this.uiPanel1.Controls.Add(this.btn_down1_1); - this.uiPanel1.Controls.Add(this.cmb_sizechoose1_1); - this.uiPanel1.Controls.Add(this.btn_load1_1); - this.uiPanel1.Controls.Add(this.uiPanel3); - this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Top; - this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel1.Location = new System.Drawing.Point(0, 35); - this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel1.Name = "uiPanel1"; - this.uiPanel1.Size = new System.Drawing.Size(442, 261); - this.uiPanel1.TabIndex = 0; - this.uiPanel1.Text = null; - this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_down1_1 - // - this.btn_down1_1.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_down1_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down1_1.Location = new System.Drawing.Point(184, 148); - this.btn_down1_1.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_down1_1.Name = "btn_down1_1"; - this.btn_down1_1.Size = new System.Drawing.Size(100, 35); - this.btn_down1_1.TabIndex = 3; - this.btn_down1_1.Text = "下料"; - this.btn_down1_1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down1_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_down1_1.Click += new System.EventHandler(this.btn_down1_1_Click); - // - // cmb_sizechoose1_1 - // - this.cmb_sizechoose1_1.DataSource = null; - this.cmb_sizechoose1_1.Dock = System.Windows.Forms.DockStyle.Top; - this.cmb_sizechoose1_1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.cmb_sizechoose1_1.FillColor = System.Drawing.Color.White; - this.cmb_sizechoose1_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cmb_sizechoose1_1.Items.AddRange(new object[] { - "", - "12", - "13", - "14", - "15", - "16", - "17", - "18"}); - this.cmb_sizechoose1_1.Location = new System.Drawing.Point(116, 0); - this.cmb_sizechoose1_1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.cmb_sizechoose1_1.MinimumSize = new System.Drawing.Size(63, 0); - this.cmb_sizechoose1_1.Name = "cmb_sizechoose1_1"; - this.cmb_sizechoose1_1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); - this.cmb_sizechoose1_1.Size = new System.Drawing.Size(326, 29); - this.cmb_sizechoose1_1.TabIndex = 1; - this.cmb_sizechoose1_1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.cmb_sizechoose1_1.Watermark = ""; - this.cmb_sizechoose1_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.cmb_sizechoose1_1.SelectedIndexChanged += new System.EventHandler(this.cmb_sizechoose1_1_SelectedIndexChanged); - // - // btn_load1_1 - // - this.btn_load1_1.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_load1_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load1_1.Location = new System.Drawing.Point(184, 76); - this.btn_load1_1.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_load1_1.Name = "btn_load1_1"; - this.btn_load1_1.Size = new System.Drawing.Size(100, 35); - this.btn_load1_1.TabIndex = 2; - this.btn_load1_1.Text = "上料"; - this.btn_load1_1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load1_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_load1_1.Click += new System.EventHandler(this.btn_load1_1_Click); - // - // uiPanel3 - // - this.uiPanel3.Dock = System.Windows.Forms.DockStyle.Left; - this.uiPanel3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel3.Location = new System.Drawing.Point(0, 0); - this.uiPanel3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel3.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel3.Name = "uiPanel3"; - this.uiPanel3.Size = new System.Drawing.Size(116, 261); - this.uiPanel3.TabIndex = 0; - this.uiPanel3.Text = "1号位"; - this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel3.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // uiTitlePanel2 - // - this.uiTitlePanel2.Controls.Add(this.uiPanel5); - this.uiTitlePanel2.Controls.Add(this.uiPanel7); - this.uiTitlePanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.uiTitlePanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiTitlePanel2.Location = new System.Drawing.Point(0, 0); - this.uiTitlePanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiTitlePanel2.MinimumSize = new System.Drawing.Size(1, 1); - this.uiTitlePanel2.Name = "uiTitlePanel2"; - this.uiTitlePanel2.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); - this.uiTitlePanel2.Radius = 0; - this.uiTitlePanel2.ShowText = false; - this.uiTitlePanel2.Size = new System.Drawing.Size(462, 545); - this.uiTitlePanel2.TabIndex = 8; - this.uiTitlePanel2.Text = "2号硫化机"; - this.uiTitlePanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiTitlePanel2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // uiPanel5 - // - this.uiPanel5.Controls.Add(this.btn_down2_2); - this.uiPanel5.Controls.Add(this.btn_load2_2); - this.uiPanel5.Controls.Add(this.cmb_sizechoose2_2); - this.uiPanel5.Controls.Add(this.uiPanel6); - this.uiPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.uiPanel5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel5.Location = new System.Drawing.Point(0, 296); - this.uiPanel5.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel5.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel5.Name = "uiPanel5"; - this.uiPanel5.Radius = 0; - this.uiPanel5.Size = new System.Drawing.Size(462, 249); - this.uiPanel5.TabIndex = 1; - this.uiPanel5.Text = null; - this.uiPanel5.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel5.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_down2_2 - // - this.btn_down2_2.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_down2_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down2_2.Location = new System.Drawing.Point(184, 144); - this.btn_down2_2.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_down2_2.Name = "btn_down2_2"; - this.btn_down2_2.Size = new System.Drawing.Size(100, 35); - this.btn_down2_2.TabIndex = 3; - this.btn_down2_2.Text = "下料"; - this.btn_down2_2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down2_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_load2_2 - // - this.btn_load2_2.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_load2_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load2_2.Location = new System.Drawing.Point(184, 72); - this.btn_load2_2.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_load2_2.Name = "btn_load2_2"; - this.btn_load2_2.Size = new System.Drawing.Size(100, 35); - this.btn_load2_2.TabIndex = 2; - this.btn_load2_2.Text = "上料"; - this.btn_load2_2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load2_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // cmb_sizechoose2_2 - // - this.cmb_sizechoose2_2.DataSource = null; - this.cmb_sizechoose2_2.Dock = System.Windows.Forms.DockStyle.Top; - this.cmb_sizechoose2_2.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.cmb_sizechoose2_2.FillColor = System.Drawing.Color.White; - this.cmb_sizechoose2_2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cmb_sizechoose2_2.Items.AddRange(new object[] { - "", - "12", - "13", - "14", - "15", - "16", - "17", - "18"}); - this.cmb_sizechoose2_2.Location = new System.Drawing.Point(116, 0); - this.cmb_sizechoose2_2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.cmb_sizechoose2_2.MinimumSize = new System.Drawing.Size(63, 0); - this.cmb_sizechoose2_2.Name = "cmb_sizechoose2_2"; - this.cmb_sizechoose2_2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); - this.cmb_sizechoose2_2.Size = new System.Drawing.Size(346, 29); - this.cmb_sizechoose2_2.TabIndex = 1; - this.cmb_sizechoose2_2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.cmb_sizechoose2_2.Watermark = ""; - this.cmb_sizechoose2_2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.cmb_sizechoose2_2.SelectedIndexChanged += new System.EventHandler(this.cmb_sizechoose2_2_SelectedIndexChanged); - // - // uiPanel6 - // - this.uiPanel6.Dock = System.Windows.Forms.DockStyle.Left; - this.uiPanel6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel6.Location = new System.Drawing.Point(0, 0); - this.uiPanel6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel6.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel6.Name = "uiPanel6"; - this.uiPanel6.Radius = 4; - this.uiPanel6.Size = new System.Drawing.Size(116, 249); - this.uiPanel6.TabIndex = 0; - this.uiPanel6.Text = "2号位"; - this.uiPanel6.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel6.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // uiPanel7 - // - this.uiPanel7.Controls.Add(this.btn_down2_1); - this.uiPanel7.Controls.Add(this.btn_load2_1); - this.uiPanel7.Controls.Add(this.cmb_sizechoose2_1); - this.uiPanel7.Controls.Add(this.uiPanel8); - this.uiPanel7.Dock = System.Windows.Forms.DockStyle.Top; - this.uiPanel7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel7.Location = new System.Drawing.Point(0, 35); - this.uiPanel7.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel7.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel7.Name = "uiPanel7"; - this.uiPanel7.Size = new System.Drawing.Size(462, 261); - this.uiPanel7.TabIndex = 0; - this.uiPanel7.Text = null; - this.uiPanel7.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel7.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_down2_1 - // - this.btn_down2_1.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_down2_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down2_1.Location = new System.Drawing.Point(184, 148); - this.btn_down2_1.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_down2_1.Name = "btn_down2_1"; - this.btn_down2_1.Size = new System.Drawing.Size(100, 35); - this.btn_down2_1.TabIndex = 3; - this.btn_down2_1.Text = "下料"; - this.btn_down2_1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_down2_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_load2_1 - // - this.btn_load2_1.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_load2_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load2_1.Location = new System.Drawing.Point(184, 76); - this.btn_load2_1.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_load2_1.Name = "btn_load2_1"; - this.btn_load2_1.Size = new System.Drawing.Size(100, 35); - this.btn_load2_1.TabIndex = 2; - this.btn_load2_1.Text = "上料"; - this.btn_load2_1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_load2_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // cmb_sizechoose2_1 - // - this.cmb_sizechoose2_1.DataSource = null; - this.cmb_sizechoose2_1.Dock = System.Windows.Forms.DockStyle.Top; - this.cmb_sizechoose2_1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; - this.cmb_sizechoose2_1.FillColor = System.Drawing.Color.White; - this.cmb_sizechoose2_1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.cmb_sizechoose2_1.Items.AddRange(new object[] { - "", - "12", - "13", - "14", - "15", - "16", - "17", - "18"}); - this.cmb_sizechoose2_1.Location = new System.Drawing.Point(116, 0); - this.cmb_sizechoose2_1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.cmb_sizechoose2_1.MinimumSize = new System.Drawing.Size(63, 0); - this.cmb_sizechoose2_1.Name = "cmb_sizechoose2_1"; - this.cmb_sizechoose2_1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); - this.cmb_sizechoose2_1.Size = new System.Drawing.Size(346, 29); - this.cmb_sizechoose2_1.TabIndex = 1; - this.cmb_sizechoose2_1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - this.cmb_sizechoose2_1.Watermark = ""; - this.cmb_sizechoose2_1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.cmb_sizechoose2_1.SelectedIndexChanged += new System.EventHandler(this.cmb_sizechoose2_1_SelectedIndexChanged); - // - // uiPanel8 - // - this.uiPanel8.Dock = System.Windows.Forms.DockStyle.Left; - this.uiPanel8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.uiPanel8.Location = new System.Drawing.Point(0, 0); - this.uiPanel8.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.uiPanel8.MinimumSize = new System.Drawing.Size(1, 1); - this.uiPanel8.Name = "uiPanel8"; - this.uiPanel8.Size = new System.Drawing.Size(116, 261); - this.uiPanel8.TabIndex = 0; - this.uiPanel8.Text = "1号位"; - this.uiPanel8.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; - this.uiPanel8.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_robotset - // - this.btn_robotset.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_robotset.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_robotset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_robotset.Location = new System.Drawing.Point(3, 489); - this.btn_robotset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_robotset.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_robotset.Name = "btn_robotset"; - this.btn_robotset.Size = new System.Drawing.Size(106, 43); - this.btn_robotset.TabIndex = 7; - this.btn_robotset.Text = "ROBOT设置"; - this.btn_robotset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_robotset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_plcset - // - this.btn_plcset.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_plcset.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_plcset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_plcset.Location = new System.Drawing.Point(3, 421); - this.btn_plcset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_plcset.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_plcset.Name = "btn_plcset"; - this.btn_plcset.Size = new System.Drawing.Size(106, 42); - this.btn_plcset.TabIndex = 6; - this.btn_plcset.Text = "PLC设置"; - this.btn_plcset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_plcset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_reset - // - this.btn_reset.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_reset.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_reset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_reset.Location = new System.Drawing.Point(3, 353); - this.btn_reset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_reset.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_reset.Name = "btn_reset"; - this.btn_reset.Size = new System.Drawing.Size(106, 42); - this.btn_reset.TabIndex = 5; - this.btn_reset.Text = "复位"; - this.btn_reset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_reset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_auto - // - this.btn_auto.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_auto.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_auto.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_auto.Location = new System.Drawing.Point(3, 285); - this.btn_auto.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_auto.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_auto.Name = "btn_auto"; - this.btn_auto.Size = new System.Drawing.Size(106, 42); - this.btn_auto.TabIndex = 4; - this.btn_auto.Text = "自动"; - this.btn_auto.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_auto.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_auto.Click += new System.EventHandler(this.btn_auto_Click); - // - // btn_manual - // - this.btn_manual.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_manual.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_manual.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_manual.Location = new System.Drawing.Point(3, 217); - this.btn_manual.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_manual.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_manual.Name = "btn_manual"; - this.btn_manual.Size = new System.Drawing.Size(106, 42); - this.btn_manual.TabIndex = 3; - this.btn_manual.Text = "手动"; - this.btn_manual.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_manual.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_manual.Click += new System.EventHandler(this.btn_manual_Click); - // - // btn_stop - // - this.btn_stop.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_stop.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_stop.Location = new System.Drawing.Point(3, 149); - this.btn_stop.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_stop.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_stop.Name = "btn_stop"; - this.btn_stop.Size = new System.Drawing.Size(106, 42); - this.btn_stop.TabIndex = 2; - this.btn_stop.Text = "停止"; - this.btn_stop.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_stop.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); - // - // btn_pause - // - this.btn_pause.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_pause.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_pause.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_pause.Location = new System.Drawing.Point(3, 81); - this.btn_pause.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_pause.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_pause.Name = "btn_pause"; - this.btn_pause.Radius = 1; - this.btn_pause.Size = new System.Drawing.Size(106, 42); - this.btn_pause.TabIndex = 1; - this.btn_pause.Text = "暂停"; - this.btn_pause.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_pause.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - // - // btn_start - // - this.btn_start.Cursor = System.Windows.Forms.Cursors.Hand; - this.btn_start.Dock = System.Windows.Forms.DockStyle.Fill; - this.btn_start.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_start.Location = new System.Drawing.Point(3, 13); - this.btn_start.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13); - this.btn_start.MinimumSize = new System.Drawing.Size(1, 1); - this.btn_start.Name = "btn_start"; - this.btn_start.Size = new System.Drawing.Size(106, 42); - this.btn_start.TabIndex = 0; - this.btn_start.Text = "启动"; - this.btn_start.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btn_start.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); - this.btn_start.Click += new System.EventHandler(this.btn_start_Click); - this.btn_start.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_start_MouseDown); - this.btn_start.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btn_start_MouseUp); - // - // uiTableLayoutPanel1 - // - this.uiTableLayoutPanel1.ColumnCount = 1; - this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.uiTableLayoutPanel1.Controls.Add(this.btn_start, 0, 0); - this.uiTableLayoutPanel1.Controls.Add(this.btn_pause, 0, 1); - this.uiTableLayoutPanel1.Controls.Add(this.btn_stop, 0, 2); - this.uiTableLayoutPanel1.Controls.Add(this.btn_manual, 0, 3); - this.uiTableLayoutPanel1.Controls.Add(this.btn_auto, 0, 4); - this.uiTableLayoutPanel1.Controls.Add(this.btn_reset, 0, 5); - this.uiTableLayoutPanel1.Controls.Add(this.btn_plcset, 0, 6); - this.uiTableLayoutPanel1.Controls.Add(this.btn_robotset, 0, 7); - this.uiTableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left; - this.uiTableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.uiTableLayoutPanel1.Name = "uiTableLayoutPanel1"; - this.uiTableLayoutPanel1.RowCount = 8; - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.uiTableLayoutPanel1.Size = new System.Drawing.Size(112, 545); - this.uiTableLayoutPanel1.TabIndex = 5; - this.uiTableLayoutPanel1.TagString = null; - this.uiTableLayoutPanel1.Paint += new System.Windows.Forms.PaintEventHandler(this.uiTableLayoutPanel1_Paint); - // - // ControlSet - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1020, 545); - this.Controls.Add(this.splitContainer1); - this.Controls.Add(this.uiTableLayoutPanel1); - this.Name = "ControlSet"; - this.Text = "控制设置"; - this.Load += new System.EventHandler(this.ControlSet_Load); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.uiTitlePanel1.ResumeLayout(false); - this.uiPanel2.ResumeLayout(false); - this.uiPanel1.ResumeLayout(false); - this.uiTitlePanel2.ResumeLayout(false); - this.uiPanel5.ResumeLayout(false); - this.uiPanel7.ResumeLayout(false); - this.uiTableLayoutPanel1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.SplitContainer splitContainer1; - private Sunny.UI.UIButton btn_robotset; - private Sunny.UI.UIButton btn_plcset; - private Sunny.UI.UIButton btn_reset; - private Sunny.UI.UIButton btn_auto; - private Sunny.UI.UIButton btn_manual; - private Sunny.UI.UIButton btn_stop; - private Sunny.UI.UIButton btn_pause; - private Sunny.UI.UIButton btn_start; - private Sunny.UI.UITableLayoutPanel uiTableLayoutPanel1; - private Sunny.UI.UITitlePanel uiTitlePanel1; - private Sunny.UI.UIPanel uiPanel2; - private Sunny.UI.UIButton btn_down1_2; - private Sunny.UI.UIButton btn_load1_2; - private Sunny.UI.UIComboBox cmb_sizechoose1_2; - private Sunny.UI.UIPanel uiPanel4; - private Sunny.UI.UIPanel uiPanel1; - private Sunny.UI.UIButton btn_down1_1; - private Sunny.UI.UIComboBox cmb_sizechoose1_1; - private Sunny.UI.UIButton btn_load1_1; - private Sunny.UI.UIPanel uiPanel3; - private Sunny.UI.UITitlePanel uiTitlePanel2; - private Sunny.UI.UIPanel uiPanel5; - private Sunny.UI.UIButton btn_down2_2; - private Sunny.UI.UIButton btn_load2_2; - private Sunny.UI.UIComboBox cmb_sizechoose2_2; - private Sunny.UI.UIPanel uiPanel6; - private Sunny.UI.UIPanel uiPanel7; - private Sunny.UI.UIButton btn_down2_1; - private Sunny.UI.UIButton btn_load2_1; - private Sunny.UI.UIComboBox cmb_sizechoose2_1; - private Sunny.UI.UIPanel uiPanel8; - } -} \ No newline at end of file diff --git a/src/BRS.Process.A020/UI/ControlSet.cs b/src/BRS.Process.A020/UI/ControlSet.cs deleted file mode 100644 index 79be09a..0000000 --- a/src/BRS.Process.A020/UI/ControlSet.cs +++ /dev/null @@ -1,353 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using BRS.Common.PubSub; -using BRS.UI.Model.Winform; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Linq; -using System.Threading; -using static BRS.Common.Model.Helper.EnumHelper; -using static BRS.Process.A020.A020Process; -using BRS.Common.Base; - - -namespace BRS.Process.A020.UI -{ - [MenuNode("ControlSet", "控制菜单", 3, "View2", true)] - //public partial class TriggerCountFrm : MenuFormBase - - public partial class ControlSet : MenuFormBase - { - private bool is_btn_manual { get; set; } = false; - A020Process ProcessA020 => Process as A020Process; - A020Config Config => Process?.IConfig as A020Config; - - private bool isSingleStepOperating = false; - - public ControlSet() - { - InitializeComponent(); - } - - private void btn_start_Click(object sender, EventArgs e) - { - //流程正转启动按钮 - - } - - - private void ControlSet_Load(object sender, EventArgs e) - { - //cmb_sizechoose1_1.SelectedIndex = 0; - //cmb_sizechoose1_2.SelectedIndex = 0; - //cmb_sizechoose2_1.SelectedIndex = 0; - //cmb_sizechoose2_2.SelectedIndex = 0; - - //如果尺寸选择为空,则设置该对应设备无法进行上下料 - btn_load1_1.Enabled = false; - btn_down1_1.Enabled = false; - - btn_load1_2.Enabled = false; - btn_down1_2.Enabled = false; - - btn_load2_1.Enabled = false; - btn_down2_1.Enabled = false; - - btn_load2_2.Enabled = false; - btn_down2_2.Enabled = false; - - ////初始化字典界面设置 - //MachineInfo temp; - //temp.isReady = false; - //temp.location = -1; - //temp.tireSize = -1; - //MachineInfos.Add(0, temp); // 使用字典将顺序排好 - //MachineInfos.Add(1, temp); - //MachineInfos.Add(2, temp); - //MachineInfos.Add(3, temp); - - - } - public void SetMachineInfo(int num,int location) - { - MachineInfo temp; - temp.isReady = false; - temp.location = -1; - temp.tyreSize = -1; - //根据选择设置按钮可用性 - switch (num) - { - case 0: //如果选择为空,则对应区域内上下料按钮禁止使用 - temp.isReady = false; - temp.location = location; - temp.tyreSize = 0; - break; - case 12: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 12; - break; - case 13: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 13; - break; - case 14: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 14; - break; - case 15: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 15; - break; - case 16: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 16; - break; - case 17: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 17; - break; - case 18: - temp.isReady = true; - temp.location = location; - temp.tyreSize = 18; - break; - default: - break; - } - - //bool location_exist = false; - //for (int i = 0; i < MachineInfos.Count(); i++) //遍历查找对应的location进行修改 - //{ - // if (MachineInfos[i].location == location) - // { - // MachineInfos[i] = temp; - // location_exist = true; - // break; //找到之后停止查询 - // } - //} - //if (!location_exist) // 如果不存在则添加 - //{ - // MachineInfos.Add(temp); - //} - - //使用字典存放界面的设置 - if (!MachineInfos.ContainsKey(location)) // 如果该位置不存在,则添加进字典 - MachineInfos.Add(location, temp); - else - MachineInfos[location] = temp; - } - private void cmb_sizechoose1_1_SelectedIndexChanged(object sender, EventArgs e) - { - Sunny.UI.UIComboBox comboBox = (Sunny.UI.UIComboBox)sender; - string value = (string)comboBox.SelectedItem; - int num; - int.TryParse(value,out num); - if (0 < num) - { - btn_load1_1.Enabled = true; - btn_down1_1.Enabled = true; - } - else - { - btn_load1_1.Enabled = false; - btn_down1_1.Enabled = false; - } - SetMachineInfo(num, 0); - } - - private void cmb_sizechoose2_1_SelectedIndexChanged(object sender, EventArgs e) - { - Sunny.UI.UIComboBox comboBox = (Sunny.UI.UIComboBox)sender; - string value = (string)comboBox.SelectedItem; - int num; - int.TryParse(value, out num); - if (0 < num) - { - btn_load2_1.Enabled = true; - btn_down2_1.Enabled = true; - } - else - { - btn_load2_1.Enabled = false; - btn_down2_1.Enabled = false; - } - SetMachineInfo(num, 2); - } - - private void cmb_sizechoose1_2_SelectedIndexChanged(object sender, EventArgs e) - { - Sunny.UI.UIComboBox comboBox = (Sunny.UI.UIComboBox)sender; - string value = (string)comboBox.SelectedItem; - int num; - int.TryParse(value, out num); - if (0 < num) - { - btn_load1_2.Enabled = true; - btn_down1_2.Enabled = true; - } - else - { - btn_load1_2.Enabled = false; - btn_down1_2.Enabled = false; - } - SetMachineInfo(num, 1); - - } - - private void cmb_sizechoose2_2_SelectedIndexChanged(object sender, EventArgs e) - { - Sunny.UI.UIComboBox comboBox = (Sunny.UI.UIComboBox)sender; - string value = (string)comboBox.SelectedItem; - int num; - int.TryParse(value, out num); - if (0 < num) - { - btn_load2_2.Enabled = true; - btn_down2_2.Enabled = true; - } - else - { - btn_load2_2.Enabled = false; - btn_down2_2.Enabled = false; - } - SetMachineInfo(num, 3); - } - - private void btn_stop_Click(object sender, EventArgs e) - { - //var NbtRobot = A020Process.DeviceCollection.FirstOrDefault(u => u is RobotBase) as RobotBase; - //NbtRobot.power_off(); - } - - private void btn_load1_1_Click(object sender, EventArgs e) - { - if(!ProcessA020.IsSingleStepOperating) - { - ProcessA020.IsSingleStepOperating = true; - - Dictionary machineInfos = MachineInfos;//拿到界面上的设置参数 - int Machine1Entrance1TyreSize = 0; - - foreach (var item in machineInfos) - { - if (item.Value.location == 0) - Machine1Entrance1TyreSize = item.Value.tyreSize; - } - //ProcessA020.Machine1Entrance1Up(Machine1Entrance1TyreSize); - } - else - LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。"); - } - - private void btn_down1_1_Click(object sender, EventArgs e) - { - if (!ProcessA020.IsSingleStepOperating) - { - ProcessA020.IsSingleStepOperating = true; - - Dictionary machineInfos = MachineInfos;//拿到界面上的设置参数 - int Machine1Entrance1TyreSize = 0; - foreach (var item in machineInfos) - { - if (item.Value.location == 0) - Machine1Entrance1TyreSize = item.Value.tyreSize; - } - //ProcessA020.Machine1Entrance1Down(Machine1Entrance1TyreSize); - } - else - LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。"); - } - - private void btn_down1_2_Click(object sender, EventArgs e) - { - if (!ProcessA020.IsSingleStepOperating) - { - ProcessA020.IsSingleStepOperating = true; - - Dictionary machineInfos = MachineInfos;//拿到界面上的设置参数 - int Machine1Entrance2TyreSize = 0; - foreach (var item in machineInfos) - { - if (item.Value.location == 1) - Machine1Entrance2TyreSize = item.Value.tyreSize; - } - //ProcessA020.Machine1Entrance2Down(Machine1Entrance2TyreSize); - } - else - LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。"); - } - - private void btn_load1_2_Click(object sender, EventArgs e) - { - if (!ProcessA020.IsSingleStepOperating) - { - ProcessA020.IsSingleStepOperating = true; - - Dictionary machineInfos = MachineInfos;//拿到界面上的设置参数 - int Machine1Entrance2TyreSize = 0; - - foreach (var item in machineInfos) - { - if (item.Value.location == 1) - Machine1Entrance2TyreSize = item.Value.tyreSize; - } - //ProcessA020.Machine1Entrance2Up(Machine1Entrance2TyreSize); - } - else - LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。"); - } - - private void btn_manual_Click(object sender, EventArgs e) - { - btn_manual.FillColor = Color.FromArgb(41, 255, 156); - btn_manual.FillHoverColor = Color.FromArgb(41, 255, 156); - - btn_auto.FillColor = Color.FromArgb(80, 160, 255); - btn_auto.FillHoverColor = Color.FromArgb(80, 160, 255); - - ProcessA020.Machine1SwitchAutoManual(false); - } - private void btn_auto_Click(object sender, EventArgs e) - { - btn_auto.FillColor = Color.FromArgb(41, 255, 156); - btn_auto.FillHoverColor = Color.FromArgb(41, 255, 156); - - btn_manual.FillColor = Color.FromArgb(80, 160, 255); - btn_manual.FillHoverColor = Color.FromArgb(80, 160, 255); - - ProcessA020.Machine1SwitchAutoManual(true); - } - - private void uiTableLayoutPanel1_Paint(object sender, PaintEventArgs e) - { - - } - - private void btn_start_MouseDown(object sender, MouseEventArgs e) - { - - } - - private void btn_start_MouseUp(object sender, MouseEventArgs e) - { - - } - } -} - diff --git a/src/BRS.Process.A020/packages.config b/src/BRS.Process.A020/packages.config index d875585..2636197 100644 --- a/src/BRS.Process.A020/packages.config +++ b/src/BRS.Process.A020/packages.config @@ -7,10 +7,17 @@ + + + + + + + diff --git a/src/BRS.Process/BRS.Process.csproj b/src/BRS.Process/BRS.Process.csproj index 3f75b98..477d45d 100644 --- a/src/BRS.Process/BRS.Process.csproj +++ b/src/BRS.Process/BRS.Process.csproj @@ -167,6 +167,10 @@ {741f6491-57c7-479a-b391-09bba9fba9dc} BRS.UI.Model.Winform + + {91739E90-6A8E-433D-B244-5325F8848064} + XKRS.Device.TCPSever + diff --git a/src/BRS.Process/ProcessConfig.cs b/src/BRS.Process/ProcessConfig.cs index 7e0bfbd..65ddd91 100644 --- a/src/BRS.Process/ProcessConfig.cs +++ b/src/BRS.Process/ProcessConfig.cs @@ -9,8 +9,7 @@ using System.Drawing.Design; using System.Linq; using System.Runtime.CompilerServices; using static BRS.Common.Model.Helper.EnumHelper; - - +using XKRS.Device.TCPSever; namespace BRS.Process { @@ -40,13 +39,19 @@ namespace BRS.Process public List PLCConfigCollection { get; set; } = new List(); - [Category("设备配置")] - [Description("机械臂配置")] - [DisplayName("机械臂配置")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(InitialConfigCollectionEditor), typeof(UITypeEditor))] - public List RobotConfigCollection { get; set; } = new List(); + //[Category("设备配置")] + //[Description("机械臂配置")] + //[DisplayName("机械臂配置")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(InitialConfigCollectionEditor), typeof(UITypeEditor))] + //public List RobotConfigCollection { get; set; } = new List(); + [Category("设备配置")] + [Description("川崎机械臂配置")] + [DisplayName("川崎机械臂配置")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(InitialConfigCollectionEditor), typeof(UITypeEditor))] + public List KawasakiRobotConfigCollection { get; set; } = new List(); @@ -233,7 +238,7 @@ namespace BRS.Process configs.AddRange(CameraConfigCollection); configs.AddRange(PLCConfigCollection); configs.AddRange(DeviceConfigs); - configs.AddRange(RobotConfigCollection); + //configs.AddRange(RobotConfigCollection); return configs; diff --git a/src/BRS.Process/app.config b/src/BRS.Process/app.config index 4721899..f106813 100644 --- a/src/BRS.Process/app.config +++ b/src/BRS.Process/app.config @@ -1,31 +1,31 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - + diff --git a/src/BRS.UI.Device.Winform/CtrlRobotRunBase.cs b/src/BRS.UI.Device.Winform/CtrlRobotRunBase.cs index 7922031..c50170b 100644 --- a/src/BRS.UI.Device.Winform/CtrlRobotRunBase.cs +++ b/src/BRS.UI.Device.Winform/CtrlRobotRunBase.cs @@ -224,21 +224,7 @@ namespace BRS.UI.Device.Winform private void button1_Click(object sender, EventArgs e) { - int d=Robot.IConfig.RobotUpMovePoints.Count(); - Robot.IConfig.RobotUpMovePoints.ForEach(points => - { - //if - StrRobotPoint strRobotPoint3;//= ClassChangeStruct(points); - strRobotPoint3.A = points.A; - strRobotPoint3.B = points.B; - strRobotPoint3.C = points.C; - strRobotPoint3.X = points.X; - strRobotPoint3.Y = points.Y; - strRobotPoint3.Z = points.Z; - int speed = Decimal.ToInt32(numericUpDown1.Value); - Robot.Move(strRobotPoint3, 100, true); - // table[camera.Id] = points.X; - }); + } } diff --git a/src/BRS.UI.Device.Winform/app.config b/src/BRS.UI.Device.Winform/app.config index 4cd8ed8..e26e9d3 100644 --- a/src/BRS.UI.Device.Winform/app.config +++ b/src/BRS.UI.Device.Winform/app.config @@ -1,19 +1,19 @@ - + - - + + - - + + - - + + - + diff --git a/src/BRS.UI.Main/App.config b/src/BRS.UI.Main/App.config index 78573e5..00cdd09 100644 --- a/src/BRS.UI.Main/App.config +++ b/src/BRS.UI.Main/App.config @@ -1,73 +1,73 @@ - + -
+
-
+
- + - - - - - - + + + + + + - - + + - - - - - + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/src/BRS.UI.Main/MainFrm.cs b/src/BRS.UI.Main/MainFrm.cs index 97902ec..8cc70e2 100644 --- a/src/BRS.UI.Main/MainFrm.cs +++ b/src/BRS.UI.Main/MainFrm.cs @@ -14,13 +14,16 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; +using System.Runtime.InteropServices; namespace BRS.UI.Main { public partial class MainFrm : Form { IProcess _process = null; - + System.Diagnostics.Process process = new System.Diagnostics.Process(); + System.Diagnostics.Process processB = new System.Diagnostics.Process(); + System.Diagnostics.Process processC = new System.Diagnostics.Process(); public MainFrm() { @@ -390,8 +393,10 @@ namespace BRS.UI.Main LoadProcess(); LoadLayoutFromXML(m_deserializeDeviceRunFrm); LoadProcess(false); + } - + + private List LoadProcessCode() diff --git a/src/BRS.UI.Main/Program.cs b/src/BRS.UI.Main/Program.cs index 18bad3f..338f96a 100644 --- a/src/BRS.UI.Main/Program.cs +++ b/src/BRS.UI.Main/Program.cs @@ -24,7 +24,7 @@ namespace BRS.UI.Main ///
[STAThread] static void Main() - { + { AutoStart(true); if (!AuthorityCheck.AuthorityCheckOperation()) { diff --git a/src/BRS.UI.Model.Winform/app.config b/src/BRS.UI.Model.Winform/app.config index 4cd8ed8..e26e9d3 100644 --- a/src/BRS.UI.Model.Winform/app.config +++ b/src/BRS.UI.Model.Winform/app.config @@ -1,19 +1,19 @@ - + - - + + - - + + - - + + - + diff --git a/src/XKRS.Device.MelsecPLC/MelsecPLCDriver.cs b/src/XKRS.Device.MelsecPLC/MelsecPLCDriver.cs index a8c7ab7..d365a31 100644 --- a/src/XKRS.Device.MelsecPLC/MelsecPLCDriver.cs +++ b/src/XKRS.Device.MelsecPLC/MelsecPLCDriver.cs @@ -193,7 +193,6 @@ namespace XKRS.Device.MelsecPLC { try { - var result = melsecMc.Write(address, writeValue); if (result.IsSuccess) { diff --git a/src/XKRS.Device.TCPSever/App.config b/src/XKRS.Device.TCPSever/App.config new file mode 100644 index 0000000..fe153fd --- /dev/null +++ b/src/XKRS.Device.TCPSever/App.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotConfig.cs b/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotConfig.cs new file mode 100644 index 0000000..e0b399d --- /dev/null +++ b/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotConfig.cs @@ -0,0 +1,30 @@ +using BRS.Common.Base; +using BRS.Common.Model; +using BRS.Common.Model.Helper; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing.Design; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace XKRS.Device.TCPSever +{ + [Device("KawasakiRobot", "川崎Robot", EnumHelper.DeviceAttributeType.OperationConfig)] + public class KawasakiRobotOperationConfig : OperationConfigBase + { + + } + + [Device("KawasakiRobot", "川崎Robot", EnumHelper.DeviceAttributeType.InitialConfig)] + public class KawasakiTCPSeverRobotConfig : TCPSeverInitialConfigBase + { + [Category("机械臂项目")] + [Description("机械臂起始位置")] + [DisplayName("机械臂起始位置")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public RobotPoint RobotInitPosition { get; set; } = new RobotPoint(); + } +} diff --git a/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotDriver.cs b/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotDriver.cs new file mode 100644 index 0000000..5ccd396 --- /dev/null +++ b/src/XKRS.Device.TCPSever/KawasakiTCPSeverRobotDriver.cs @@ -0,0 +1,58 @@ +using BRS.Common.Base; +using BRS.Common.Model.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static BRS.Common.Model.Helper.EnumHelper; + +namespace XKRS.Device.TCPSever +{ + [Device("KawasakiRobot", "川崎Robot", DeviceAttributeType.Device)] + public class KawasakiTCPSeverRobotDriver:TCPSeverBase + { + public KawasakiTCPSeverRobotConfig IIConfig + { + + get => IConfig as KawasakiTCPSeverRobotConfig; + //return InitialConfig as KawasakiTCPSeverRobotConfig; + + } + #region IDeviceBace + + protected override void Init() + { + base.Init(); + } + + + protected override void Start() + { + base.Start(); + } + + + protected override void Pause() + { + // listener.Stop(); + } + protected override void Stop() + { + + base.Stop(); + + + } + + protected override void Resume() + { + + } + + + + #endregion + } + +} diff --git a/src/XKRS.Device.TCPSever/TCPSeverForm.Designer.cs b/src/XKRS.Device.TCPSever/TCPSeverForm.Designer.cs new file mode 100644 index 0000000..845f04d --- /dev/null +++ b/src/XKRS.Device.TCPSever/TCPSeverForm.Designer.cs @@ -0,0 +1,202 @@ + +namespace XKRS.Device.TCPSever +{ + partial class TCPSeverForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.Sendbutton = new System.Windows.Forms.Button(); + this.sendMsg = new System.Windows.Forms.RichTextBox(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.btn_set_run_mode = new System.Windows.Forms.Button(); + this.btn_servo_on = new System.Windows.Forms.Button(); + this.btn_power_off = new System.Windows.Forms.Button(); + this.btn_connection_status = new System.Windows.Forms.Button(); + this.btn_set_teach_mode = new System.Windows.Forms.Button(); + this.btn_get_ID = new System.Windows.Forms.Button(); + this.btn_get_servo_state = new System.Windows.Forms.Button(); + this.btn_clear_servo_err = new System.Windows.Forms.Button(); + this.btn_set_servo_state = new System.Windows.Forms.Button(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.Sendbutton); + this.panel1.Controls.Add(this.sendMsg); + this.panel1.Controls.Add(this.richTextBox1); + this.panel1.Controls.Add(this.btn_set_run_mode); + this.panel1.Controls.Add(this.btn_servo_on); + this.panel1.Controls.Add(this.btn_power_off); + this.panel1.Controls.Add(this.btn_connection_status); + this.panel1.Controls.Add(this.btn_set_teach_mode); + this.panel1.Controls.Add(this.btn_get_ID); + this.panel1.Controls.Add(this.btn_get_servo_state); + this.panel1.Controls.Add(this.btn_clear_servo_err); + this.panel1.Controls.Add(this.btn_set_servo_state); + this.panel1.Location = new System.Drawing.Point(12, 12); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(836, 468); + this.panel1.TabIndex = 0; + // + // Sendbutton + // + this.Sendbutton.Location = new System.Drawing.Point(668, 403); + this.Sendbutton.Name = "Sendbutton"; + this.Sendbutton.Size = new System.Drawing.Size(75, 40); + this.Sendbutton.TabIndex = 183; + this.Sendbutton.Text = "发送"; + this.Sendbutton.UseVisualStyleBackColor = true; + this.Sendbutton.Click += new System.EventHandler(this.Sendbutton_Click); + // + // sendMsg + // + this.sendMsg.Location = new System.Drawing.Point(32, 374); + this.sendMsg.Name = "sendMsg"; + this.sendMsg.Size = new System.Drawing.Size(605, 82); + this.sendMsg.TabIndex = 182; + this.sendMsg.Text = ""; + // + // richTextBox1 + // + this.richTextBox1.Location = new System.Drawing.Point(32, 73); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(708, 280); + this.richTextBox1.TabIndex = 2; + this.richTextBox1.Text = ""; + // + // btn_set_run_mode + // + this.btn_set_run_mode.Location = new System.Drawing.Point(720, 15); + this.btn_set_run_mode.Name = "btn_set_run_mode"; + this.btn_set_run_mode.Size = new System.Drawing.Size(72, 40); + this.btn_set_run_mode.TabIndex = 8; + this.btn_set_run_mode.Text = "运行模式"; + this.btn_set_run_mode.UseVisualStyleBackColor = true; + // + // btn_servo_on + // + this.btn_servo_on.Location = new System.Drawing.Point(135, 15); + this.btn_servo_on.Name = "btn_servo_on"; + this.btn_servo_on.Size = new System.Drawing.Size(72, 40); + this.btn_servo_on.TabIndex = 7; + this.btn_servo_on.Text = "伺服上电"; + this.btn_servo_on.UseVisualStyleBackColor = true; + // + // btn_power_off + // + this.btn_power_off.Location = new System.Drawing.Point(213, 15); + this.btn_power_off.Name = "btn_power_off"; + this.btn_power_off.Size = new System.Drawing.Size(70, 40); + this.btn_power_off.TabIndex = 6; + this.btn_power_off.Text = "伺服下电"; + this.btn_power_off.UseVisualStyleBackColor = true; + // + // btn_connection_status + // + this.btn_connection_status.Location = new System.Drawing.Point(289, 15); + this.btn_connection_status.Name = "btn_connection_status"; + this.btn_connection_status.Size = new System.Drawing.Size(80, 40); + this.btn_connection_status.TabIndex = 5; + this.btn_connection_status.Text = "连接状态"; + this.btn_connection_status.UseVisualStyleBackColor = true; + // + // btn_set_teach_mode + // + this.btn_set_teach_mode.Location = new System.Drawing.Point(375, 15); + this.btn_set_teach_mode.Name = "btn_set_teach_mode"; + this.btn_set_teach_mode.Size = new System.Drawing.Size(62, 40); + this.btn_set_teach_mode.TabIndex = 4; + this.btn_set_teach_mode.Text = "示教模式"; + this.btn_set_teach_mode.UseVisualStyleBackColor = true; + // + // btn_get_ID + // + this.btn_get_ID.Location = new System.Drawing.Point(443, 15); + this.btn_get_ID.Name = "btn_get_ID"; + this.btn_get_ID.Size = new System.Drawing.Size(62, 40); + this.btn_get_ID.TabIndex = 3; + this.btn_get_ID.Text = "获取IO"; + this.btn_get_ID.UseVisualStyleBackColor = true; + // + // btn_get_servo_state + // + this.btn_get_servo_state.Location = new System.Drawing.Point(511, 15); + this.btn_get_servo_state.Name = "btn_get_servo_state"; + this.btn_get_servo_state.Size = new System.Drawing.Size(98, 40); + this.btn_get_servo_state.TabIndex = 2; + this.btn_get_servo_state.Text = "获取伺服状态"; + this.btn_get_servo_state.UseVisualStyleBackColor = true; + // + // btn_clear_servo_err + // + this.btn_clear_servo_err.Location = new System.Drawing.Point(615, 15); + this.btn_clear_servo_err.Name = "btn_clear_servo_err"; + this.btn_clear_servo_err.Size = new System.Drawing.Size(99, 40); + this.btn_clear_servo_err.TabIndex = 1; + this.btn_clear_servo_err.Text = "清理伺服错误"; + this.btn_clear_servo_err.UseVisualStyleBackColor = true; + // + // btn_set_servo_state + // + this.btn_set_servo_state.Location = new System.Drawing.Point(37, 15); + this.btn_set_servo_state.Name = "btn_set_servo_state"; + this.btn_set_servo_state.Size = new System.Drawing.Size(80, 40); + this.btn_set_servo_state.TabIndex = 0; + this.btn_set_servo_state.Text = "设置伺服"; + this.btn_set_servo_state.UseVisualStyleBackColor = true; + // + // TCPSeverForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.panel1); + this.Name = "TCPSeverForm"; + this.Size = new System.Drawing.Size(892, 553); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button Sendbutton; + private System.Windows.Forms.RichTextBox sendMsg; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.Button btn_set_run_mode; + private System.Windows.Forms.Button btn_servo_on; + private System.Windows.Forms.Button btn_power_off; + private System.Windows.Forms.Button btn_connection_status; + private System.Windows.Forms.Button btn_set_teach_mode; + private System.Windows.Forms.Button btn_get_ID; + private System.Windows.Forms.Button btn_get_servo_state; + private System.Windows.Forms.Button btn_clear_servo_err; + private System.Windows.Forms.Button btn_set_servo_state; + } +} diff --git a/src/XKRS.Device.TCPSever/TCPSeverForm.cs b/src/XKRS.Device.TCPSever/TCPSeverForm.cs new file mode 100644 index 0000000..d45067f --- /dev/null +++ b/src/XKRS.Device.TCPSever/TCPSeverForm.cs @@ -0,0 +1,84 @@ +using BRS.Common.Interface; +using BRS.Common.Model.Helper; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace XKRS.Device.TCPSever +{ + [Device("TCPSever", "TCP服务器", EnumHelper.DeviceAttributeType.RunCtrl)] + public partial class TCPSeverForm : UserControl, IRunCtrl + { + #region 控件大小随窗体大小等比例缩放 + private float x;//定义当前窗体的宽度 + private float y;//定义当前窗体的高度 + private void Form1_Resize(object sender, EventArgs e) + { + float newx = (this.Width) / x; + float newy = (this.Height) / y; + setControls(newx, newy, this); + } + private void setTag(Control cons) + { + foreach (Control con in cons.Controls) + { + con.Tag = con.Width + ";" + con.Height + ";" + con.Left + ";" + con.Top + ";" + con.Font.Size; + if (con.Controls.Count > 0) + { + setTag(con); + } + } + } + private void setControls(float newx, float newy, Control cons) + { + try + { + //遍历窗体中的控件,重新设置控件的值 + foreach (Control con in cons.Controls) + { + //获取控件的Tag属性值,并分割后存储字符串数组 + if (con.Tag != null) + { + string[] mytag = con.Tag.ToString().Split(new char[] { ';' }); + //根据窗体缩放的比例确定控件的值 + con.Width = Convert.ToInt32(System.Convert.ToSingle(mytag[0]) * newx);//宽度 + con.Height = Convert.ToInt32(System.Convert.ToSingle(mytag[1]) * newy);//高度 + con.Left = Convert.ToInt32(System.Convert.ToSingle(mytag[2]) * newx);//左边距 + con.Top = Convert.ToInt32(System.Convert.ToSingle(mytag[3]) * newy);//顶边距 + Single currentSize = System.Convert.ToSingle(mytag[4]) * newy;//字体大小 + con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit); + if (con.Controls.Count > 0) + { + setControls(newx, newy, con); + } + } + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + #endregion + public TCPSeverForm(KawasakiTCPSeverRobotDriver kawasakiRobotDriver) + { + InitializeComponent(); + + } + public IDevice Device { get; set; } + public KawasakiTCPSeverRobotDriver KawasakiTCPSeverRobotDriver + { + get { return Device as KawasakiTCPSeverRobotDriver; } + } + private void Sendbutton_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/src/BRS.Process.A020/UI/ControlSet.resx b/src/XKRS.Device.TCPSever/TCPSeverForm.resx similarity index 100% rename from src/BRS.Process.A020/UI/ControlSet.resx rename to src/XKRS.Device.TCPSever/TCPSeverForm.resx diff --git a/src/XKRS.Device.TCPSever/XKRS.Device.TCPSever.csproj b/src/XKRS.Device.TCPSever/XKRS.Device.TCPSever.csproj new file mode 100644 index 0000000..98caf3b --- /dev/null +++ b/src/XKRS.Device.TCPSever/XKRS.Device.TCPSever.csproj @@ -0,0 +1,85 @@ + + + + + Debug + AnyCPU + {91739E90-6A8E-433D-B244-5325F8848064} + Library + XKRS.Device.TCPSever + XKRS.Device.TCPSever + v4.6.1 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + ..\Release\ + DEBUG;TRACE + prompt + 4 + + + + + + + + + + + + + UserControl + + + TCPSeverForm.cs + + + + + ..\..\packages\STTech.BytesIO.Core.2.9.3\lib\net45\STTech.BytesIO.Core.dll + + + ..\..\packages\STTech.BytesIO.Tcp.2.9.3\lib\net45\STTech.BytesIO.Tcp.dll + + + ..\..\packages\STTech.CodePlus.1.4.0\lib\net45\STTech.CodePlus.dll + + + + + + + + + + {987308DD-8BAA-463A-94E2-77D62E01A5BF} + BRS.Common.Device + + + {1A3CBFE7-3F78-42C3-95C5-10360450DBEA} + BRS.Common.Model + + + + + TCPSeverForm.cs + + + + \ No newline at end of file diff --git a/src/XKRS.Device.TCPSever/packages.config b/src/XKRS.Device.TCPSever/packages.config new file mode 100644 index 0000000..97cb8fd --- /dev/null +++ b/src/XKRS.Device.TCPSever/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file