Exemplo n.º 1
0
 public void MoveAxis(AxisNum CurAxis, AxisRunDir Dir)
 {
     if (m_IsConnected)
     {
         m_MotionControler.MoveMotion(CurAxis, Dir);
     }
 }
Exemplo n.º 2
0
 public void ResetError(AxisNum Axis)
 {
     if (m_IsConnected)
     {
         m_MotionControler.ResetErr(Axis);
     }
 }
Exemplo n.º 3
0
 public void SetSpeed(AxisNum axis, double AxVelLow, double AxVelHigh, double AxAcc, double AxDec)
 {
     if (m_IsConnected)
     {
         m_MotionControler.SetMotionAxisSpeedParam(axis, AxVelLow, AxVelHigh, AxAcc, AxDec);
     }
 }
Exemplo n.º 4
0
        public InputControl(string name, string descName, string descNegName,
                            string negButton, string posButton, string altNegButton,
                            string altPosButton, float grav, float dead,
                            float sensitivity, bool snap, bool invert,
                            AxisType type, AxisNum axisNum, JoyNum joyNum)
        {
            Name                    = name;
            DescriptiveName         = descName;
            DescriptiveNegativeName = descNegName;
            NegativeButton          = negButton;
            PositiveButton          = posButton;
            AltNegativeButton       = altNegButton;
            AltPositiveButton       = altPosButton;

            Gravity     = grav;
            Dead        = dead;
            Sensitivity = sensitivity;

            Snap   = snap;
            Invert = invert;

            Type = type;

            AxisNum = axisNum;
            JoyNum  = joyNum;
        }
Exemplo n.º 5
0
 //让轴回原点要通过GetAxisCurState()来判断是否回归到原点
 public void GoHome(AxisNum Axis, AxisRunDir Dir)
 {
     if (m_IsConnected)
     {
         m_MotionControler.GoHome(Axis, Dir);
     }
 }
Exemplo n.º 6
0
        public AxisCurState GetAxisCurState(AxisNum Axis)
        {
            AxisCurState CurState = AxisCurState.AxisState_Wrong;
            ushort       State    = (ushort)AxisState.STA_AX_DISABLE;

            Motion.mAcm_AxGetState(m_AxisHandle[(int)Axis], ref State);
            switch ((AxisState)State)
            {
            case AxisState.STA_AX_READY:
                CurState = AxisCurState.AxisState_Ready;
                break;

            case AxisState.STA_AX_ERROR_STOP:
                CurState = AxisCurState.AxisState_ErrorStop;
                break;

            case AxisState.STA_AX_BUSY:
                CurState = AxisCurState.AxisState_Busy;
                break;

            default:
                break;
            }

            return(CurState);
        }
Exemplo n.º 7
0
        public byte GetMotionIo(AxisNum axis, ushort DiChannel)
        {
            byte IOStatus = 0;

            Motion.mAcm_AxDiGetBit(m_AxisHandle[(int)axis], DiChannel, ref IOStatus);

            return(IOStatus);
        }
