| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TeamAAS.Global.Devices;
- using static TeamAAS.Motion.Enums.MotionEnums;
- using static TeamAAS.Motion.Events.CardAxisEventArgs;
- namespace TeamAAS.Motion.Interfaces
- {
- /// <summary>
- /// 单轴控制接口
- /// </summary>
- public interface IAxis
- {
- // --- 1. 属性 (Properties) ---
- /// <summary>轴号</summary>
- int AxisNo { get; }
- /// <summary>轴名称(如 "X", "Y", "Z")</summary>
- string Name { get; set; }
- // 1.1 状态属性
- /// <summary>轴当前状态(使能、运动中、错误等)[reference:9]</summary>
- AxisState State { get; }
- /// <summary>轴是否已使能</summary>
- bool IsEnabled { get; }
- /// <summary>轴是否正在运动中</summary>
- bool IsMoving { get; }
- /// <summary>轴是否已完成回零</summary>
- bool IsHomed { get; }
- // 1.2 位置与速度属性
- /// <summary>指令位置(控制器发送的目标位置)</summary>
- double CommandPosition { get; }
- /// <summary>实际反馈位置(来自编码器)[reference:10]</summary>
- double ActualPosition { get; }
- /// <summary>实际反馈速度</summary>
- double ActualVelocity { get; }
- // 1.3 运动参数属性[reference:12]
- /// <summary>运行速度</summary>
- double Velocity { get; set; }
- /// <summary>加速度</summary>
- double Acceleration { get; set; }
- /// <summary>减速度</summary>
- double Deceleration { get; set; }
- /// <summary>加加速度(S曲线平滑因子)</summary>
- double Jerk { get; set; }
- // --- 2. 方法 (Methods) ---
- // 2.1 使能与控制
- /// <summary>使能轴(开启伺服)</summary>
- void Enable();
- /// <summary>关闭轴使能</summary>
- void Disable();
- // 2.2 运动指令[reference:14]
- /// <summary>绝对运动:移动到指定绝对位置</summary>
- void MoveTo(double position);
- /// <summary>相对运动:从当前位置移动指定距离</summary>
- void MoveBy(double distance);
- /// <summary>点动/连续运动:以指定速度持续运动</summary>
- void Jog(double velocity);
- /// <summary>停止运动(以设定减速度减速停止)</summary>
- void Stop();
- // 2.3 回零操作[reference:15]
- /// <summary>执行回零操作</summary>
- /// <param name="mode">回零模式</param>
- void Home(HomeMode mode = HomeMode.Default);
- // 2.4 参数与位置设定
- /// <summary>设置当前位置(用于建立坐标系)</summary>
- void SetPosition(double position);
- /// <summary>批量设置运动参数</summary>
- void SetMotionParams(MotionParams parameters);
- // --- 3. 事件 (Events) ---
- /// <summary>轴开始运动时触发</summary>
- event EventHandler<AxisMotionEventArgs> MotionStarted;
- /// <summary>轴运动完成时触发</summary>
- event EventHandler<AxisMotionEventArgs> MotionCompleted;
- /// <summary>轴状态发生变化时触发</summary>
- event EventHandler<AxisStateChangedEventArgs> StateChanged;
- /// <summary>轴发生错误时触发</summary>
- event EventHandler<AxisErrorEventArgs> ErrorOccurred;
- }
- }
|