123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using Aitex.Core.RT.Routine;
- using MECF.Framework.Common.CommonData.PUF;
- using MECF.Framework.Common.Routine;
- using CyberX8_Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CyberX8_RT.Devices.AXIS.Galil
- {
-
- public class GalilSwitchOnRoutine : RoutineBase, IRoutine
- {
- private enum SwitchOnStep
- {
- WriteTargetPosition,
- SwitchOn,
- End
- }
- #region 常量
- private const string TARGET_POSITION = "TargetPosition";
- #endregion
- #region 内部变量
- private JetAxisBase _axis;
- #endregion
- public GalilSwitchOnRoutine(string module,JetAxisBase axis) : base(module)
- {
- _axis = axis;
- }
- public void Abort()
- {
- Runner.Stop("Manual Abort");
- }
- public RState Monitor()
- {
- Runner.Run(SwitchOnStep.WriteTargetPosition, WriteTargetPosition, _delay_1ms)
- .Run(SwitchOnStep.SwitchOn, SwitchOn,CheckSwitchOn,1000)
- .End(SwitchOnStep.End, NullFun, _delay_1ms);
- return Runner.Status;
- }
- /// <summary>
- /// 上电
- /// </summary>
- /// <returns></returns>
- private bool SwitchOn()
- {
- return _axis.WriteSwitchOn();
- }
- /// <summary>
- /// 当前位置写入Target
- /// </summary>
- /// <returns></returns>
- private bool WriteTargetPosition()
- {
- int targetPosition =_axis.CalculateValueMultiplyScale(_axis.MotionData.MotorPosition);
- return _axis.WriteAbsolutePosition(targetPosition);
- }
- /// <summary>
- /// 检验上电状态
- /// </summary>
- /// <returns></returns>
- private bool CheckSwitchOn()
- {
- return _axis.IsSwitchOn;
- }
- public RState Start(params object[] objs)
- {
- return Runner.Start(Module, "Switch On");
- }
- }
- }
|