Exemplo n.º 8
0
        public void GetAxisAndChannelByRobotIn(Robot_In Io, ref AxisNum Axis, ref ushort Channel)
        {
            switch (Io)
            {
            case Robot_In.IO_IN_AirCylGoArrive:
            {
                Axis    = AxisNum.Axis_X;        //使用IO卡的 X_IN1
                Channel = 1;
            }
            break;

            case Robot_In.IO_IN_AirCylBackArrive:
            {
                Axis    = AxisNum.Axis_X;        //使用IO卡的 X_IN4
                Channel = 4;
            }
            break;

            case Robot_In.IO_IN_GraspDeviceNozzleCheck:
            {
                Axis    = AxisNum.Axis_X;        //使用IO卡的 X_IN5
                Channel = 5;
            }
            break;

            case Robot_In.IO_IN_GraspSalverNozzleCheck1:
            {
                Axis    = AxisNum.Axis_Y;        //使用IO卡的 Y_IN1
                Channel = 1;
            }
            break;

            case Robot_In.IO_IN_GraspSalverNozzleCheck2:
            {
                Axis    = AxisNum.Axis_Y;        //使用IO卡的 Y_IN4
                Channel = 4;
            }
            break;

            case Robot_In.IO_IN_GraspSalverNozzleCheck3:
            {
                Axis    = AxisNum.Axis_Y;        //使用IO卡的 Y_IN5
                Channel = 5;
            }
            break;

            case Robot_In.IO_IN_GraspSalverNozzleCheck4:
            {
                Axis    = AxisNum.Axis_Z;        //使用IO卡的 Z_IN1
                Channel = 1;
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 9
0
 public void SetRobotIo(Robot_Out Io, IOValue Value)
 {
     if (m_IsConnected)
     {
         AxisNum axis    = 0;
         ushort  channel = 0;
         GetAxisAndChannelByRobotOut(Io, ref axis, ref channel);
         m_MotionControler.SetMotionIo(axis, channel, (byte)Value);
     }
 }
Exemplo n.º 10
0
        public AxisCurState GetAxisCurState(AxisNum Axis)
        {
            AxisCurState CurState = AxisCurState.AxisState_Wrong;

            if (m_IsConnected)
            {
                CurState = m_MotionControler.GetAxisCurState(Axis);
            }

            return(CurState);
        }
Exemplo n.º 11
0
        public IOValue GetRobotIo(Robot_In Io)
        {
            IOValue Value = IOValue.IOValueLow;

            if (m_IsConnected)
            {
                AxisNum axis    = 0;
                ushort  channel = 0;
                GetAxisAndChannelByRobotIn(Io, ref axis, ref channel);
                Value = (IOValue)m_MotionControler.GetMotionIo(axis, channel);
            }

            return(Value);
        }
Exemplo n.º 12
0
        public void GetAxisAndChannelByRobotOut(Robot_Out Io, ref AxisNum Axis, ref ushort Channel)
        {
            switch (Io)
            {
            case Robot_Out.IO_OUT_AirCyl:
            {
                Axis    = AxisNum.Axis_X;        //使用IO卡的 X_OUT4
                Channel = 4;
            }
            break;

            case Robot_Out.IO_OUT_GraspDeviceNozzle:
            {
                Axis    = AxisNum.Axis_X;        //使用IO卡的 X_OUT5
                Channel = 5;
            }
            break;

            case Robot_Out.IO_OUT_GraspSalverNozzle1:
            {
                Axis    = AxisNum.Axis_Y;        //使用IO卡的 Y_OUT4
                Channel = 4;
            }
            break;

            case Robot_Out.IO_OUT_GraspSalverNozzle2:
            {
                Axis    = AxisNum.Axis_Y;        //使用IO卡的 Y_OUT5
                Channel = 5;
            }
            break;

            case Robot_Out.IO_OUT_GraspSalverNozzle3:
            {
                Axis    = AxisNum.Axis_Z;        //使用IO卡的 Z_OUT4
                Channel = 4;
            }
            break;

            case Robot_Out.IO_OUT_GraspSalverNozzle4:
            {
                Axis    = AxisNum.Axis_Z;        //使用IO卡的 Z_OUT5
                Channel = 5;
            }
            break;

            default:
                break;
            }
        }
Exemplo n.º 13
0
 /// <summary>Служит хэш-функцией по умолчанию.</summary>
 /// <returns>Хэш-код для текущего объекта.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (AxisNum != null ? AxisNum.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ AxisStinginess;
         hashCode = (hashCode * 397) ^ (SuspentionType != null ? SuspentionType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Distance2NextAxis;
         hashCode = (hashCode * 397) ^ MeasuredAsisWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ LegalAxisWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ SpecialAllow.GetHashCode();
         hashCode = (hashCode * 397) ^ UsedAxisAllow.GetHashCode();
         hashCode = (hashCode * 397) ^ WeightRecordedExcess.GetHashCode();
         hashCode = (hashCode * 397) ^ PercentRecordedExcess.GetHashCode();
         hashCode = (hashCode * 397) ^ (Overweight != null ? Overweight.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 14
0
        public void ResetErr(AxisNum CurAxis)
        {
            if (!m_InitBoard || CurAxis < AxisNum.Axis_X || CurAxis > AxisNum.Axis_Total)
            {
                return;
            }

            //Reset the axis' state. If the axis is in ErrorStop state, the state will
            //be changed to Ready after calling this function.
            UInt32 Result = Motion.mAcm_AxResetError(m_AxisHandle[(int)CurAxis]);

            if (Result != (uint)ErrorCode.SUCCESS)
            {
                string strTemp = "Reset axis's error failed With Error Code: [0x" + Convert.ToString(Result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }
        }
Exemplo n.º 15
0
        //移动机械臂  axis是轴的编号, PositiveDirection ,true为正方向,false反方向
        public void MoveMotion(AxisNum CurAxis, AxisRunDir Dir)
        {
            if (!m_InitBoard || CurAxis < AxisNum.Axis_X || CurAxis > AxisNum.Axis_Total)
            {
                return;
            }

            ResetErr(CurAxis);

            double Distance = m_Distance;

            if (Dir == AxisRunDir.Dir_Reverse)
            {
                Distance = -Distance;
            }

            uint result = Motion.mAcm_AxMoveRel(m_AxisHandle[(int)CurAxis], Distance);

            if (result != (uint)ErrorCode.SUCCESS)
            {
                string strTemp = "PTP Move Failed With Error Code: [0x" + Convert.ToString(result, 16) + "]";
                MessageBox.Show(strTemp);
            }
        }
Exemplo n.º 16
0
        //XY   DirMode 0, 1代表正反防线由实际轴决定
        public void GoHome(AxisNum Axis, AxisRunDir DirMode)
        {
            string strTemp;
            uint   result;
            uint   propertyVal   = m_HomeMode;
            double crossDistance = (double)m_Distance;

            //Setting the stopping condition of Acm_AxHomeEx
            //You can also use the old API: Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxHomeExSwitchMode, ref PropertyVal, (uint)Marshal.SizeOf(typeof(UInt32)));
            result = Motion.mAcm_SetU32Property(m_AxisHandle[(int)Axis], (uint)PropertyID.PAR_AxHomeExSwitchMode, propertyVal);
            if (result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set Property-PAR_AxHomeExSwitchMode Failed With Error Code: [0x" + Convert.ToString(result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            //Set the home cross distance (Unit: PPU). This property must be greater than 0. The default value is 10000
            //You can also use the old API: Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxHomeCrossDistance, ref CrossDistance, (uint)Marshal.SizeOf(typeof(double)));
            result = Motion.mAcm_SetF64Property(m_AxisHandle[(int)Axis], (uint)PropertyID.PAR_AxHomeCrossDistance, crossDistance);
            if (result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set Property-AxHomeCrossDistance Failed With Error Code: [0x" + Convert.ToString(result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            //To command axis to start typical home motion. The 15 types of typical
            //home motion are composed of extended home
            result = Motion.mAcm_AxHome(m_AxisHandle[(int)Axis], m_HomeMode, (uint)DirMode);
            if (result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "AxHome Failed With Error Code: [0x" + Convert.ToString(result, 16) + "]";
                MessageBox.Show(strTemp);
            }
        }
Exemplo n.º 17
0
 public void SetMotionIo(AxisNum axis, ushort DiChannel, byte value)
 {
     Motion.mAcm_AxDoSetBit(m_AxisHandle[(int)axis], DiChannel, value);
 }
Exemplo n.º 18
0
        public void SetMotionAxisSpeedParam(AxisNum axis, double AxVelLow, double AxVelHigh, double AxAcc, double AxDec)
        {
            if (!m_InitBoard || axis < AxisNum.Axis_Total || axis > AxisNum.Axis_Total)
            {
                return;
            }

            string strTemp;

            //Set low velocity (start velocity) of this axis (Unit: PPU/S).
            //This property value must be smaller than or equal to PAR_AxVelHigh
            //You can also use the old API:Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxVelLow, ref AxVelLow, BufferLength);
            // UInt32  BufferLength;
            //BufferLength =8; buffer size for the property
            UInt32 Result = Motion.mAcm_SetF64Property(m_AxisHandle[(int)axis], (uint)PropertyID.PAR_AxVelLow, AxVelLow);

            if (Result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set low velocity failed with error code: [0x" + Convert.ToString(Result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            // Set high velocity (driving velocity) of this axis (Unit: PPU/s).
            //This property value must be smaller than CFG_AxMaxVel and greater than PAR_AxVelLow
            //You can also use the old API:Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxVelHigh,ref AxVelHigh,BufferLength)
            // UInt32  BufferLength;
            //BufferLength =8; buffer size for the property
            Result = Motion.mAcm_SetF64Property(m_AxisHandle[(int)axis], (uint)PropertyID.PAR_AxVelHigh, AxVelHigh);
            if (Result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set high velocity failed with error code: [0x" + Convert.ToString(Result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            // Set acceleration of this axis (Unit: PPU/s2).
            //This property value must be smaller than or equal to CFG_AxMaxAcc
            //You can also use the old API:Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxAcc,ref AxAcc,BufferLength)
            // UInt32  BufferLength;
            //BufferLength =8; buffer size for the property
            Result = Motion.mAcm_SetF64Property(m_AxisHandle[(int)axis], (uint)PropertyID.PAR_AxAcc, AxAcc);
            if (Result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set acceleration failed with error code: [0x" + Convert.ToString(Result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            //Set deceleration of this axis (Unit: PPU/s2).
            //This property value must be smaller than or equal to CFG_AxMaxDec
            //You can also use the old API:Motion.mAcm_SetProperty(m_AxisHandle[CmbAxes.SelectedIndex], (uint)PropertyID.PAR_AxDcc,ref AxDec,BufferLength)
            // UInt32  BufferLength;
            //BufferLength =8; buffer size for the property
            Result = Motion.mAcm_SetF64Property(m_AxisHandle[(int)axis], (uint)PropertyID.PAR_AxDec, AxDec);
            if (Result != (uint)ErrorCode.SUCCESS)
            {
                strTemp = "Set deceleration failed with error code: [0x" + Convert.ToString(Result, 16) + "]";
                MessageBox.Show(strTemp);
                return;
            }

            //GetAxisVelParam();
        }