#pragma once #include "dt.h" #include "CHardware.h" #include "JAxis.h" //#define WIN32_LEAN_AND_MEAN #ifdef C_AXIS_EXPORTS #define C_AXIS_DLL_API __declspec(dllexport) #else #define C_AXIS_DLL_API //__declspec(dllimport) #endif enum SPEED { FAST=10, //���� MEDIUM=5, //���� SLOW=2 //���� }; #define SYNC true //�ȴ���λ #define NOSYNC false //��������λ #define MOVEING 1 //#define FORCE_BUFFER_NO 6 // //#define FORCE_SPRING_BUFFER_NO 10 class C_AXIS_DLL_API CAxis { public: enum AXIS_TYPE { X = 0, Y, Z, R, FORCE }; private: AXIS_TYPE m_eAxisType = AXIS_TYPE::X; string m_strAxisType; string m_strModuleType; JAxis* m_pAxis = nullptr; string m_strAxisName = ""; INT m_iUse = 0; bool m_bIsInitSuccess = false; UINT m_iHomeTime = 100000; //����ȴ�ʱ��(��) UINT m_iFastTime = 10000; //���ٵȴ�ʱ��(��) UINT m_iMediumTime = 50000; //���ٵȴ�ʱ��(��) UINT m_iSlowTime = 100000; //���ٵȴ�ʱ��(��) UINT m_iLastWaitTime = 100000; //�ϴ��ƶ��ĵȴ�ʱ�� UINT m_iCommonWaitTime = 100000; //��������ȴ��¼� unsigned long m_lStartSysTime; //��ʼ�ƶ���ϵͳʱ�� bool m_bEnable = false; //�˿ؿ���ֹ/���� public: CAxis(); LONG Init(JAxis* pAxis, ns_db::AXIS_LIST_STRUCT *pAxisStruct); string GetAxisName() {return m_strAxisName;}; string GetModuleType() { return m_strModuleType; }; string GetStringAxisType() { return m_strAxisType; }; string GetStringModuleType() { return m_strModuleType; }; AXIS_TYPE GetAxisType() { return m_eAxisType; }; LONG GetAxisStatus(AxisStatus& axisStatus); LONG GetActualPos(double &pos); //����λ�� LONG AxisOn(); LONG AxisOff(); LONG GetProfilePos(double& dProfilePos); //ָ��λ�� LONG Sync(); LONG Stop(AxisStopMode eStopMode = AXIS_SMOOTH_STOP); LONG CheckDone(); LONG Home(bool bSync = SYNC); LONG Move_PassPosReturn(double dDist, double dPassDist, SPEED speed = FAST); LONG MoveTo_PassPosReturn(double dPos, double dPassPos, SPEED speed = FAST); LONG Move(double dDist, SPEED speed = FAST, bool bSync = SYNC); LONG MoveTo(double dPos, SPEED speed = FAST, bool bSync = SYNC); LONG MoveTo(double dPos, double speed, bool bSync = SYNC); LONG Move(double dPos, double speed, bool bSync = SYNC); LONG MoveForceCurrent(int nTorqueRatio, int nReachTime = 50, int nStopTime = 10); LONG GetProfileCurrent(double& dProfileTorque); //��ȡָ����� LONG GetActualCurrent(double& dProfileTorque); //��ȡ�������� LONG SetStopDec(double val, double val1); LONG SetBufferParamF(int nBufferNo, std::string sParamFName, double dDoubleParam); LONG GetBufferParamF(int nBufferNo, std::string sParamFName, double& dDoubleParam); LONG SetBufferParam(int nBufferNo, std::string sParamFName, int dDoubleParam); LONG GetBufferParam(int nBufferNo, std::string sParamFName, int& dDoubleParam); LONG WriteSerialValueF(std::string sSerial, double tValue); LONG WriteSerialValueN(std::string sSerial, int tValue); LONG WriteSocketValueF(std::string ascii, double tValue); LONG WriteSocketValueN(std::string ascii, int tValue); LONG WriteSocketCommand(std::string ascii); //LONG RunForcerBuffer(); //��������buffer�������жϵ���ѹ�ϵ��ض�λ�ã����ض�λ�ÿ���������ͣ���� //LONG RunSpringForcerBuffer(); //���е�������buffer��ѭ���ж϶�ε���ѹ��λ�ã�ÿ�ε�ѹ��λ��Z��ͣ���� LONG RunBuffer(int id); LONG StopBuffer(int id); };