#pragma once #ifdef CARD_DLL_API #else #define CARD_DLL_API _declspec(dllimport) #endif class CARD_DLL_API MotorAttr { public: MotorAttr(int axisId, double curPos, bool isEnable, double acc, double dec, double vel, double returnAcc, double returnDec, double returnHomeStartVel, double returnHomeEndVel, double positiveLimit, double negativeLimit, bool isHomed, int findOriginDir, double originOffset, int returnHomeMode, bool isReverse); MotorAttr(); ~MotorAttr(); int AxisId() const { return m_AxisId; } void AxisId(int val) { m_AxisId = val; } double CurPos() const { return m_curPos; } void CurPos(double val) { m_curPos = val; } bool Enable() const { return m_isEnable; } void Enable(bool val) { m_isEnable = val; } double Acc() const { return m_acc; } void Acc(double val) { m_acc = val; } double Dec() const { return m_dec; } void Dec(double val) { m_dec = val; } double Vel() const { return m_vel; } void Vel(double val) { m_vel = val; } double ReturnHomeStartVel() const { return m_returnHomeStartVel; } void ReturnHomeStartVel(double val) { m_returnHomeStartVel = val; } double ReturnHomeEndVel() const { return m_returnHomeEndVel; } void ReturnHomeEndVel(double val) { m_returnHomeEndVel = val; } double PositiveLimit() const { return m_PositiveLimit; } void PositiveLimit(double val) { m_PositiveLimit = val; } double NegativeLimit() const { return m_NegativeLimit; } void NegativeLimit(double val) { m_NegativeLimit = val; } bool IsHomed() const { return m_IsHomed; } void IsHomed(bool val) { m_IsHomed = val; } int FindOriginDir() const { return m_FindOriginDir; } void FindOriginDir(int val) { m_FindOriginDir = val; } double OriginOffset() const { return m_OriginOffset; } void OriginOffset(double val) { m_OriginOffset = val; } int ReturnHomeMode() const { return m_ReturnHomeMode; } void ReturnHomeMode(int val) { m_ReturnHomeMode = val; } bool IsReverse() const { return m_IsReverse; } void IsReverse(bool val) { m_IsReverse = val; } double ReturnAcc() const { return m_returnAcc; } void ReturnAcc(double val) { m_returnAcc = val; } double ReturnDec() const { return m_returnDec; } void ReturnDec(double val) { m_returnDec = val; } int PulseTo1mm() const { return m_pulseTo1mm; } void PulseTo1mm(int val) { m_pulseTo1mm = val; } public: bool operator==(const MotorAttr &other) const { return this->m_AxisId == other.m_AxisId; } private: int m_AxisId = -1; //轴ID double m_curPos = 0.00; //电机当前位置 bool m_isEnable = false; //电机是否使能 double m_acc; //工作时加速度 double m_dec; //工作时减速度 double m_vel; //工作时运动速度 double m_returnAcc; //回原加速度 double m_returnDec; //回原减速度 double m_returnHomeStartVel; //回原点开始快速运动的速度 double m_returnHomeEndVel; //即将回到原点的慢速运动的速度 double m_PositiveLimit = 1000; //正限位 double m_NegativeLimit = -1000; //负限位 bool m_IsHomed = false; //是否已回原点 int m_FindOriginDir = 1; //回原点方向 double m_OriginOffset = 0; //回到原点结束后的偏移 int m_ReturnHomeMode = 0; //回原点模式 TODO 回原点模式有哪些? int m_pulseTo1mm = 1000; //1mm对应多少脉冲 bool m_IsReverse = false; //是否反向 TODO这个是什么意思? };