平台阶段性结束

1、新增了加速度,减速度,运行速度读配置档位
2、优化了串口通讯,待继续调试
3、测试用例,新增了 DCCScanStart() 和 DCCScanStop()的调试
This commit is contained in:
zhengxuan.zhang
2022-11-25 10:51:04 +08:00
parent 341aaa08ff
commit b94d85b393
9 changed files with 453 additions and 220 deletions
+60 -14
View File
@@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using static HSI_SEVENOCEAN_EF1_CsTest.HSI.Def;
namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
{
@@ -25,7 +26,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
//1、返回值不能为void,且需要使用ref关键字(或者ref readonly表示只读)修饰返回类型
//2、方法的每一个return语句需要是一个ref引用
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_GET_FIREWAREVERION", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS MotionGetFirewareVerion( IntPtr firewareVerion);
public static extern Def.HSI_STATUS MotionGetFirewareVerion(IntPtr firewareVerion);
[DllImport("HSI.dll", EntryPoint = "HSI_STARTUP", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS Startup(IntPtr hWnd, bool bOfflineOnly);
@@ -68,7 +69,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
var eventFunctionId = (Def.HSI_EVENT_FUNCTION_ID)eventId;
switch (eventFunctionId)
{
case Def.HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME://准备回家
case Def.HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME: //准备回家
{
MessageBox.Show(Resources.Interface_Tips_Home_Machine, Resources.Interface_Tips,
msgBtn, MessageBoxIcon.Information);
@@ -132,6 +133,16 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_SET_SPEED_XYZ", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS SetSpeedXyz(double speed);
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_SET_DATA", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS DCCScanSetData(uint axisTypes, Def.HSI_SCAN_MOTION_TYPE eType, uint lTrigNumber, double[] dTrigDis);
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_START", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS DCCScanStart();
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_DCC_SCAN_STOP", CharSet = CharSet.Unicode)]
public static extern Def.HSI_STATUS DCCScanStop();
//[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_GET_SPEED_R", CharSet = CharSet.Unicode)]
//public static extern Def.HSI_STATUS GetSpeedR(ref double speed);
@@ -367,6 +378,17 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
HSI_ILLUMINATION_BULB_GRID = 4
}
public enum HSI_SCAN_MOTION_TYPE
{
HSI_SCAN_MOTION_LINEAR = 1,
HSI_SCAN_MOTION_CIRCULAR,
HSI_SCAN_MOTION_SPEC_LOCA = 100,//EF1
HSI_SCAN_MOTION_EQ_DIS,
HSI_SCAN_MOTION_EQ_DIS_II,
HSI_SCAN_MOTION_LINEAR_TEST,//测试使用
HSI_SCAN_MOTION_EQ_TEST,//测试使用
HSI_SCAN_MOTION_MANUAL_TEST //测试使用
};
///////////////////////////////////////////////////////////////////////////////
//Illumination API
@@ -437,18 +459,42 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
HSI_MOTION_AXIS_Y = 0x0002, // This is the default "Sensor level" Y Axis - use on single Y axis machines
HSI_MOTION_AXIS_Z = 0x0004, // This is the default "Sensor level" Z Axis - use on single Z axis machines
HSI_MOTION_AXIS_R = 0x0008, // This is the default "Sensor level" R Axis - use on single R axis machines
HSI_MOTION_AXIS_X1 = 0x0010, // This is the 1st X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y1 = 0x0020, // This is the 1st Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z1 = 0x0040, // This is the 1st Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R1 = 0x0080, // This is the 1st R Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_X2 = 0x0100, // This is the 2nd X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y2 = 0x0200, // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z2 = 0x0400, // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R2 = 0x0800, // This is the 2nd R Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_X3 = 0x1000, // This is the 3rd X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y3 = 0x2000, // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z3 = 0x4000, // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R3 = 0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_X1 =
0x0010, // This is the 1st X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y1 =
0x0020, // This is the 1st Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z1 =
0x0040, // This is the 1st Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R1 =
0x0080, // This is the 1st R Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_X2 =
0x0100, // This is the 2nd X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y2 =
0x0200, // This is the 2nd Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z2 =
0x0400, // This is the 2nd Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R2 =
0x0800, // This is the 2nd R Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_X3 =
0x1000, // This is the 3rd X Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Y3 =
0x2000, // This is the 3rd Y Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_Z3 =
0x4000, // This is the 3rd Z Axis - use on multiple axis machines when specific axis needed
HSI_MOTION_AXIS_R3 =
0x8000 // This is the 3rd R Axis - use on multiple axis machines when specific axis needed
}
public enum HSI_MOTION_IO_TYPE
+11 -1
View File
@@ -136,10 +136,20 @@ namespace HSI_SEVENOCEAN_EF1_CsTest
{
SpeedGear = 0.1;
}
Console.WriteLine("Motion.SpeedGera:{0}", SpeedGear);
break;
case ConsoleKey.NumPad5:
Motion.DCCScanStart();
break;
case ConsoleKey.NumPad7:
Motion.DCCScanStop();
break;
case ConsoleKey.NumPad9:
var dPos1 = new double[3];
dPos1[0] = 100;
Motion.DCCScanSetData(1, Def.HSI_SCAN_MOTION_TYPE.HSI_SCAN_MOTION_EQ_DIS,7, dPos1);
break;
//case ConsoleKey.LeftArrow:
// break;
//case ConsoleKey.RightArrow: