MoveType.cs 8.9 KB
using URSoldering.DeviceLibrary;
using URSoldering.LoadCSVLibrary;
using System; 

namespace URSoldering.DeviceLibrary
{
    public class WaitResultInfo
    {
        private WaitResultInfo()
        {
        }
        public static WaitResultInfo WaitIO(string IoType, IO_VALUE value)
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.WaitType = 1;
            wait.IoType = IoType;
            wait.IoValue = value;
            wait.IsEnd = false;
            return wait;
        }
        public static WaitResultInfo WaitTime(int MScends)
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.WaitType = 2;
            wait.TimeMSeconds = MScends;
            wait.IsEnd = false;
            return wait;
        }
        public static WaitResultInfo WaitRobotPoint(URPointValue point)
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.WaitType = 3;
            wait.UrPoint = point;
            wait.IsEnd = false;
            return wait;
        }
        public static WaitResultInfo WaitTemperature(int temper, int maxTemper, int minTemper)
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.WaitType = 4;
            wait.Temperature = temper;
            wait.TemperatureMax = maxTemper;
            wait.TemperatureMin = minTemper;
            wait.IsEnd = false;
            return wait;
        }
        public static WaitResultInfo WaitSendWire(int MScends, bool isR)
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.ShuoKeISReverse = isR;
            wait.WaitType = 5;
            wait.TimeMSeconds = MScends;
            wait.IsEnd = false;
            return wait;
        }
        public static WaitResultInfo WaitRobotRun()
        {
            WaitResultInfo wait = new WaitResultInfo();
            wait.WaitType = 6;
            wait.IsEnd = false;
            return wait;
        }

        public string ToStr()
        {
            if (WaitType == 1)
            {
                return "IO信号等待,IO类型【" + IoType + "】,等待值【" + IoValue + "】";
            }
            else if (WaitType == 2)
            {
                return "时间等待:【" + TimeMSeconds + "】毫秒";
            }
            else if (WaitType == 3)
            {
                return "等待机器人运动结束";
            }
            else if (WaitType == 4)
            {
                return "等待温度设置结束";
            }
            else if (WaitType == 5)
            {
                return "等待送丝";
            }
            else
            {
                return "Wait位置类型:WaitType=【" + WaitType + "】";
            }
        }
        /// <summary>
        /// 等待结果,1=IO运动,2=时间 ,3=机器人运动OK,4=温度设置结束,5=送丝结束,6=等待机器人连接完成。
        /// 11=等待IAI压机伺服ON,12=等待IAI伺服到待机点,13=等待IAI伺服程序运行OK,14=等待IAI压机原点返回完成
        /// </summary>
        public int WaitType { get; set; }

        /// IO类型
        /// </summary>
        public String IoType { get; set; }
        /// <summary>
        /// IO值
        /// </summary>
        public IO_VALUE IoValue { get; set; }
        /// <summary>
        /// 等待的毫秒
        /// </summary>
        public int TimeMSeconds { get; set; }
        /// <summary>
        /// 需要达到温度上限
        /// </summary>
        public int TemperatureMax { get; set; }
        /// <summary>
        /// 需要达到温度下限
        /// </summary>
        public int TemperatureMin { get; set; }
        /// <summary>
        /// 需要达到温度
        /// </summary>
        public int Temperature { get; set; }
        /// <summary>
        /// 硕科驱动器地址
        /// </summary>
        public byte SlvAddr { get; set; }

        /// <summary>
        /// 是否 是硕科反转,即报警时的倒转
        /// </summary>
        public bool ShuoKeISReverse { get; set; }
        /// <summary>
        /// 是否已经完成
        /// </summary>
        public bool IsEnd { get; set; }
        /// <summary>
        /// 机器人坐标
        /// </summary>
        public URPointValue UrPoint { get; set; }
    }
    public enum MoveType
    {
        /// <summary>
        /// 没有任何操作
        /// </summary>
        None = 0,
        /// <summary>
        /// 焊接中
        /// </summary>
        Weld = 1,
        /// <summary>
        /// 原点返回
        /// </summary>
        GoHome = 2,
        /// <summary>
        /// 流水线收到启动信号之前的转动
        /// </summary>
        LineMove = 10,
        /// <summary>
        ///焊接完成达流水线动作
        /// </summary>
        WeldEndMove=100,
    }
    public enum MoveStep
    {
        Wait = 0,
        /// <summary>
        /// 机器人走到对应的焊点,送丝下降,烙铁加温
        /// </summary>
        W01_RobotMoveToPoint = 1,

        /// <summary>
        /// 慢速送丝
        /// </summary>
        W02_SlowSendWire = 2,
        /// <summary>
        /// 送丝
        /// </summary>
        W03_SendWire = 3,

        /// <summary>
        /// 焊接加温等待
        /// </summary>
        W04_WeldWait = 4,

        /// <summary>
        /// 清洗烙铁
        /// </summary>
        W11_ToClear1 = 11,
        /// <summary>
        /// 清洗烙铁
        /// </summary>
        W12_ToClear2 = 12,
        /// <summary>
        /// 移动到待机点 
        /// </summary>
        W13_GoOrg = 13,
        /// <summary>
        /// AOI检测
        /// </summary>
        W14_AOICheck=14,
        /// <summary>
        /// 清洗完成
        /// </summary>
        W15_ClearEnd=15,
        ///// <summary>
        ///// 送丝下降
        ///// </summary>
        //W14_SendWireDown = 14,
        /// <summary>
        /// 焊点完成,需要清洗烙铁,移动到原点
        /// </summary>
        W20_MoveToClear1 = 20,
        /// <summary>
        /// 走到第二个清洗点
        /// </summary>
        W21_MoveToClear2 = 21,
        /// <summary>
        /// 移动到原点
        /// </summary>
        W22_MoveToOrg = 22,
        /// <summary>
        /// 送丝下降
        /// </summary>
        W23_SendWireDown = 23,

        Home_Reset = 100,
        /// <summary>
        /// 机器人移动到原点
        /// </summary>
        Home_1_RobotMove = 101,
         
        /// <summary>
        /// 需要清洗,开始预热,走到第一个清洗点
        /// </summary>
        Home_3_StartClear = 103,

        /// <summary>
        /// 走到第二个清洗点
        /// </summary>
        Home_4_ToClear2 = 104,

        Home_5_ToOrg = 105,
         
        /// <summary>
        /// 阻挡气缸上升
        /// </summary>
        L00_CylinderUp = 1000,
        /// <summary>
        /// 收到启动信号开始转动流水线
        /// </summary>
        L01_StartLineMove =1001,
        /// <summary>
        /// 收到焊接信号,等待3秒后停止流水线
        /// </summary>
        L02_GetWeldSingle=1002,
        /// <summary>
        /// 扫码
        /// </summary>
        L03_GetCode=1003,
        /// <summary>
        /// 开始焊接
        /// </summary>
        L04_BeginWeld=1004,


        
        /// <summary>
        /// 焊接结束处理:焊接中
        /// </summary>
        BUSY01_Weld = 1101,
        /// <summary>
        /// AOI检测
        /// </summary>
        BUSY02_AOICheck=1102,
        /// <summary>
        /// 焊接结束处理:阻挡气缸下降
        /// </summary>
        BUSY03_CylinderDown = 1103,
        /// <summary>
        /// 焊接结束处理:焊接完成,转动流水线
        /// </summary>
        BUSY04_LineMove = 1104,
        /// <summary>
        /// 焊接结束处理:收到流水线出口信号,等待5秒钟
        /// </summary>
        BUSY05_Wait = 1105,
        /// <summary>
        ///焊接结束处理: 流水线倒转,等待流水线入料口信号
        /// </summary>
        BUSY06_WaitInSingle = 1106, 
    }
    /// <summary>
    /// 焊接点的时间记录
    /// </summary>
    public class PointWeldTime
    {
        public PointWeldTime()
        {
            PreStartTime = DateTime.Now;
            PreEndTime = DateTime.Now;
            WeldStartTime = DateTime.Now;
            WeldEndTime = DateTime.Now;
        }
        /// <summary>
        /// 预热开始时间
        /// </summary>
        public DateTime PreStartTime { get; set; }
        /// <summary>
        /// 预热结束时间
        /// </summary>
        public DateTime PreEndTime { get; set; }
        /// <summary>
        /// 焊接开始时间
        /// </summary>
        public DateTime WeldStartTime { get; set; }
        /// <summary>
        /// 焊接结束时间
        /// </summary>
        public DateTime WeldEndTime { get; set; }
    }
}