IMotionControl.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TeamAAS.Motion.Models;
  7. using static TeamAAS.Motion.Events.CardAxisEventArgs;
  8. namespace TeamAAS.Motion.Interfaces
  9. {
  10. public interface IMotionControl
  11. {
  12. // --- 1. 属性 (Properties) ---
  13. /// <summary>控制卡是否已连接</summary>
  14. bool IsConnected { get; }
  15. /// <summary>控制卡名称/型号</summary>
  16. string CardName { get; }
  17. /// <summary>控制卡支持的最大轴数</summary>
  18. int MaxAxisCount { get; }
  19. // --- 2. 方法 (Methods) ---
  20. // 2.1 设备生命周期管理
  21. /// <summary>连接控制卡</summary>
  22. /// <param name="connectionString">连接字符串,如IP地址"192.168.1.100"或设备索引号"0"[reference:5]</param>
  23. /// <returns>是否连接成功</returns>
  24. bool Connect(string connectionString);
  25. /// <summary>断开与控制卡的连接</summary>
  26. void Disconnect();
  27. // 2.2 获取轴对象
  28. /// <summary>根据轴号获取轴控制接口</summary>
  29. IAxis GetAxis(int axisNo);
  30. /// <summary>获取所有轴的控制接口列表</summary>
  31. IList<IAxis> GetAxes();
  32. // 2.3 高级运动功能(多轴协同)
  33. /// <summary>执行多轴直线插补运动[reference:6]</summary>
  34. void MoveLinear(double[] targetPositions, double velocity);
  35. /// <summary>执行多轴圆弧插补运动[reference:7]</summary>
  36. void MoveArc(double[] centerPoint, double[] targetPositions, double velocity);
  37. /// <summary>停止所有轴的运动(急停)</summary>
  38. void EmergencyStop();
  39. // 2.4 通用I/O操作
  40. /// <summary>读取数字量输入</summary>
  41. bool ReadDI(int portIndex);
  42. /// <summary>写入数字量输出</summary>
  43. void WriteDO(int portIndex, bool value);
  44. // --- 3. 事件 (Events) ---
  45. /// <summary>控制卡连接状态发生变化时触发</summary>
  46. event EventHandler<ConnectionStateChangedEventArgs> ConnectionStateChanged;
  47. /// <summary>控制卡发生错误时触发</summary>
  48. event EventHandler<ErrorOccurredEventArgs> ErrorOccurred;
  49. }
  50. }