类 CiA402

java.lang.Object
com.darra.ethercat.slave.CiA402

public class CiA402 extends Object
CiA 402 驱动器协议辅助类 (完整实现) 对齐 C# CiA402Instance: 状态机管理、使能流程、操作模式切换、运动控制 合并原 CiA402Advanced 功能
  • 字段详细资料

    • OD_CONTROLWORD

      public static final short OD_CONTROLWORD
      另请参阅:
    • OD_STATUSWORD

      public static final short OD_STATUSWORD
      另请参阅:
    • OD_MODES_OF_OPERATION

      public static final short OD_MODES_OF_OPERATION
      另请参阅:
    • OD_MODES_OF_OPERATION_DISPLAY

      public static final short OD_MODES_OF_OPERATION_DISPLAY
      另请参阅:
    • OD_TARGET_POSITION

      public static final short OD_TARGET_POSITION
      另请参阅:
    • OD_POSITION_ACTUAL

      public static final short OD_POSITION_ACTUAL
      另请参阅:
    • OD_TARGET_VELOCITY

      public static final short OD_TARGET_VELOCITY
      另请参阅:
    • OD_VELOCITY_ACTUAL

      public static final short OD_VELOCITY_ACTUAL
      另请参阅:
    • OD_TARGET_TORQUE

      public static final short OD_TARGET_TORQUE
      另请参阅:
    • OD_TORQUE_ACTUAL

      public static final short OD_TORQUE_ACTUAL
      另请参阅:
    • OD_PROFILE_VELOCITY

      public static final short OD_PROFILE_VELOCITY
      另请参阅:
    • OD_PROFILE_ACCELERATION

      public static final short OD_PROFILE_ACCELERATION
      另请参阅:
    • OD_PROFILE_DECELERATION

      public static final short OD_PROFILE_DECELERATION
      另请参阅:
    • OD_QUICK_STOP_DECELERATION

      public static final short OD_QUICK_STOP_DECELERATION
      另请参阅:
    • OD_HOMING_METHOD

      public static final short OD_HOMING_METHOD
      另请参阅:
    • OD_HOMING_SPEEDS

      public static final short OD_HOMING_SPEEDS
      另请参阅:
    • OD_HOME_OFFSET

      public static final short OD_HOME_OFFSET
      另请参阅:
    • OD_TOUCH_PROBE_FUNCTION

      public static final short OD_TOUCH_PROBE_FUNCTION
      另请参阅:
    • OD_TOUCH_PROBE_STATUS

      public static final short OD_TOUCH_PROBE_STATUS
      另请参阅:
    • OD_TOUCH_PROBE_POS_EDGE

      public static final short OD_TOUCH_PROBE_POS_EDGE
      另请参阅:
    • OD_TOUCH_PROBE_NEG_EDGE

      public static final short OD_TOUCH_PROBE_NEG_EDGE
      另请参阅:
    • OD_HOMING_ACCELERATION

      public static final short OD_HOMING_ACCELERATION
      另请参阅:
    • OD_TORQUE_OFFSET

      public static final short OD_TORQUE_OFFSET
      另请参阅:
    • OD_SOFTWARE_POSITION_LIMIT

      public static final short OD_SOFTWARE_POSITION_LIMIT
      另请参阅:
    • OD_POLARITY

      public static final short OD_POLARITY
      另请参阅:
    • OD_MOTION_PROFILE_TYPE

      public static final short OD_MOTION_PROFILE_TYPE
      另请参阅:
    • OD_MAX_PROFILE_VELOCITY

      public static final short OD_MAX_PROFILE_VELOCITY
      另请参阅:
    • OD_DIGITAL_INPUTS

      public static final short OD_DIGITAL_INPUTS
      另请参阅:
    • OD_DIGITAL_OUTPUTS

      public static final short OD_DIGITAL_OUTPUTS
      另请参阅:
    • OD_SUPPORTED_DRIVE_MODES

      public static final short OD_SUPPORTED_DRIVE_MODES
      另请参阅:
    • OD_MAX_TORQUE

      public static final short OD_MAX_TORQUE
      另请参阅:
    • OD_MOTOR_RATED_TORQUE

      public static final short OD_MOTOR_RATED_TORQUE
      另请参阅:
    • OD_POSITION_OFFSET

      public static final short OD_POSITION_OFFSET
      另请参阅:
    • OD_VELOCITY_OFFSET

      public static final short OD_VELOCITY_OFFSET
      另请参阅:
    • OD_INTERPOLATION_TIME_PERIOD

      public static final short OD_INTERPOLATION_TIME_PERIOD
      另请参阅:
    • OD_QUICK_STOP_OPTION_CODE

      public static final short OD_QUICK_STOP_OPTION_CODE
      另请参阅:
    • OD_POSITIVE_TORQUE_LIMIT

      public static final short OD_POSITIVE_TORQUE_LIMIT
      另请参阅:
    • OD_NEGATIVE_TORQUE_LIMIT

      public static final short OD_NEGATIVE_TORQUE_LIMIT
      另请参阅:
    • OD_SUPPORTED_HOMING_METHODS

      public static final short OD_SUPPORTED_HOMING_METHODS
      另请参阅:
    • OD_TXPDO_DATA_INVALID

      public static final short OD_TXPDO_DATA_INVALID
      另请参阅:
    • OD_SYNCHRONIZATION_SETTINGS

      public static final short OD_SYNCHRONIZATION_SETTINGS
      另请参阅:
    • OD_DRIVE_SYNC_STATUS

      public static final short OD_DRIVE_SYNC_STATUS
      另请参阅:
    • OD_ERROR_CODE

      public static final short OD_ERROR_CODE
      另请参阅:
    • OD_DRIVE_DATA

      public static final short OD_DRIVE_DATA
      厂商特定驱动数据 (0x6510, RECORD, 只读; round33CC 补)
      另请参阅:
    • CW_SHUTDOWN

      public static final short CW_SHUTDOWN
      另请参阅:
    • CW_SWITCH_ON

      public static final short CW_SWITCH_ON
      另请参阅:
    • CW_ENABLE_OPERATION

      public static final short CW_ENABLE_OPERATION
      另请参阅:
    • CW_DISABLE_VOLTAGE

      public static final short CW_DISABLE_VOLTAGE
      另请参阅:
    • CW_QUICK_STOP

      public static final short CW_QUICK_STOP
      另请参阅:
    • CW_FAULT_RESET

      public static final short CW_FAULT_RESET
      另请参阅:
    • SW_FAULT

      public static final short SW_FAULT
      另请参阅:
    • SW_QUICK_STOP

      public static final short SW_QUICK_STOP
      另请参阅:
    • SW_WARNING

      public static final short SW_WARNING
      另请参阅:
    • SW_REMOTE

      public static final short SW_REMOTE
      另请参阅:
    • SW_TARGET_REACHED

      public static final short SW_TARGET_REACHED
      另请参阅:
    • SW_INTERNAL_LIMIT

      public static final short SW_INTERNAL_LIMIT
      另请参阅:
    • SW_OP_MODE_SPECIFIC_1

      public static final short SW_OP_MODE_SPECIFIC_1
      另请参阅:
    • SW_OP_MODE_SPECIFIC_2

      public static final short SW_OP_MODE_SPECIFIC_2
      另请参阅:
  • 构造器详细资料

    • CiA402

      public CiA402(Slave slave)
  • 方法详细资料

    • Statusword

      public short Statusword()
      读取状态字
    • Controlword

      public short Controlword()
      读取/写入控制字
    • Controlword

      public void Controlword(short value)
    • StateDrive

      public CiA402.StateCiA402 StateDrive()
      解析当前驱动器状态
    • TargetReached

      public boolean TargetReached()
      目标已到达
    • HasFault

      public boolean HasFault()
      是否有故障
    • HasWarning

      public boolean HasWarning()
      是否有警告
    • IsRemote

      public boolean IsRemote()
      远程模式 (Bit 9, 对齐 C# IsRemote)
    • OperationMode

      public CiA402.ModeCiA402 OperationMode()
    • OperationMode

      public void OperationMode(CiA402.ModeCiA402 mode)
    • Enable

      public boolean Enable(int maxRetries)
      使能驱动器: 状态机推进逻辑由 native DLL (CiA402_Enable) 承载, 内部按 CiA 402-2 完成 SwitchOnDisabled→ReadyToSwitchOn→SwitchedOn→OperationEnabled 全套时序、Fault 复位、QuickStop 恢复 (含 0x605A 选项码判断), 不在 Java 层暴露状态机 IP.
      参数:
      maxRetries - 最大重试次数 (默认 10)
      返回:
      true = 已使能到 OperationEnabled, false = 失败/超时
    • Enable

      public boolean Enable()
      使能驱动器 (默认重试 10 次)
    • DisableOperation

      public void DisableOperation()
      禁用运行
    • Disable

      public void Disable()
      禁用伺服
    • QuickStop

      public void QuickStop()
      快速停止
    • FaultReset

      public void FaultReset()
      清除故障 (发送 Fault Reset 上升沿) 按 ETG.6010 §5.2 要求,Bit7 必须产生 0→1 上升沿才能触发故障复位。 先清除 Bit7 确保低电平,再置位 Bit7 产生上升沿。 警告: PDO 回调中不应调用此方法,Sleep 会阻塞实时线程。 PDO 场景请分两个周期调用: 第一个周期写 0x00,第二个周期写 CW_FAULT_RESET (0x80)。
    • PositionActual

      public int PositionActual()
      实际位置
    • VelocityActual

      public int VelocityActual()
      实际速度
    • TorqueActual

      public short TorqueActual()
      实际转矩
    • TargetPosition

      public int TargetPosition()
      目标位置 - 读取
    • TargetPosition

      public void TargetPosition(int value)
      目标位置 - 写入
    • TargetVelocity

      public int TargetVelocity()
      目标速度 - 读取
    • TargetVelocity

      public void TargetVelocity(int value)
      目标速度 - 写入
    • TargetTorque

      public short TargetTorque()
      目标转矩 - 读取
    • TargetTorque

      public void TargetTorque(short value)
      目标转矩 - 写入
    • ProfileVelocity

      public long ProfileVelocity()
    • ProfileVelocity

      public void ProfileVelocity(long value)
    • ProfileAcceleration

      public long ProfileAcceleration()
    • ProfileAcceleration

      public void ProfileAcceleration(long value)
    • ProfileDeceleration

      public long ProfileDeceleration()
    • ProfileDeceleration

      public void ProfileDeceleration(long value)
    • QuickStopDeceleration

      public long QuickStopDeceleration()
    • QuickStopDeceleration

      public void QuickStopDeceleration(long value)
    • ConfigureTouchProbe

      public void ConfigureTouchProbe(short function)
      配置 Touch Probe 功能 (0x60B8)
      参数:
      function - Touch Probe 功能控制字
    • TouchProbeStatus

      public short TouchProbeStatus()
      Touch Probe 状态 (0x60B9)
    • TouchProbePositiveEdge

      public int TouchProbePositiveEdge()
      Touch Probe 1 正边沿捕获位置 (0x60BA)
    • TouchProbeNegativeEdge

      public int TouchProbeNegativeEdge()
      Touch Probe 1 负边沿捕获位置 (0x60BB)
    • DigitalInputs

      public int DigitalInputs()
      数字输入状态 (0x60FD, 只读)
    • DigitalOutputs

      public int DigitalOutputs()
      数字输出控制 - 读取 (0x60FE:01)
    • DigitalOutputs

      public void DigitalOutputs(int value)
      数字输出控制 - 写入 (0x60FE:01)
    • HomingMethod

      public byte HomingMethod()
    • HomingMethod

      public void HomingMethod(byte value)
    • HomeOffset

      public int HomeOffset()
    • HomeOffset

      public void HomeOffset(int value)
    • HomingSpeedSearch

      public long HomingSpeedSearch()
      回零搜索速度 (0x6099:01, 快速接近开关, 对齐 C# HomingSpeedSearch)
    • HomingSpeedSearch

      public void HomingSpeedSearch(long value)
    • HomingSpeedZero

      public long HomingSpeedZero()
      回零零脉冲速度 (0x6099:02, 精确定位零脉冲, 对齐 C# HomingSpeedZero)
    • HomingSpeedZero

      public void HomingSpeedZero(long value)
    • HomingAcceleration

      public long HomingAcceleration()
      回零加速度 (0x609A, 对齐 C# HomingAcceleration)
    • HomingAcceleration

      public void HomingAcceleration(long value)
    • Polarity

      public byte Polarity()
      极性设置 (0x607E, Bit6=速度反向, Bit7=位置反向)
    • Polarity

      public void Polarity(byte value)
    • MotionProfileType

      public short MotionProfileType()
      运动轮廓类型 (0x6086, 0=线性斜坡, 1=正弦, 2=S曲线)
    • MotionProfileType

      public void MotionProfileType(short value)
    • SoftwarePositionLimitMin

      public int SoftwarePositionLimitMin()
      软件位置最小限制 (0x607D:01, 对齐 C# SoftwarePositionLimitMin)
    • SoftwarePositionLimitMin

      public void SoftwarePositionLimitMin(int value)
    • SoftwarePositionLimitMax

      public int SoftwarePositionLimitMax()
      软件位置最大限制 (0x607D:02, 对齐 C# SoftwarePositionLimitMax)
    • SoftwarePositionLimitMax

      public void SoftwarePositionLimitMax(int value)
    • MaxTorque

      public int MaxTorque()
      最大转矩 (0x6072, 千分之额定转矩) - 读取
    • MaxTorque

      public void MaxTorque(int value)
      最大转矩 - 写入
    • MotorRatedTorque

      public long MotorRatedTorque()
      电机额定转矩 (0x6076, 单位 mNm) - 读取
    • MotorRatedTorque

      public void MotorRatedTorque(long value)
      电机额定转矩 - 写入
    • PositionOffset

      public int PositionOffset()
      位置偏移 (0x60B0, CSP 模式下叠加到目标位置) - 读取
    • PositionOffset

      public void PositionOffset(int value)
      位置偏移 - 写入
    • VelocityOffset

      public int VelocityOffset()
      速度偏移 (0x60B1, CSV 模式下叠加到目标速度) - 读取
    • VelocityOffset

      public void VelocityOffset(int value)
      速度偏移 - 写入
    • TorqueOffset

      public short TorqueOffset()
      转矩偏移 (0x60B2, CST 模式下叠加到目标转矩) - 读取
    • TorqueOffset

      public void TorqueOffset(short value)
      转矩偏移 - 写入
    • InterpolationTimePeriodValue

      public byte InterpolationTimePeriodValue()
      插补时间周期值 (0x60C2:01) - 读取
    • InterpolationTimePeriodValue

      public void InterpolationTimePeriodValue(byte value)
      插补时间周期值 - 写入
    • InterpolationTimePeriodIndex

      public byte InterpolationTimePeriodIndex()
      插补时间周期指数 (0x60C2:02, 实际周期 = Value * 10^Index 秒) - 读取
    • InterpolationTimePeriodIndex

      public void InterpolationTimePeriodIndex(byte value)
      插补时间周期指数 - 写入
    • QuickStopOptionCode

      public short QuickStopOptionCode()
      快速停止选项码 (0x605A, 决定快速停止后的行为) - 读取
    • QuickStopOptionCode

      public void QuickStopOptionCode(short value)
      快速停止选项码 - 写入
    • PositiveTorqueLimit

      public int PositiveTorqueLimit()
      正方向力矩限制 (0x60E0, 千分之额定转矩) - 读取
    • PositiveTorqueLimit

      public void PositiveTorqueLimit(int value)
      正方向力矩限制 - 写入
    • NegativeTorqueLimit

      public int NegativeTorqueLimit()
      负方向力矩限制 (0x60E1, 千分之额定转矩) - 读取
    • NegativeTorqueLimit

      public void NegativeTorqueLimit(int value)
      负方向力矩限制 - 写入
    • SupportedHomingMethods

      public byte[] SupportedHomingMethods()
      支持的回零方法列表 (0x60E3, 子索引0=数量, 子索引1..N=方法编号)
      返回:
      驱动器支持的回零方法编号数组
    • TxPdoDataInvalid

      public boolean TxPdoDataInvalid()
      TxPDO 数据是否无效 (0x603E:00, 非零表示数据无效) 用于判断驱动器 TxPDO 数据是否可信
    • SynchronizationSettings

      public int SynchronizationSettings()
      同步设置 (0x60D9:01, 同步使能位掩码) - 读取
    • SynchronizationSettings

      public void SynchronizationSettings(int value)
      同步设置 - 写入
    • DriveSyncStatus

      public int DriveSyncStatus()
      驱动同步状态 (0x60DA:00, 只读, 指示驱动器是否已同步到主站时钟)
    • InitializePdoOffsets

      public void InitializePdoOffsets()
      初始化 PDO 偏移缓存 (对齐 C# InitializePdoOffsets) 通过读取 0x1C12/0x1C13 的 PDO 映射配置计算各对象的字节偏移
    • ResetPdoOffsets

      public void ResetPdoOffsets()
      重置 PDO 偏移缓存 (对齐 C# ResetPdoOffsets) 状态降级时调用, 下次进入 SafeOp+ 会重新初始化
    • PdoInitialized

      public boolean PdoInitialized()
      PDO 偏移是否已初始化
    • ReadAttribute

      public Number ReadAttribute(short index, byte subindex, String dtype)
      通过 OD 属性读取值 (对齐 C# ReadAttribute)
      参数:
      index - 对象字典索引
      subindex - 子索引
      dtype - 数据类型 ("i16", "i32", "u16", "u32", "u8", "i8")
      返回:
      读取到的数值, 失败返回 null
    • ReadAttribute

      public Number ReadAttribute(short index, String dtype)
      ReadAttribute 子索引 0 的简化版
    • LastReadStatus

      public CiA402.CiA402ReadStatus LastReadStatus()
      round33CC: 最近一次 SDO 只读尝试的状态 (成功 / 不支持 / 失败 / 未尝试)。
    • LastReadAbortCode

      public long LastReadAbortCode()
      round33CC: 最近一次 SDO 只读失败/不支持时的 Abort Code (0 = 无 abort / 成功)。
    • LastReadIndex

      public short LastReadIndex()
      round33CC: 最近一次 SDO 只读尝试的对象索引 (诊断定位用)。
    • LastReadSubIndex

      public byte LastReadSubIndex()
      round33CC: 最近一次 SDO 只读尝试的子索引 (诊断定位用)。
    • tryReadObjectU32

      public CiA402.CiA402ReadResult<Long> tryReadObjectU32(short index, byte subindex)
      round33CC: 通用可观测只读 (UInt32) —— 对任意 CiA402 对象做一次 SDO 只读尝试, 返回带状态的结果 (Success=真值 / NotSupported=从站不支持 / ReadFailed=通讯失败)。 GUI 据 result.status 区分"真值 0"与"读失败被吞的 0"。
    • tryReadOperationModeDisplay

      public CiA402.CiA402ReadResult<CiA402.ModeCiA402> tryReadOperationModeDisplay()
      round33CC: 可观测读取操作模式显示 (0x6061, 强制走 SDO 以区分真值/不支持/失败)。实时高频读请用 OperationMode() (PDO 优先)。
    • tryReadSupportedDriveModes

      public CiA402.CiA402ReadResult<Long> tryReadSupportedDriveModes()
      round33CC: 可观测读取支持的驱动模式位掩码 (0x6502, ETG.6010 mandatory)。恒0时据 status 即可判明真返0还是读失败/不支持被吞。
    • tryReadErrorCode

      public CiA402.CiA402ReadResult<Integer> tryReadErrorCode()
      round33CC: 可观测读取当前错误代码 (0x603F, 只读)。
    • tryReadDigitalInputs

      public CiA402.CiA402ReadResult<Long> tryReadDigitalInputs()
      round33CC: 可观测读取数字输入 (0x60FD, 只读)。
    • tryReadTorqueActual

      public CiA402.CiA402ReadResult<Short> tryReadTorqueActual()
      round33CC: 可观测读取实际转矩 (0x6077, 千分之额定转矩, 只读)。
    • tryReadStatusword

      public CiA402.CiA402ReadResult<Integer> tryReadStatusword()
      round33CC: 可观测读取状态字 (0x6041, 只读, SDO 路径)。实时高频读请用 Statusword() (PDO 优先)。
    • tryReadDriveData

      public CiA402.CiA402ReadResult<Long> tryReadDriveData(byte subindex)
      round33CC: 厂商特定驱动数据 (0x6510, 只读)。子索引由从站 ESI 定义, 这里提供按子索引的可观测读取 (UInt32)。只补只读 getter, 绝不写。
    • SupportedDriveModesReadable

      public boolean SupportedDriveModesReadable()
      round33CC: 从站是否真支持 0x6502 (Supported Drive Modes) 对象 —— 据只读尝试结果判断。 true=读成功; false=不支持或读失败 (用 LastReadStatus() 进一步区分原因)。
    • NewSetpoint

      public void NewSetpoint(int position, boolean relative)
      PP 模式: 发送新定位命令
    • ClearNewSetpoint

      public void ClearNewSetpoint()
      PP 模式: 清除 NewSetpoint 标志
    • StartHoming

      public void StartHoming()
      HM 模式: 启动回零
    • HomingAttained

      public boolean HomingAttained()
      回零完成 (Bit 12)
    • HomingError

      public boolean HomingError()
      回零错误 (Bit 13)
    • SupportedDriveModes

      public long SupportedDriveModes()
      支持的驱动模式位掩码
    • IsModeSupported

      public boolean IsModeSupported(CiA402.ModeCiA402 mode)
      检查是否支持指定模式
    • ParseState

      public static CiA402.StateCiA402 ParseState(short statusword)
      从状态字解析驱动器状态
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object