初版本AxisControl(Viscom风格)控件。

This commit is contained in:
QI Mingxuan
2026-04-22 20:48:00 +08:00
parent 4390ad1e9f
commit 1279885924
16 changed files with 1656 additions and 0 deletions
@@ -488,6 +488,60 @@ namespace XP.Hardware.MotionControl.Services
return result;
}
/// <summary>
/// 设置直线轴 Jog 速度 | Set linear axis jog speed
/// 根据速度百分比计算实际速度并写入 PLC | Calculates actual speed from percentage and writes to PLC
/// </summary>
public MotionResult SetJogSpeed(AxisId axisId, double speedPercent)
{
var axis = _motionSystem.GetLinearAxis(axisId);
var actualSpeed = _config.DefaultVelocity * speedPercent / 100.0;
var result = axis.SetJogSpeed(actualSpeed);
if (result.Success)
{
_logger.Debug("直线轴 {AxisId} Jog 速度已设置,百分比={SpeedPercent}%,实际速度={ActualSpeed} | Linear axis {AxisId} jog speed set, percent={SpeedPercent}%, actual={ActualSpeed}",
axisId, speedPercent, actualSpeed);
}
else
{
_logger.Warn("直线轴 {AxisId} 设置 Jog 速度被拒绝:{Reason} | Linear axis {AxisId} set jog speed rejected: {Reason}", axisId, result.ErrorMessage);
}
return result;
}
/// <summary>
/// 设置旋转轴 Jog 速度 | Set rotary axis jog speed
/// 根据速度百分比计算实际速度并写入 PLC | Calculates actual speed from percentage and writes to PLC
/// </summary>
public MotionResult SetJogRotarySpeed(RotaryAxisId axisId, double speedPercent)
{
var axis = _motionSystem.GetRotaryAxis(axisId);
// 禁用轴检查 | Disabled axis check
if (!axis.Enabled)
{
_logger.Warn("旋转轴 {AxisId} 已禁用,拒绝设置 Jog 速度命令 | Rotary axis {AxisId} is disabled, set jog speed rejected", axisId);
return MotionResult.Fail($"旋转轴 {axisId} 已禁用 | Rotary axis {axisId} is disabled");
}
var actualSpeed = _config.DefaultVelocity * speedPercent / 100.0;
var result = axis.SetJogSpeed(actualSpeed);
if (result.Success)
{
_logger.Debug("旋转轴 {AxisId} Jog 速度已设置,百分比={SpeedPercent}%,实际速度={ActualSpeed} | Rotary axis {AxisId} jog speed set, percent={SpeedPercent}%, actual={ActualSpeed}",
axisId, speedPercent, actualSpeed);
}
else
{
_logger.Warn("旋转轴 {AxisId} 设置 Jog 速度被拒绝:{Reason} | Rotary axis {AxisId} set jog speed rejected: {Reason}", axisId, result.ErrorMessage);
}
return result;
}
#endregion
#region | Safety Door Control