Beispiel #1
0
        /// <summary>
        /// 홈센서 기준 절대 위치로 다축 이동.
        /// </summary>
        /// <param name="Para.iPhysicalNos">이동할축들 0번이 마스터</param>
        /// <param name="_dPoses">이동할 위치 펄스단위</param>
        /// <param name="_dVel">이동할 속도 펄스단위</param>
        /// <param name="_dAcc">이동할 가속 펄스단위</param>
        /// <param name="_dDec">이동할 감속 펄스단위</param>
        /// <returns>성공여부</returns>
        /// 일단 2축만 구현한다.
        /// 축번호는 오름차순으로 배열 해야함.
        public void GoMultiAbs(int [] _iPhysicalNos, double [] _dPoses, double _dVel, double _dAcc, double _dDec)
        {
            if (_iPhysicalNos.Count() > 3 || _dPoses.Count() > 3)
            {
                return;
            }
            if (_iPhysicalNos.Count() < 2 || _dPoses.Count() < 2)
            {
                return;
            }
            if (_iPhysicalNos.Count() != _dPoses.Count())
            {
                return;
            }


            short nRet;

            nRet = NMC2.nmc_SetSpeed(m_nDevId, (short)_iPhysicalNos[0], 200, _dAcc, _dDec, _dVel);
            if (_iPhysicalNos.Count() == 2)
            {
                nRet = NMC2.nmc_Interpolation2Axis(m_nDevId, (short)_iPhysicalNos[0], (double)_dPoses[0], (short)_iPhysicalNos[1], (double)_dPoses[1], 1);
            }
            if (_iPhysicalNos.Count() == 3)
            {
                nRet = NMC2.nmc_Interpolation3Axis(m_nDevId, (short)_iPhysicalNos[0], (double)_dPoses[0], (short)_iPhysicalNos[1], (double)_dPoses[1], (short)_iPhysicalNos[2], (double)_dPoses[2], 1);
            }
        }
Beispiel #2
0
        /// <summary>
        /// -방향 조그 이동
        /// </summary>
        /// <param name="_dVel">초당 구동 속도 펄스</param>
        /// <param name="_dAcc">구동 가속율 펄스</param>
        /// <param name="_dDec">감속율 펄스</param>
        public void JogN(double _dVel, double _dAcc, double _dDec)
        {
            short nRet;

            nRet = NMC2.nmc_SetSpeed(m_nDevId, (short)Para.iPhysicalNo, 200, _dAcc, _dDec, _dVel);
            nRet = NMC2.nmc_JogMove(m_nDevId, (short)Para.iPhysicalNo, 1);
        }
Beispiel #3
0
        /// <summary>
        /// 홈센서 기준 절대 위치로 이동.
        /// </summary>
        /// <param name="_dPos">이동할 위치 펄스단위</param>
        /// <param name="_dVel">이동할 속도 펄스단위</param>
        /// <param name="_dAcc">이동할 가속 펄스단위</param>
        /// <param name="_dDec">이동할 감속 펄스단위</param>
        /// <returns>성공여부</returns>
        public void GoAbs(double _dPos, double _dVel, double _dAcc, double _dDec)
        {
            short nRet;

            nRet = NMC2.nmc_SetSpeed(m_nDevId, (short)Para.iPhysicalNo, 200, _dAcc, _dDec, _dVel);
            nRet = NMC2.nmc_AbsMove(m_nDevId, (short)Para.iPhysicalNo, _dPos);
        }
Beispiel #4
0
        /// <summary>
        /// 홈을 수행한다.
        /// </summary>
        /// <returns>수행 성공여부.</returns>
        public bool GoHome(double _dHomeVelFirst, double _dHomeVelLast, double _dHomeAccFirst)
        {
            SetServo(true);

            short nRet;
            bool  bRet;

            nRet = NMC2.nmc_SetSpeed(m_nDevId, (short)Para.iPhysicalNo, 200, _dHomeAccFirst, _dHomeAccFirst, _dHomeVelFirst);
            nRet = NMC2.nmc_SetAccSpeed(m_nDevId, (short)Para.iPhysicalNo, _dHomeAccFirst);
            nRet = NMC2.nmc_SetDecSpeed(m_nDevId, (short)Para.iPhysicalNo, _dHomeAccFirst);
            nRet = NMC2.nmc_SetHomeSpeed(m_nDevId, (short)Para.iPhysicalNo, _dHomeVelFirst, _dHomeVelFirst, _dHomeVelLast);


            // 1. 0번 축의 원점 이동 모드 : +Near
            // 2. 원점 검색후(3차이동 까지 완료) CW회전으로 Z상 검출
            // 3. 지령/엔코더 위치 0으로 초기화
            // 4. Offset 300위치로 이동
            // 5. Offset이동후 지령/엔코더 위치 0으로 초기화
            //nRet = nmc_HomeMove(11, 0, 0x82 | 3, 0xF, 300);


            const short nHomeEndMode = NMC2.NMC_END_CMD_CLEAR_A_OFFSET |
                                       NMC2.NMC_END_ENC_CLEAR_A_OFFSET |
                                       NMC2.NMC_END_CMD_CLEAR_B_OFFSET |
                                       NMC2.NMC_END_ENC_CLEAR_B_OFFSET;

            //메뉴얼과 샘플이 달라서 샘플 방식으로 함...eHomeMethode 여기다 0x80을 덮어 씌워야 된다고
            //메뉴얼에 나와 있었는데 잘 모르겠음...
            nRet = NMC2.nmc_HomeMove(m_nDevId, (short)Para.iPhysicalNo, (short)Para.eHomeMode, nHomeEndMode, Para.dHomeOffset * m_dPulsePerUnit, 0);
            bRet = nRet == 0;


            return(bRet);
        }