MotionPluginModels.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.ComponentModel;
  2. using Plugins.Motion.Core;
  3. using PropertyGridLib.Attributes;
  4. using PropertyGridLib.Controls;
  5. using TeamAAS.FlowEditor.Plugins;
  6. using TeamAAS.FlowEngine.FormulaData;
  7. namespace Plugins.Motion.Models
  8. {
  9. [System.Serializable]
  10. public class MotionAxisModel : BasePluginModel
  11. {
  12. [DisplayName("运动卡")]
  13. [Description("从已配置的运动卡中选择")]
  14. [Category("I.设备")]
  15. [TypeConverter(typeof(MotionCardNameConverter))]
  16. public string MotionCardName { get; set; } = "";
  17. [DisplayName("轴号")]
  18. [Description("轴号从 0 开始;使能/下使能/停止可用 -1 表示全部轴")]
  19. [Category("I.设备")]
  20. public int AxisNo { get; set; } = 0;
  21. [DisplayName("未连接时自动连接")]
  22. [Description("运动卡未连接时先尝试 Open")]
  23. [Category("II.执行选项")]
  24. public bool AutoConnect { get; set; } = true;
  25. }
  26. [System.Serializable]
  27. public class MotionEnableModel : MotionAxisModel { }
  28. [System.Serializable]
  29. public class MotionDisableModel : MotionAxisModel { }
  30. [System.Serializable]
  31. public class MotionStopModel : MotionAxisModel
  32. {
  33. [DisplayName("急停")]
  34. [Description("勾选后对整卡急停;不勾选则平滑停止指定轴")]
  35. [Category("II.执行选项")]
  36. public bool Emergency { get; set; } = false;
  37. }
  38. [System.Serializable]
  39. public class MotionWaitModel : MotionAxisModel
  40. {
  41. [DisplayName("未使能时自动使能")]
  42. [Description("当前轴未使能时,先自动使能再执行本节点;不勾选则未使能直接失败")]
  43. [Category("II.执行选项")]
  44. public bool AutoEnable { get; set; } = false;
  45. [DisplayName("等待超时(ms)")]
  46. [Description("等待运动完成的超时时间,0 表示不限时(仍受节点 TimeoutMs 约束)")]
  47. [Category("II.执行选项")]
  48. public int WaitTimeoutMs { get; set; } = 10000;
  49. }
  50. [System.Serializable]
  51. public class MotionHomeModel : MotionWaitModel
  52. {
  53. [DisplayName("回零模式")]
  54. [Description("0=Default,1=限位,2=Home 开关,3=Z 相")]
  55. [Category("III.运动参数")]
  56. public int HomeMode { get; set; } = 0;
  57. }
  58. [System.Serializable]
  59. public class MotionMoveAbsModel : MotionWaitModel
  60. {
  61. [DisplayName("目标位置")]
  62. [Description("绝对定位目标,可用公式绑定视觉补偿")]
  63. [Category("III.运动参数")]
  64. [FormulaEditor(typeof(PluginDataProvider))]
  65. public FormulaBound<double> TargetPosition { get; set; } = new FormulaBound<double>(0);
  66. [DisplayName("速度")]
  67. [Description("定位速度")]
  68. [Category("III.运动参数")]
  69. [FormulaEditor(typeof(PluginDataProvider))]
  70. public FormulaBound<double> Velocity { get; set; } = new FormulaBound<double>(100);
  71. [DisplayName("到位容差")]
  72. [Description("到位后实际位置与目标的允许偏差")]
  73. [Category("III.运动参数")]
  74. public double InPositionTolerance { get; set; } = 0.01;
  75. }
  76. [System.Serializable]
  77. public class MotionMoveRelModel : MotionWaitModel
  78. {
  79. [DisplayName("相对距离")]
  80. [Description("相对当前实际位置的位移,可用公式绑定")]
  81. [Category("III.运动参数")]
  82. [FormulaEditor(typeof(PluginDataProvider))]
  83. public FormulaBound<double> Distance { get; set; } = new FormulaBound<double>(10);
  84. [DisplayName("速度")]
  85. [Description("定位速度")]
  86. [Category("III.运动参数")]
  87. [FormulaEditor(typeof(PluginDataProvider))]
  88. public FormulaBound<double> Velocity { get; set; } = new FormulaBound<double>(100);
  89. [DisplayName("到位容差")]
  90. [Description("到位后实际位移与指令的允许偏差")]
  91. [Category("III.运动参数")]
  92. public double InPositionTolerance { get; set; } = 0.01;
  93. }
  94. }