根据实际平台轴定义,修改轴号;升级开发环境
This commit is contained in:
+6
-20
@@ -1,14 +1,12 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.34112.143
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34221.43
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HSI_HexagonMI_EF3", "HSI_HexagonMI_EF3\HSI_HexagonMI_EF3.vcxproj", "{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACS Motion", "Motion\ACS Motion\ACS Motion.csproj", "{19741897-37D8-43EE-94A2-637975035CEA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSI_CONTROLLER_WPFTest", "..\EF3-Interfac\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\HSI_GOOGOL_GTS800_WPFTest\HSI_CONTROLLER_WPFTest.csproj", "{A21A5B56-EB1C-4377-9E76-141FAC055988}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFSerialAssistant", "SerialAssistant\WPFSerialAssistant\WPFSerialAssistant.csproj", "{DA01B86D-5BC1-4863-BAAC-71B309B09CC0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HSI_SEVENOCEAN_EF1_CsTest", "HSI_SEVENOCEAN_EF1_CsTest\HSI_SEVENOCEAN_EF1_CsTest.csproj", "{7ED499CB-651C-4154-9741-EEF347BDBFB5}"
|
||||
@@ -29,13 +27,12 @@ Global
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x64.Build.0 = Debug|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x86.Build.0 = Debug|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Debug|x86.Build.0 = Debug|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|x64.ActiveCfg = Release|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|x64.Build.0 = Release|x64
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|x86.Build.0 = Release|Win32
|
||||
{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}.Release|x86.ActiveCfg = Release|x64
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x86.ActiveCfg = Debug|x86
|
||||
@@ -45,17 +42,6 @@ Global
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x64.Build.0 = Release|x64
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x86.ActiveCfg = Release|x86
|
||||
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x86.Build.0 = Release|x86
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|x64.ActiveCfg = Release|x64
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|x64.Build.0 = Release|x64
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A21A5B56-EB1C-4377-9E76-141FAC055988}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DA01B86D-5BC1-4863-BAAC-71B309B09CC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA01B86D-5BC1-4863-BAAC-71B309B09CC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA01B86D-5BC1-4863-BAAC-71B309B09CC0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
||||
@@ -21,12 +21,15 @@ static bool g_bOfflineOnly = false;
|
||||
//1、剥离 Metus初步所需函数(14个函数,包含是否回家,运动初始化,版本,JOG运动,运动到指定位置等)并生成dll
|
||||
//
|
||||
//
|
||||
// V0.1.10 2024/02/26
|
||||
//---------------------------------------
|
||||
//1、根据实际平台 电气层面轴定义,修改代码
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//轴名 电气层轴 左极限 右极限
|
||||
//X 1 - 30 730
|
||||
//Y 0 - 10 1000
|
||||
//Z 8 - 280 5
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#endif
|
||||
|
||||
const int HSI_APIVersionMajor = 1;
|
||||
const int HSI_APIVersionMinor = 9;
|
||||
const int HSI_APIVersionMinor = 10;
|
||||
const int HSI_MaxStringLength = 255; // Maximum string length (buffer size - 1)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Interface API
|
||||
@@ -375,7 +375,7 @@ enum HSI_MOTION_IO_TYPE
|
||||
};
|
||||
|
||||
//const UINT HSI_MOTION_AXIS_ALL = HSI_MOTION_AXIS_X | HSI_MOTION_AXIS_Y | HSI_MOTION_AXIS_Z;
|
||||
const UINT HSI_MOTION_AXIS_ALL = ACSC_AXIS_0 | ACSC_AXIS_1 | ACSC_AXIS_4;
|
||||
const UINT HSI_MOTION_AXIS_ALL = ACSC_AXIS_1 | ACSC_AXIS_0 | ACSC_AXIS_8;
|
||||
|
||||
enum HSI_MOTION_MOVE_TYPE
|
||||
{
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@@ -22,36 +14,21 @@
|
||||
<ProjectGuid>{ECCF081D-DDA4-49D5-A03F-9DD5AB8B666B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>HSI_Sevenocean_EF3</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>HSI_HexagonMI_EF3</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
@@ -62,35 +39,22 @@
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>\DirectXLib\Include;$(IncludePath)</IncludePath>
|
||||
<IncludePath>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;\DirectXLib\Include;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(MSBuildProjectDirectory)\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(MSBuildProjectDirectory)\obj</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>\DirectXLib\Include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HSI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
@@ -103,36 +67,10 @@
|
||||
<AdditionalDependencies>hid.lib;setupapi.lib;DirectXLib\lib\x64\d2d1.lib;DirectXLib\lib\x64\d3d9.lib;DirectXLib\lib\x64\d3d10.lib;DirectXLib\lib\x64\d3d10_1.lib;DirectXLib\lib\x64\d3d11.lib;DirectXLib\lib\x64\d3dcompiler.lib;DirectXLib\lib\x64\D3DCSX.lib;DirectXLib\lib\x64\d3dx9.lib;DirectXLib\lib\x64\d3dx10.lib;DirectXLib\lib\x64\d3dx11.lib;DirectXLib\lib\x64\d3dxof.lib;DirectXLib\lib\x64\dinput8.lib;DirectXLib\lib\x64\dsound.lib;DirectXLib\lib\x64\dwrite.lib;DirectXLib\lib\x64\DxErr.lib;DirectXLib\lib\x64\dxgi.lib;DirectXLib\lib\x64\dxguid.lib;DirectXLib\lib\x64\X3DAudio.lib;DirectXLib\lib\x64\xapobase.lib;DirectXLib\lib\x64\XAPOFX.lib;DirectXLib\lib\x64\XInput.lib;ACSCL_x64.LIB;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>
|
||||
</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(LocalDebuggerWorkingDirectory)\ACS;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;$(LocalDebuggerWorkingDirectory)\ACS;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "C:\Hexagon\Metus2020R1\HSI_Sevenocean_EF3.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "C:\Hexagon\Metus-7.10.1 967\HSI_Sevenocean_EF3.dll"
|
||||
copy "$(TargetDir)$(ProjectName).dll" "E:\HexagonProjects\2022-05-直线电机平台\EF3-Interfac\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\HSI_Sevenocean_EF1_WPFTest\bin\x64\Debug\HSI.dll"</Command>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>version.cmd</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HSI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$ (ProjectDir)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\HSI_Sevenocean_EF3.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy "$(OutDir)\$(ProjectName).dll" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI.dll/D /F /Y
|
||||
xcopy "$(OutDir)\$(ProjectName).pdb" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI.pdb /D /F /Y</Command>
|
||||
<Command>copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI.dll"</Command>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>version.cmd</Command>
|
||||
@@ -157,24 +95,6 @@ xcopy "$(OutDir)\$(ProjectName).pdb" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI.
|
||||
<AdditionalDependencies>hid.lib;setupapi.lib;DirectXLib\lib\x64\d2d1.lib;DirectXLib\lib\x64\d3d9.lib;DirectXLib\lib\x64\d3d10.lib;DirectXLib\lib\x64\d3d10_1.lib;DirectXLib\lib\x64\d3d11.lib;DirectXLib\lib\x64\d3dcompiler.lib;DirectXLib\lib\x64\D3DCSX.lib;DirectXLib\lib\x64\d3dx9.lib;DirectXLib\lib\x64\d3dx10.lib;DirectXLib\lib\x64\d3dx11.lib;DirectXLib\lib\x64\d3dxof.lib;DirectXLib\lib\x64\dinput8.lib;DirectXLib\lib\x64\dsound.lib;DirectXLib\lib\x64\dwrite.lib;DirectXLib\lib\x64\DxErr.lib;DirectXLib\lib\x64\dxgi.lib;DirectXLib\lib\x64\dxguid.lib;DirectXLib\lib\x64\X3DAudio.lib;DirectXLib\lib\x64\xapobase.lib;DirectXLib\lib\x64\XAPOFX.lib;DirectXLib\lib\x64\XInput.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HSI_SEVENOCEAN_EF3_EXPORTS;HSI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>.\HSI_Sevenocean_EF3.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ACS\ACSC.h" />
|
||||
<ClInclude Include="HSI.h" />
|
||||
@@ -197,9 +117,7 @@ xcopy "$(OutDir)\$(ProjectName).pdb" ..\HSI_GOOGOL_GTS800_WPFTest\bin\Debug\HSI.
|
||||
<ClCompile Include="HSI_Sevenocean_EF3.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -479,7 +479,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
|
||||
}
|
||||
#endif
|
||||
//使能电机
|
||||
int Axes[] = {ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_4, -1};
|
||||
int Axes[] = {ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1}; //根据电气层面定义,这里的0对应X轴,1对应Y轴,8对应Z轴
|
||||
if (!acsc_EnableM(handleACS, Axes, nullptr))
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[ACS Motion] ACS Motors Enable Failed!\n");
|
||||
@@ -1146,6 +1146,10 @@ HSI_STATUS HSI_Motion::HomeMachine(bool bHomed)
|
||||
m_WriteByte = Send_Command(0, (const char*)m_cSendData, 2);
|
||||
Sleep(5);
|
||||
|
||||
//回家表示改为1
|
||||
m_Home_Machine_Axis[1] = 1;
|
||||
m_Home_Machine_Axis[0] = 1;
|
||||
m_Home_Machine_Axis[8] = 1;
|
||||
g_pLogger->SendAndFlushWithTime(L"[HomeMachine] Go Home success\n");
|
||||
g_pLogger->SendAndFlushWithTime(L"[HomeMachine] Out\n");
|
||||
}
|
||||
@@ -1510,10 +1514,10 @@ HSI_STATUS HSI_Motion::IsHomed(bool& bHomed)
|
||||
return HSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
// 判断是否需要回家,读取ACS控制器回家标志位,来判断本次上电是否已经回过家
|
||||
// 判断是否需要回家,读取ACS控制器回家标志位,来判断本次上电是否已经回过家 , 1:已经回过家,0:未回过家
|
||||
if (!acsc_ReadInteger(handleACS, ACSC_NONE, "YAW_HOME_DONE", ACSC_NONE, ACSC_NONE, ACSC_NONE, ACSC_NONE,
|
||||
isHomed,
|
||||
nullptr))
|
||||
nullptr))
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[IsHomed] ACS Read ISHOMED Flag Error\n");
|
||||
ErrorsHandler();
|
||||
@@ -1527,7 +1531,7 @@ HSI_STATUS HSI_Motion::IsHomed(bool& bHomed)
|
||||
isHomed[1], isHomed[2]);
|
||||
|
||||
//如果各个轴标志位 已经回过家
|
||||
if (isHomed[0] == 2 && isHomed[1] == 1 && isHomed[2] == 1 && isHomed[3] == 1)
|
||||
if (isHomed[0] == 1 && isHomed[1] == 1 && isHomed[2] == 1 && isHomed[3] == 1)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[IsHomed] E_GTS_HOME_FINISHED\n");
|
||||
CurrentHomeMachineState = E_EF3_HOME_FINISHED;
|
||||
@@ -2506,7 +2510,7 @@ HSI_STATUS HSI_Motion::StopJog()
|
||||
m_WriteByte = Send_Command(0, (const char*)m_SendJogData, m_SendDataLength);
|
||||
}*/
|
||||
|
||||
int Axes[] = {ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_4, -1};
|
||||
int Axes[] = {ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1};
|
||||
if (handleACS != ACSC_INVALID)
|
||||
{
|
||||
if (!acsc_HaltM(handleACS, Axes, nullptr)) //停止JOG运动
|
||||
@@ -2855,7 +2859,7 @@ HSI_STATUS HSI_Motion::GetPositionXyz(UINT AxisTypes, double& PositionX, double&
|
||||
bGetPosition = false;
|
||||
return HSI_ACS_ERROR;
|
||||
}
|
||||
if (!acsc_GetFPosition(handleACS, ACSC_AXIS_4, &PositionZ, nullptr))
|
||||
if (!acsc_GetFPosition(handleACS, ACSC_AXIS_8, &PositionZ, nullptr))
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[GetPositionEncPrfMulti] get PositionZ failed\n");
|
||||
ErrorsHandler();
|
||||
@@ -3593,7 +3597,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
|
||||
|
||||
|
||||
//开始运动到指定位置,多轴运动
|
||||
int Axes[] = {ACSC_AXIS_0, ACSC_AXIS_1,ACSC_AXIS_4, -1}; //需要运动的轴
|
||||
int Axes[] = {ACSC_AXIS_1, ACSC_AXIS_0,ACSC_AXIS_8, -1}; //需要运动的轴
|
||||
double Points[] = {PositionY, PositionX, PositionZ}; //目标位置点
|
||||
if (!acsc_ToPointM(handleACS, 0, Axes, Points, nullptr)) //移动到绝对位置
|
||||
{
|
||||
@@ -4394,9 +4398,9 @@ void HSI_Motion::UpdateMotionState()
|
||||
g_pLogger->SendAndFlushWithTime(L"[UpdateMotionState] Now wait Run End\n");
|
||||
|
||||
printf("\nWaiting for motion end\n");
|
||||
acsc_WaitMotionEnd(handleACS, ACSC_AXIS_1, INFINITE);//依次等待 X,Y,Z轴运动到位
|
||||
acsc_WaitMotionEnd(handleACS, ACSC_AXIS_0, INFINITE);
|
||||
acsc_WaitMotionEnd(handleACS, ACSC_AXIS_1, INFINITE);
|
||||
acsc_WaitMotionEnd(handleACS, ACSC_AXIS_4, INFINITE);
|
||||
acsc_WaitMotionEnd(handleACS, ACSC_AXIS_8, INFINITE);
|
||||
printf("\nMotion end\n");
|
||||
|
||||
|
||||
@@ -5271,7 +5275,7 @@ HSI_STATUS HSI_Motion::AbortMotion() //
|
||||
g_IsClose = true;
|
||||
g_pLogger->SendAndFlushWithTime(L"[AbortMotion] In\n");
|
||||
|
||||
int Axes[] = {ACSC_AXIS_0, ACSC_AXIS_1, ACSC_AXIS_4, -1};
|
||||
int Axes[] = {ACSC_AXIS_1, ACSC_AXIS_0, ACSC_AXIS_8, -1};
|
||||
if (handleACS != ACSC_INVALID)
|
||||
{
|
||||
if (!acsc_HaltM(handleACS, Axes, nullptr)) //停止JOG运动
|
||||
@@ -7923,7 +7927,7 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
|
||||
}
|
||||
case HSI_MOTION_AXIS_Z:
|
||||
{
|
||||
AxisNumber = 0x04;
|
||||
AxisNumber = 0x08;
|
||||
break;
|
||||
}
|
||||
case HSI_MOTION_AXIS_R:
|
||||
|
||||
@@ -432,7 +432,7 @@ public:
|
||||
|
||||
short m_AxisThread;
|
||||
int m_IsExMotion; //0是xyz用的,1是单轴用的,2都不用
|
||||
int m_Home_Machine_Axis[5]; //用于启动时需要回原点的轴号选择
|
||||
int m_Home_Machine_Axis[10]; //用于启动时需要回原点的轴号选择
|
||||
int m_Home_Pos_Axis[5]; //记住关闭电源时的位置,用于判断是否还需要回原点
|
||||
int m_IsHomeEncPos; //是否启动实际位置判断是否回家,默认0,1启用,0关闭
|
||||
int m_IsHomePrfPos; //是否启动规划位置判断是否回家,默认1,1启用,0关闭
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
#include <share.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <locale.h>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
const long LOGINIT = 0x0001;
|
||||
const long LOGACTIONS = 0x0002;
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
#define HSI_VERSION_REVNUM
|
||||
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
|
||||
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
|
||||
#define HSI_FILE_DESCRIPTION "2022.12.01 / 15:52 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2022.12.01 / 15:52 ")
|
||||
#define HSI_FILE_DESCRIPTION "2024.02.26 / 16:16 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2024.02.26 / 16:16 ")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -74,9 +74,9 @@ namespace HSI_SEVENOCEAN_EF1_CsTest
|
||||
#endregion
|
||||
|
||||
//6 是否回家
|
||||
//var bHomed = true;
|
||||
//rStatus = Motion.IsHomed(ref bHomed);
|
||||
//Console.WriteLine("Motion.IsHomed:{0}", rStatus);
|
||||
var bHomed = true;
|
||||
rStatus = Motion.IsHomed(ref bHomed);
|
||||
Console.WriteLine("Motion.IsHomed:{0}", rStatus);
|
||||
var bexit = false;
|
||||
var SpeedGear = 0.2;
|
||||
var dPos = new double[3];
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Generated
+19
-8
@@ -80,7 +80,7 @@
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.formsPlot1 = new ScottPlot.FormsPlot();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.sharpGLViewportControl1 = new HexcalMC.Base.SharpGLViewportControl();
|
||||
this.openGLControl1 = new SharpGL.OpenGLControl();
|
||||
this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
|
||||
this.groupBox7 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
@@ -146,6 +146,7 @@
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.openGLControl1)).BeginInit();
|
||||
this.groupBox7.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
@@ -635,7 +636,7 @@
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.sharpGLViewportControl1);
|
||||
this.tabPage2.Controls.Add(this.openGLControl1);
|
||||
this.tabPage2.Controls.Add(this.elementHost1);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
@@ -645,12 +646,21 @@
|
||||
this.tabPage2.Text = "3D绘图";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// sharpGLViewportControl1
|
||||
// openGLControl1
|
||||
//
|
||||
this.sharpGLViewportControl1.Location = new System.Drawing.Point(28, 16);
|
||||
this.sharpGLViewportControl1.Name = "sharpGLViewportControl1";
|
||||
this.sharpGLViewportControl1.Size = new System.Drawing.Size(699, 314);
|
||||
this.sharpGLViewportControl1.TabIndex = 1;
|
||||
this.openGLControl1.DrawFPS = false;
|
||||
this.openGLControl1.Location = new System.Drawing.Point(10, 16);
|
||||
this.openGLControl1.Name = "openGLControl1";
|
||||
this.openGLControl1.OpenGLVersion = SharpGL.Version.OpenGLVersion.OpenGL2_1;
|
||||
this.openGLControl1.RenderContextType = SharpGL.RenderContextType.DIBSection;
|
||||
this.openGLControl1.RenderTrigger = SharpGL.RenderTrigger.TimerBased;
|
||||
this.openGLControl1.Size = new System.Drawing.Size(724, 314);
|
||||
this.openGLControl1.TabIndex = 1;
|
||||
this.openGLControl1.Visible = false;
|
||||
this.openGLControl1.OpenGLInitialized += new System.EventHandler(this.openGLControl1_OpenGLInitialized);
|
||||
this.openGLControl1.OpenGLDraw += new SharpGL.RenderEventHandler(this.openGLControl1_OpenGLDraw);
|
||||
this.openGLControl1.GDIDraw += new SharpGL.RenderEventHandler(this.openGLControl1_GDIDraw);
|
||||
this.openGLControl1.Resized += new System.EventHandler(this.openGLControl1_Resized);
|
||||
//
|
||||
// elementHost1
|
||||
//
|
||||
@@ -1231,6 +1241,7 @@
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.openGLControl1)).EndInit();
|
||||
this.groupBox7.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
@@ -1355,6 +1366,6 @@
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private ScottPlot.FormsPlot formsPlot1;
|
||||
private System.Windows.Forms.Integration.ElementHost elementHost1;
|
||||
private Base.SharpGLViewportControl sharpGLViewportControl1;
|
||||
private SharpGL.OpenGLControl openGLControl1;
|
||||
}
|
||||
}
|
||||
|
||||
+349
-88
@@ -1,46 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ACS.SPiiPlusNET;
|
||||
using HexcalMC.Base;
|
||||
using HexcalMC.Form;
|
||||
using HexcalMC.Hexcal;
|
||||
using HexcalMC.Properties;
|
||||
using SharpGL;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace HexcalMC
|
||||
{
|
||||
//定一个 回家状态枚举,包括 从未回家,正在回家,已经回家
|
||||
public enum HomeStates
|
||||
{
|
||||
None, //默认状态
|
||||
NotHome,
|
||||
Homing,
|
||||
Homed
|
||||
}
|
||||
|
||||
//定义 运动状态枚举,包括 正在运动,运动到位,Jog运动
|
||||
public enum MotionStates
|
||||
{
|
||||
None, //默认状态
|
||||
Moving,
|
||||
InPos,
|
||||
Jogging
|
||||
}
|
||||
|
||||
public partial class MainFrom : RadRibbonForm
|
||||
{
|
||||
private List<Point3D> _pointCloud = new List<Point3D>(); //运动中点集合
|
||||
|
||||
|
||||
|
||||
public MainFrom()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
var sharpGlViewportControl = new SharpGLViewportControl
|
||||
{
|
||||
Dock = DockStyle.Fill
|
||||
};
|
||||
#region 3D相关绘制,暂时取消
|
||||
|
||||
var tabPage = new TabPage("3D 窗口");
|
||||
tabPage.Controls.Add(sharpGlViewportControl);
|
||||
tabControl1.TabPages.Add(tabPage);
|
||||
//var sharpGlViewportControl = new SharpGLViewportControl
|
||||
//{
|
||||
// Dock = DockStyle.Fill
|
||||
//};
|
||||
|
||||
//var tabPage = new TabPage("3D 窗口");
|
||||
//tabPage.Controls.Add(sharpGlViewportControl);
|
||||
//tabControl1.TabPages.Add(tabPage);
|
||||
|
||||
//// 设置容器控件的 DoubleBuffered 属性为 true
|
||||
//DoubleBuffered = true;
|
||||
//// 创建一个包含点云数据的列表
|
||||
//var points = new List<Point3D>
|
||||
//{
|
||||
// new Point3D(0, 0, 0),
|
||||
// new Point3D(1, 1, 1),
|
||||
// new Point3D(-1, -1, -1)
|
||||
// // 可以添加更多的点云数据
|
||||
//};
|
||||
|
||||
//// 将点云数据传递给 SharpGLViewportControl
|
||||
//sharpGlViewportControl.SetPointCloud(points);
|
||||
|
||||
tabControl1.TabPages.RemoveAt(1);
|
||||
|
||||
#endregion
|
||||
|
||||
// 设置容器控件的 DoubleBuffered 属性为 true
|
||||
DoubleBuffered = true;
|
||||
// 创建一个包含点云数据的列表
|
||||
var points = new List<Point3D>
|
||||
{
|
||||
new Point3D(0, 0, 0),
|
||||
new Point3D(1, 1, 1),
|
||||
new Point3D(-1, -1, -1)
|
||||
// 可以添加更多的点云数据
|
||||
};
|
||||
|
||||
// 将点云数据传递给 SharpGLViewportControl
|
||||
sharpGlViewportControl.SetPointCloud(points);
|
||||
}
|
||||
|
||||
private void MainFrom_Load(object sender, EventArgs e)
|
||||
@@ -52,22 +82,19 @@ namespace HexcalMC
|
||||
|
||||
//加载配置文件
|
||||
LoadConfig();
|
||||
double[] dataX = { 1, 2, 3, 4, 5 };
|
||||
double[] dataY = { 1, 4, 9, 16, 25 };
|
||||
|
||||
formsPlot1.Plot.AddScatter(dataX, dataY);
|
||||
formsPlot1.Refresh();
|
||||
|
||||
//启动界面刷新
|
||||
timer_RefreshUI.Start();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
private void MainFrom_Shown(object sender, EventArgs e) //窗体显示准备好接受用户输入时发生
|
||||
{
|
||||
//启动服务端,用于接收hexcal传来的指令
|
||||
StartServer();
|
||||
|
||||
|
||||
//Plot3D();
|
||||
}
|
||||
|
||||
private void MainFrom_FormClosed(object sender, FormClosedEventArgs e)
|
||||
@@ -95,24 +122,58 @@ namespace HexcalMC
|
||||
Errors.StatusWrite.Close();
|
||||
}
|
||||
|
||||
//定一个 回家状态枚举,包括 从未回家,正在回家,已经回家
|
||||
private enum HomeStates
|
||||
private void LoadConfig() //加载配置文件
|
||||
{
|
||||
None, //默认状态
|
||||
NotHome,
|
||||
Homing,
|
||||
Homed
|
||||
//判断配置文件是否存在
|
||||
if (!File.Exists(StrConfigFile))
|
||||
{
|
||||
MessageBox.Show("配置文件不存在,请检查配置文件", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
//正限位
|
||||
X_MAXSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "X_MAXSTROKESW");
|
||||
Y_MAXSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "Y_MAXSTROKESW");
|
||||
Z_MAXSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "Z_MAXSTROKESW");
|
||||
|
||||
//负限位
|
||||
X_MINSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "X_MINSTROKESW");
|
||||
Y_MINSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "Y_MINSTROKESW");
|
||||
Z_MINSTROKESW = FileIni.ReadDouble(StrConfigFile, "MOTOR", "Z_MINSTROKESW");
|
||||
}
|
||||
|
||||
//定义 运动状态枚举,包括 正在运动,运动到位,Jog运动
|
||||
private enum MotionStates
|
||||
private void Plot2D(List<Point3D> pointCloud)
|
||||
{
|
||||
None, //默认状态
|
||||
Moving,
|
||||
InPos,
|
||||
Jogging
|
||||
// 清空画布
|
||||
formsPlot1.Plot.Clear();
|
||||
|
||||
List<double> dataX = new List<double>();
|
||||
List<double> dataY = new List<double>();
|
||||
|
||||
foreach (Point3D point3D in pointCloud)
|
||||
{
|
||||
dataX.Add(point3D.X);
|
||||
dataY.Add(point3D.Y);
|
||||
}
|
||||
|
||||
formsPlot1.Plot.AddScatter(dataX.ToArray(), dataY.ToArray());
|
||||
formsPlot1.Refresh();
|
||||
}
|
||||
|
||||
private void Plot3D() //绘制3D图
|
||||
{
|
||||
List<Point3D> points = new List<Point3D>();
|
||||
|
||||
// 假设已经有了一些点的数据,将其添加到 List<Point3D> 对象中
|
||||
points.Add(new Point3D(1, 2, 3));
|
||||
points.Add(new Point3D(4, 5, 6));
|
||||
|
||||
LoadPoints(points);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 运动平台变量区
|
||||
|
||||
private Api _acs;
|
||||
@@ -139,15 +200,16 @@ namespace HexcalMC
|
||||
private Label[] _mLblRightLimit; //右限位
|
||||
|
||||
private HomeStates _homeStates; //回家状态
|
||||
private MotionStates _motionStates; //运动状态
|
||||
private readonly int _motion_timeout = 5000; //定义运动超时时间
|
||||
private MotionStates _currentMotionState; //当前运动状态
|
||||
private readonly int _motionTimeout = 5000; //定义运动超时时间
|
||||
|
||||
|
||||
public static Axis[] USE_AXIS =
|
||||
{ Axis.ACSC_AXIS_0, Axis.ACSC_AXIS_1, Axis.ACSC_AXIS_4, Axis.ACSC_NONE }; //定义启用的轴,后面运动时会使用
|
||||
|
||||
|
||||
//定义 XYZ三个轴的左右行程范围
|
||||
public string strConfigFile = Application.StartupPath + "\\File\\config.ini";
|
||||
public string StrConfigFile = Application.StartupPath + "\\File\\config.ini";
|
||||
public static double X_MAXSTROKESW = 100.0; //正限位
|
||||
public static double Y_MAXSTROKESW = 50.0;
|
||||
public static double Z_MAXSTROKESW = 10.0;
|
||||
@@ -156,7 +218,6 @@ namespace HexcalMC
|
||||
public static double Y_MINSTROKESW = -50.0;
|
||||
public static double Z_MINSTROKESW = -10.0;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region hexcal变量区
|
||||
@@ -230,6 +291,53 @@ namespace HexcalMC
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConstructString(string variableName, double[] values)
|
||||
{
|
||||
string result = variableName + " ";
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
result += values[i].ToString("F6");
|
||||
if (i < values.Length - 1)
|
||||
{
|
||||
result += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string ConstructPosString(Point3D point)
|
||||
{
|
||||
double[] values = { point.X, point.Y, point.Z, 0.0, 0.0, 0.0, 0.0 };
|
||||
return ConstructString("POS", values);
|
||||
}
|
||||
|
||||
public static Point3D ParsePoint3DFromCommand(string input)
|
||||
{
|
||||
string[] parts = input.Split(' ')[1].Split(',');
|
||||
if (parts.Length >= 3)
|
||||
{
|
||||
double x = double.Parse(parts[0]);
|
||||
double y = double.Parse(parts[1]);
|
||||
double z = double.Parse(parts[2]);
|
||||
return new Point3D(x, y, z);
|
||||
}
|
||||
|
||||
throw new ArgumentException("输入字符串格式不正确。");
|
||||
}
|
||||
|
||||
private void CheckPlatformStatus()
|
||||
{
|
||||
if (_currentMotionState == MotionStates.None || _currentMotionState == MotionStates.InPos) //默认或到位
|
||||
{
|
||||
SendMsgToHexcal("READY");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMsgToHexcal("BUSY");
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseHexcalMsg(string msg) //编写一个Hexcal协议解析函数
|
||||
{
|
||||
DebugDfn.AddLogText("正在解析" + msg);
|
||||
@@ -240,16 +348,17 @@ namespace HexcalMC
|
||||
|
||||
if (msg.Contains("\x02") || msg.Contains("\u0002"))
|
||||
{
|
||||
// 发送 "READY" 字符串作为响应
|
||||
byte[] response = Encoding.ASCII.GetBytes("READY");
|
||||
SendMsgToHexcal("READY");
|
||||
CheckPlatformStatus();
|
||||
}
|
||||
else if (msg.Contains("\x03") || msg.Contains("\u0003"))
|
||||
{
|
||||
// 发送 "READY" 字符串作为响应
|
||||
byte[] response = Encoding.ASCII.GetBytes("READY");
|
||||
SendMsgToHexcal("READY");
|
||||
CheckPlatformStatus();
|
||||
}
|
||||
else if (msg.Contains("^B")) //查询状态, READY或BUSY
|
||||
{
|
||||
CheckPlatformStatus();
|
||||
}
|
||||
|
||||
else if (msg.Contains("CMMTYP")) //测量机类型
|
||||
{
|
||||
SendMsgToHexcal("CMMTYP MA 19617, FDC V15.00, 6 6 2 , 0");
|
||||
@@ -258,17 +367,22 @@ namespace HexcalMC
|
||||
{
|
||||
SendMsgToHexcal("00-000-000-00000 FDC V51.04.0000 DATE: 12/21/22 TIME: 12:50:55");
|
||||
}
|
||||
else if (msg.Contains("^B")) //查询状态, READY或BUSY
|
||||
{
|
||||
SendMsgToHexcal("READY");
|
||||
}
|
||||
|
||||
else if (msg.Contains("SHOW MAXSTROKESW")) //最大行程,根据实际情况填写
|
||||
{
|
||||
SendMsgToHexcal("MAXSTROKESW 233.200000,346.500000,15.100000,0.000000,0.000000,0.000000,0.000000");
|
||||
//SendMsgToHexcal("MAXSTROKESW 233.200000,346.500000,15.100000,0.000000,0.000000,0.000000,0.000000");
|
||||
|
||||
double[] values = { X_MAXSTROKESW, Y_MAXSTROKESW, Z_MAXSTROKESW, 0.0, 0.0, 0.0, 0.0 };
|
||||
string resultString = ConstructString("MAXSTROKESW", values);
|
||||
SendMsgToHexcal(resultString);
|
||||
}
|
||||
else if (msg.Contains("SHOW MINSTROKESW")) //最小行程,根据实际情况填写
|
||||
{
|
||||
SendMsgToHexcal("MINSTROKESW -68.800000,-55.500000,-286.900000,0.000000,0.000000,0.000000,0.000000");
|
||||
//SendMsgToHexcal("MINSTROKESW -68.800000,-55.500000,-286.900000,0.000000,0.000000,0.000000,0.000000");
|
||||
|
||||
double[] values = { X_MINSTROKESW, Y_MINSTROKESW, Z_MINSTROKESW, 0.0, 0.0, 0.0, 0.0 };
|
||||
string resultString = ConstructString("MINSTROKESW", values);
|
||||
SendMsgToHexcal(resultString);
|
||||
}
|
||||
else if (msg.Contains("SHOW MAXVEL")) //最大速度
|
||||
{
|
||||
@@ -287,11 +401,11 @@ namespace HexcalMC
|
||||
{
|
||||
SendMsgToHexcal("X_SENSAXIS 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
|
||||
}
|
||||
else if (msg.Contains("SHOW Y_SENSAXIS")) //查询Y轴行程
|
||||
else if (msg.Contains("SHOW Y_SENSAXIS")) //查询Y轴
|
||||
{
|
||||
SendMsgToHexcal("Y_SENSAXIS 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
|
||||
}
|
||||
else if (msg.Contains("SHOW Z_SENSAXIS")) //查询Z轴行程
|
||||
else if (msg.Contains("SHOW Z_SENSAXIS")) //查询Z轴
|
||||
{
|
||||
SendMsgToHexcal("Z_SENSAXIS 7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
|
||||
}
|
||||
@@ -352,17 +466,26 @@ namespace HexcalMC
|
||||
else if (msg.Contains("AUTZER")) //回家指令
|
||||
{
|
||||
SendMsgToHexcal("%"); //收到并执行,同时状态改为忙碌
|
||||
|
||||
//执行回家
|
||||
Ishome();
|
||||
}
|
||||
else if (msg.Contains("MOVABS")) //移动指令,解析移动位置
|
||||
{
|
||||
//MOVABS 0.015000,127.172997,-114.897003,0.000000\r\n
|
||||
|
||||
|
||||
//收到指令 ,形如 MOVABS 0.015000,127.172997,-114.897003,0.000000\r\n
|
||||
SendMsgToHexcal("%");
|
||||
|
||||
Point3D point = ParsePoint3DFromCommand(msg);
|
||||
SetPositionXyz(point); //开始移动
|
||||
|
||||
_pointCloud.Add(point); //添加到点集合
|
||||
}
|
||||
else if (msg.Contains("GETPOS")) //获取位置
|
||||
{
|
||||
SendMsgToHexcal("POS 167.553898,-55.400421,-208.548678,0.000000,0.000000,0.000000,0.000000");
|
||||
//SendMsgToHexcal("POS 167.553898,-55.400421,-208.548678,0.000000,0.000000,0.000000,0.000000");
|
||||
Point3D point3D = GetPositionXyz(); //获取当前位置
|
||||
string resultString = ConstructPosString(point3D);
|
||||
SendMsgToHexcal(resultString);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -605,9 +728,9 @@ namespace HexcalMC
|
||||
if (_acs != null && _mBConnected)
|
||||
|
||||
{
|
||||
var yaw_home = _acs.ReadVariable("YAW_HOME_DONE");
|
||||
var yawHome = _acs.ReadVariable("YAW_HOME_DONE");
|
||||
|
||||
if (yaw_home != null && (bool)yaw_home)
|
||||
if (yawHome != null && (bool)yawHome)
|
||||
{
|
||||
//弹窗提示
|
||||
MessageBox.Show("轴已经回家", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@@ -625,16 +748,18 @@ namespace HexcalMC
|
||||
|
||||
_acs.RunBuffer(ProgramBuffer.ACSC_BUFFER_6, null); //执行回家指令,这里的buffer6是回家指令的buffer
|
||||
_homeStates = HomeStates.Homing;
|
||||
_motionStates = MotionStates.Moving;
|
||||
_currentMotionState = MotionStates.Moving;
|
||||
DebugDfn.AddLogText("回家运动中");
|
||||
|
||||
//等待回家完成
|
||||
for (int i = 0; i < USE_AXIS.Length; i++)
|
||||
{
|
||||
_acs.WaitMotionEnd(USE_AXIS[i], _motion_timeout); //等待回家完成
|
||||
_acs.WaitMotionEnd(USE_AXIS[i], _motionTimeout); //等待回家完成
|
||||
}
|
||||
|
||||
_homeStates = HomeStates.Homed;
|
||||
_motionStates = MotionStates.InPos;
|
||||
_currentMotionState = MotionStates.InPos;
|
||||
DebugDfn.AddLogText("回家完成");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -649,28 +774,181 @@ namespace HexcalMC
|
||||
{
|
||||
//运动相关变量初始化
|
||||
_homeStates = HomeStates.None;
|
||||
_motionStates = MotionStates.None;
|
||||
_currentMotionState = MotionStates.None;
|
||||
_currentMotionState = MotionStates.None;
|
||||
|
||||
//轴启用,加电
|
||||
_acs.EnableM(USE_AXIS);
|
||||
for (int i = 0; i < USE_AXIS.Length; i++)
|
||||
{
|
||||
_acs.WaitMotorEnabled(USE_AXIS[i], 1, _motionTimeout); //等待电机使能
|
||||
}
|
||||
|
||||
DebugDfn.AddLogText("电机已启用");
|
||||
|
||||
//回家
|
||||
Ishome();
|
||||
}
|
||||
|
||||
private bool IsWithinStrokes(Point3D point) //判断点是否在行程范围内
|
||||
{
|
||||
if (point.X >= X_MINSTROKESW && point.X <= X_MAXSTROKESW &&
|
||||
point.Y >= Y_MINSTROKESW && point.Y <= Y_MAXSTROKESW &&
|
||||
point.Z >= Z_MINSTROKESW && point.Z <= Z_MAXSTROKESW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SetPositionXyz(Point3D point3D) //运动到指定位置
|
||||
{
|
||||
//判断 point3D是否合法
|
||||
if(point3D)
|
||||
if (!_mBConnected)
|
||||
{
|
||||
DebugDfn.AddLogText("ACS平台未连接,请先点击连接");
|
||||
MessageBox.Show("ACS平台未连接,请先点击连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentMotionState != MotionStates.Moving)
|
||||
{
|
||||
_currentMotionState = MotionStates.Moving; //设置当前运动状态
|
||||
//判断 point3D是否合法
|
||||
if (point3D != null)
|
||||
{
|
||||
if (IsWithinStrokes(point3D)) //判断点是否在行程范围内
|
||||
{
|
||||
double[] pointsArray =
|
||||
{
|
||||
point3D.Y,
|
||||
point3D.X,
|
||||
point3D.Z
|
||||
};
|
||||
|
||||
//执行运动指令
|
||||
_acs.ToPointM(MotionFlags.ACSC_NONE, USE_AXIS, pointsArray); //多轴运动到指定位置
|
||||
|
||||
//等待运动完成
|
||||
for (int i = 0; i < USE_AXIS.Length; i++)
|
||||
{
|
||||
_acs.WaitMotionEnd(USE_AXIS[i], _motionTimeout); //等待回家完成
|
||||
}
|
||||
|
||||
_currentMotionState = MotionStates.InPos;
|
||||
DebugDfn.AddLogText("运动到位");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugDfn.AddLogText("目标位置超出行程范围,请重新设置");
|
||||
MessageBox.Show("目标位置超出行程范围,请重新设置", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugDfn.AddLogText("目标位置为空,请重新设置");
|
||||
MessageBox.Show("目标位置为空,请重新设置", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPositionXyz() //获取当前位置
|
||||
|
||||
private Point3D GetPositionXyz(int positionMode = 1) //获取当前位置
|
||||
{
|
||||
double xPosition = 0, yPosition = 0, zPosition = 0;
|
||||
Point3D point3D = new Point3D(xPosition, yPosition, zPosition);
|
||||
if (!_mBConnected)
|
||||
{
|
||||
DebugDfn.AddLogText("ACS平台未连接,请先点击连接");
|
||||
MessageBox.Show("ACS平台未连接,请先点击连接", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return point3D;
|
||||
}
|
||||
|
||||
//获取当前位置, 两种 GetRPosition,GetFPosition
|
||||
if (positionMode == 1)
|
||||
{
|
||||
//获取反馈位置 Feedback position (Encoder value) ACSPL+ Variable : FPO (real)
|
||||
xPosition = _acs.GetFPosition(USE_AXIS[0]);
|
||||
yPosition = _acs.GetFPosition(USE_AXIS[1]);
|
||||
zPosition = _acs.GetFPosition(USE_AXIS[2]);
|
||||
DebugDfn.AddLogText("反馈位置: " + xPosition + " " + yPosition + " " + zPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
//获取参考位置 ACSPL+ Variable : RPOS (real)
|
||||
xPosition = _acs.GetRPosition(USE_AXIS[0]);
|
||||
yPosition = _acs.GetRPosition(USE_AXIS[1]);
|
||||
zPosition = _acs.GetRPosition(USE_AXIS[2]);
|
||||
DebugDfn.AddLogText("参考位置: " + xPosition + " " + yPosition + " " + zPosition);
|
||||
}
|
||||
|
||||
//获取位置误差
|
||||
double positionError = (double)_acs.ReadVariable("PE", ProgramBuffer.ACSC_NONE, 0, 2);
|
||||
DebugDfn.AddLogText("位置误差: " + positionError);
|
||||
|
||||
//构造point3D格式
|
||||
point3D = new Point3D(xPosition, yPosition, zPosition);
|
||||
|
||||
return point3D;
|
||||
}
|
||||
|
||||
private void GetSpeedXyz() //获取运动参数
|
||||
{
|
||||
//获取实际速度
|
||||
double feedbackVelocity = (double)_acs.ReadVariable("FVEL", ProgramBuffer.ACSC_NONE, 0, 2);
|
||||
DebugDfn.AddLogText("实际速度: " + feedbackVelocity);
|
||||
}
|
||||
|
||||
private void openGLControl1_OpenGLDraw(object sender, SharpGL.RenderEventArgs args)
|
||||
{
|
||||
OpenGL gl = openGLControl1.OpenGL;
|
||||
|
||||
gl.ClearColor(0, 0, 0, 0);
|
||||
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
gl.LoadIdentity();
|
||||
//gl.Translate(0.0f, 0.0f, -5.0f); // 平移场景
|
||||
|
||||
}
|
||||
|
||||
private void LoadPoints(List<Point3D> points)
|
||||
{
|
||||
OpenGL gl = openGLControl1.OpenGL;
|
||||
|
||||
gl.ClearColor(0, 0, 0, 0);
|
||||
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
gl.LoadIdentity();
|
||||
//gl.Translate(0.0f, 0.0f, -5.0f); // 平移场景
|
||||
|
||||
gl.Begin(OpenGL.GL_POINTS);
|
||||
foreach (Point3D point in points)
|
||||
{
|
||||
// 设置点的颜色
|
||||
gl.Color(1.0f, 0.0f, 0.0f); // 红色
|
||||
|
||||
// 设置点的大小
|
||||
gl.PointSize(5.0f); // 大小为5个单位
|
||||
gl.Vertex(point.X, point.Y, point.Z);
|
||||
}
|
||||
gl.End();
|
||||
|
||||
gl.Flush();
|
||||
}
|
||||
|
||||
private void openGLControl1_OpenGLInitialized(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void openGLControl1_Resized(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void openGLControl1_GDIDraw(object sender, SharpGL.RenderEventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SetSpeedXyz() //设置运动参数
|
||||
@@ -680,25 +958,6 @@ namespace HexcalMC
|
||||
|
||||
#endregion ACS平台相关
|
||||
|
||||
private void LoadConfig() //加载配置文件
|
||||
{
|
||||
//判断配置文件是否存在
|
||||
if (!File.Exists(strConfigFile))
|
||||
{
|
||||
MessageBox.Show("配置文件不存在,请检查配置文件", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
//正限位
|
||||
X_MAXSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "X_MAXSTROKESW", 0);
|
||||
Y_MAXSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "Y_MAXSTROKESW", 0);
|
||||
Z_MAXSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "Z_MAXSTROKESW", 0);
|
||||
|
||||
//负限位
|
||||
X_MINSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "X_MINSTROKESW", 0);
|
||||
Y_MINSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "Y_MINSTROKESW", 0);
|
||||
Z_MINSTROKESW = FileIni.ReadDouble(strConfigFile, "MOTOR", "Z_MINSTROKESW", 0);
|
||||
}
|
||||
|
||||
#region 菜单栏
|
||||
|
||||
private void Rtb_motion_Click(object sender, EventArgs e) //ACS调试页面
|
||||
@@ -723,6 +982,8 @@ namespace HexcalMC
|
||||
//时间栏
|
||||
//获取当前时间,构造形如 精确到秒,例如 2023-10-08 16:01:23
|
||||
rle_timer.Text = "当前时间: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
Plot2D(_pointCloud);//绘图
|
||||
}
|
||||
|
||||
#endregion 菜单栏
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace HexcalMC
|
||||
MyBase.TraceWriteLine("--软件Main函数开始");
|
||||
|
||||
Application.Run(new MainFrom());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /></startup>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
Reference in New Issue
Block a user