|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "MotionCard_PCI1245.h"
|
|
|
|
|
#include "Propertie.h"
|
|
|
|
|
#include "PropertieMgr.h"
|
|
|
|
|
#include "AuthorityMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "Motor.h"
|
|
|
|
|
#include "PlatformXY.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
#include "FileMgr.h"
|
|
|
|
|
#include "SinglechipCardMgr.h"
|
|
|
|
|
#include "PciCh365Mgr.h"
|
|
|
|
|
#include "CommPortMgr.h"
|
|
|
|
|
#include "FileMgr.h"
|
|
|
|
|
#include "WorkTime.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
|
#undef THIS_FILE
|
|
|
|
|
static char THIS_FILE[] = __FILE__;
|
|
|
|
|
#endif
|
|
|
|
|
#include "general.h"
|
|
|
|
|
#pragma comment( lib, "Version.lib" )
|
|
|
|
|
#pragma comment( lib, "ADVMOT.lib" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_ASIX_IDX 3 //<2F>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
#define CFG_FILE_PATH _T("\\Parameter\\MotionCard_PCI1245\\PCI_1245.cfg")
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD>߳<EFBFBD>
|
|
|
|
|
UINT CheckAsixStateThread(LPVOID pParam)
|
|
|
|
|
{
|
|
|
|
|
MotionCard_PCI1245 *p = (MotionCard_PCI1245 *)pParam;
|
|
|
|
|
p->CheckAsixState();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MotionCard_PCI1245 *gMotionCard_PCI1245 = new MotionCard_PCI1245;
|
|
|
|
|
MotionCard_PCI1245::MotionCard_PCI1245(void)
|
|
|
|
|
{
|
|
|
|
|
m_bUsed = false;//<2F>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>
|
|
|
|
|
m_bArcCut = false;//Բ<><D4B2><EFBFBD>岹
|
|
|
|
|
m_Devhand = 0;
|
|
|
|
|
memset(m_Axishand,0,sizeof(m_Axishand));
|
|
|
|
|
for (int i=0;i<32;i++)
|
|
|
|
|
{
|
|
|
|
|
m_End[i]=0;
|
|
|
|
|
}
|
|
|
|
|
m_ulAxisCount=0;
|
|
|
|
|
m_bServoOn =FALSE;
|
|
|
|
|
m_bInit=FALSE;
|
|
|
|
|
m_CurGpIdx = 0;//<2F><>ǰʹ<C7B0>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_GpHand=0;
|
|
|
|
|
AxCount=0;
|
|
|
|
|
m_EndNum =0;
|
|
|
|
|
m_MotorXAsixIdx = 1;//X<><58><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_MotorX2AsixIdx = 3;//X 2<><32><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_MotorYAsixIdx = 0;//Y<><59><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_MotorZAsixIdx = 2;//Z<><5A><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_bGroupAisxRev = false;//<2F>岹<EFBFBD><E5B2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_CheckDelay = 20;//<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms
|
|
|
|
|
m_bInited = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
|
|
|
|
m_bMotorXMoveStop = true;//<2F><><EFBFBD>Ƿ<EFBFBD><C7B7>˶<EFBFBD>ֹͣ
|
|
|
|
|
m_bMotorX2MoveStop = true;//
|
|
|
|
|
m_bMotorYMoveStop = true;//
|
|
|
|
|
m_bMotorZMoveStop = true;//
|
|
|
|
|
m_bAutoCloseSevon = false;//<2F>رճ<D8B1><D5B3><EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><D4B6>ر<EFBFBD>sevon
|
|
|
|
|
m_bCheckActCoord = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʹ<EFBFBD>դ<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_MaxActCoordErr = 10;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><D5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m_XYFindOriginByLimit = true;//XY<58><59>ͨ<EFBFBD><CDA8><EFBFBD>Ҽ<EFBFBD><D2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>(<28><>β<EFBFBD><CEB2><EFBFBD><EFBFBD>6̨<36><CCA8>)
|
|
|
|
|
}
|
|
|
|
|
MotionCard_PCI1245::~MotionCard_PCI1245(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
CMFCPropertyGridProperty *MotionCard_PCI1245::CreatGridProperty()
|
|
|
|
|
{
|
|
|
|
|
CString PropertyName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CString Description;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
CString Path = _T("MotionCard_PCI1245");//<2F>洢·<E6B4A2><C2B7>
|
|
|
|
|
CString Name;
|
|
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
|
|
PropertyName = _T("PCI 1245L <20>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* pGroup = new CMFCPropertyGridProperty(PropertyName);
|
|
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bUsed");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bUsed);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bUsed, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_XYFindOriginByLimit");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_XYFindOriginByLimit);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD>Ƿ<EFBFBD>XY<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_XYFindOriginByLimit, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bCheckActCoord");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bCheckActCoord);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bCheckActCoord, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_MaxActCoordErr");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_MaxActCoordErr);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD>դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MaxActCoordErr, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bAutoCloseSevon");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bAutoCloseSevon);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ر<EFBFBD>sevon");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>Զ<EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sevon");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bAutoCloseSevon, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bArcCut");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bArcCut);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("Բ<EFBFBD><EFBFBD><EFBFBD>岹");
|
|
|
|
|
Description = _T("<EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><EFBFBD>ƽ̨Բ<EFBFBD><EFBFBD><EFBFBD>岹");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bArcCut, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_bGroupAisxRev");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_bGroupAisxRev);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD>岹<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>岹<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_bGroupAisxRev, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_CheckDelay");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_CheckDelay);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱms");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_CheckDelay, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_MotorXAsixIdx");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_MotorXAsixIdx);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("X <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MotorXAsixIdx, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_MotorX2AsixIdx");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_MotorX2AsixIdx);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("X 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("X 2<><32><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MotorX2AsixIdx, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_MotorYAsixIdx");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_MotorYAsixIdx);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("Y <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MotorYAsixIdx, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = _T("m_MotorZAsixIdx");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&m_MotorZAsixIdx);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("Z <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("Z <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)m_MotorZAsixIdx, Description);
|
|
|
|
|
pGroup->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
|
|
|
|
{
|
|
|
|
|
CMFCPropertyGridProperty* pGroup1;
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_OrgSpeedMotorZ,_T("Z <20><>ԭ<EFBFBD><D4AD><EFBFBD>ٶ<EFBFBD>"),_T("m_OrgSpeedMotorZ"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_MoveSpeedMotorZ,_T("Z <20><><EFBFBD>ƶ<EFBFBD><C6B6>ٶ<EFBFBD>"),_T("m_MoveSpeedMotorZ"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_OrgSpeedMotorXY,_T("XY <20><>ԭ<EFBFBD><D4AD><EFBFBD>ٶ<EFBFBD>"),_T("m_OrgSpeedMotorXY"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_MoveSpeedMotorX,_T("X <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>"),_T("m_MoveSpeedMotorX"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_WorkSpeedMotorX,_T("X <20>Ṥ<EFBFBD><E1B9A4><EFBFBD>ٶ<EFBFBD>"),_T("m_WorkSpeedMotorX"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_MoveSpeedMotorY,_T("Y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>"),_T("m_MoveSpeedMotorY"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
pGroup1 = CreatSpeedGridProperty(m_WorkSpeedMotorY,_T("Y <20>Ṥ<EFBFBD><E1B9A4><EFBFBD>ٶ<EFBFBD>"),_T("m_WorkSpeedMotorY"));
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
}
|
|
|
|
|
if(gAuthorityMgr->CheckAuthority(_FACTORY))
|
|
|
|
|
{
|
|
|
|
|
PropertyName = "<EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>";
|
|
|
|
|
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(PropertyName);
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
|
|
|
|
|
Name = "m_AsixNum";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&(m_InPortUnload.m_AsixNum));
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0~3)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)(m_InPortUnload.m_AsixNum), Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = "m_PortNum";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&(m_InPortUnload.m_PortNum));
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_INT);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD>˿ں<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD>ƵĶ˿ں<EFBFBD>(0~3)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_InPortUnload.m_PortNum, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = "m_bRev";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&(m_InPortUnload.m_bRev));
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_BOOL);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD>˿ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName,(_variant_t)m_InPortUnload.m_bRev, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
pGroup->AddSubItem(pGroup1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//-------------------------------------------------------------------------------//
|
|
|
|
|
return pGroup;
|
|
|
|
|
}
|
|
|
|
|
CMFCPropertyGridProperty* MotionCard_PCI1245::CreatSpeedGridProperty(PCI1245_SpeedParam &SpeedParam,CString SpeedName,CString ValName)
|
|
|
|
|
{
|
|
|
|
|
CString PropertyName;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CString Description;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
CString Path = _T("MotionCard_PCI1245");//<2F>洢·<E6B4A2><C2B7>
|
|
|
|
|
CString Name;
|
|
|
|
|
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(SpeedName);
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = ValName+_T("_Acc");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&SpeedParam.m_Acc);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȵļ<EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s2)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)SpeedParam.m_Acc, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = ValName+_T("_Dec");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&SpeedParam.m_Dec);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȵ<EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD>ļ<EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s2)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)SpeedParam.m_Dec, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = ValName+_T("_VelLow");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&SpeedParam.m_VelLow);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)SpeedParam.m_VelLow, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ӳ<EFBFBD><D3B3>
|
|
|
|
|
Name = ValName+_T("_VelHigh");//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CPropertie *pPropertie = new CPropertie;
|
|
|
|
|
pPropertie->SetpVal((void*)&SpeedParam.m_VelHigh);
|
|
|
|
|
pPropertie->SetType(_PROP_TYPE_DOUBLE);
|
|
|
|
|
pPropertie->SetpModule(this);
|
|
|
|
|
pPropertie->SetPath(Path);
|
|
|
|
|
pPropertie->SetName(Name);
|
|
|
|
|
pPropertie->WriteRead(true);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
PropertyName = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>");
|
|
|
|
|
Description = _T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s)");
|
|
|
|
|
CMFCPropertyGridProperty* p1 = new CMFCPropertyGridProperty(PropertyName, (_variant_t)SpeedParam.m_VelHigh, Description);
|
|
|
|
|
pGroup1->AddSubItem(p1);
|
|
|
|
|
gDevicePropertieMgr.Insert(p1, pPropertie);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pGroup1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MotionCard_PCI1245::ExportPar(ofstream *pFile)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
void MotionCard_PCI1245::Ini()
|
|
|
|
|
{
|
|
|
|
|
/* if(!m_bUsed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
CCommPortMgr Comm;
|
|
|
|
|
if(!Comm.Open(1,9600))//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĻ<DAB5>˵<EFBFBD><CBB5><EFBFBD>ڱʼDZ<CABC><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Comm.Close();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>-------------------------------------------
|
|
|
|
|
CMotor &MotorX = *(CMotor::GetMotor(MOTOR_X));
|
|
|
|
|
CMotor &MotorX2 = *(CMotor::GetMotor(MOTOR_X2));
|
|
|
|
|
CMotor &MotorY = *(CMotor::GetMotor(MOTOR_Y));
|
|
|
|
|
CMotor &MotorZ = *(CMotor::GetMotor(MOTOR_Z));
|
|
|
|
|
MotorX.SetAsixIdx(m_MotorXAsixIdx);
|
|
|
|
|
MotorX2.SetAsixIdx(m_MotorX2AsixIdx);
|
|
|
|
|
MotorY.SetAsixIdx(m_MotorYAsixIdx);
|
|
|
|
|
MotorZ.SetAsixIdx(m_MotorZAsixIdx);
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
|
|
if(!InitCard())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//<2F><EFBFBD><F2BFAABF><EFBFBD><EFBFBD><EFBFBD>ȡ֧<C8A1>ֵ<EFBFBD><D6B5><EFBFBD>
|
|
|
|
|
if(!OpenCard())
|
|
|
|
|
return;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ϸ<EFBFBD>
|
|
|
|
|
if(!CheckRange(m_MotorXAsixIdx,0,MAX_ASIX_IDX)
|
|
|
|
|
|| !CheckRange(m_MotorX2AsixIdx,0,MAX_ASIX_IDX)
|
|
|
|
|
|| !CheckRange(m_MotorYAsixIdx,0,MAX_ASIX_IDX)
|
|
|
|
|
|| !CheckRange(m_MotorZAsixIdx,0,MAX_ASIX_IDX)
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("[Error]---->invalid Asix Idx");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ļ<EFBFBD>.cfg
|
|
|
|
|
LoadConfigFile();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>XY <20><>Ϊһ<CEAA><D2BB><EFBFBD><EFBFBD>(֧<><D6A7><EFBFBD><EFBFBD><EFBFBD>Բ岹<D4B2>˶<EFBFBD>)
|
|
|
|
|
AddAsixToGroup(m_GpHand,m_MotorXAsixIdx);
|
|
|
|
|
AddAsixToGroup(m_GpHand,m_MotorYAsixIdx);
|
|
|
|
|
|
|
|
|
|
SetCurGpIdx(0);
|
|
|
|
|
|
|
|
|
|
//<2F>Զ<EFBFBD>SvOn
|
|
|
|
|
SetSvOn(true);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>״̬<D7B4><CCAC><EFBFBD>߳<EFBFBD>
|
|
|
|
|
AfxBeginThread(CheckAsixStateThread,this);*/
|
|
|
|
|
}
|
|
|
|
|
void MotionCard_PCI1245::OnExitApp()
|
|
|
|
|
{
|
|
|
|
|
/*if(m_bAutoCloseSevon)
|
|
|
|
|
SetSvOn(false);*/
|
|
|
|
|
}
|
|
|
|
|
void MotionCard_PCI1245::SetSvOn(bool bOn)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->Motion Asix SetSvOn");
|
|
|
|
|
for(int k=0;k<=MAX_ASIX_IDX;k++)
|
|
|
|
|
{
|
|
|
|
|
Acm_AxSetSvOn(m_Axishand[k],bOn);
|
|
|
|
|
Sleep(100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD>
|
|
|
|
|
bool MotionCard_PCI1245::InitCard()
|
|
|
|
|
{
|
|
|
|
|
U32 Result;
|
|
|
|
|
ULONG i=0;
|
|
|
|
|
ULONG deviceNumber=0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
CString strTemp;
|
|
|
|
|
|
|
|
|
|
Result = Acm_GetAvailableDevs(m_avaDevs,MAX_DEVICES,&deviceNumber);
|
|
|
|
|
if (Result!=SUCCESS || deviceNumber<=0)
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("[Error]---->Acm_GetAvailableDevs");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
m_dwDevNum=m_avaDevs[0].dwDeviceNum;//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>豸<EFBFBD><E8B1B8>
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->InitMotionCard 1245L Success");
|
|
|
|
|
m_bInited = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><EFBFBD>
|
|
|
|
|
bool MotionCard_PCI1245::OpenCard()
|
|
|
|
|
{
|
|
|
|
|
U32 Result;
|
|
|
|
|
ULONG i=0;
|
|
|
|
|
CString strTemp;
|
|
|
|
|
CString strString;
|
|
|
|
|
ULONG AxisPerDev=0;
|
|
|
|
|
ULONG AxisNumber=0;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>豸m_dwDevNum ,<2C><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>m_Devhand
|
|
|
|
|
Result = Acm_DevOpen(m_dwDevNum, &m_Devhand);
|
|
|
|
|
if (Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Open Device Failed With Error Code:%x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Result = Acm_GetU32Property(m_Devhand,FT_DevAxesCount,&AxisPerDev);
|
|
|
|
|
if (Result!=SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Get Device Axes Number Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
m_ulAxisCount=AxisPerDev;
|
|
|
|
|
//if you device is fixed,for example: PCI-1245 m_ulAxisCount =4
|
|
|
|
|
for(AxisNumber=0;AxisNumber<m_ulAxisCount;AxisNumber++)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>m_Axishand
|
|
|
|
|
Result =Acm_AxOpen(m_Devhand, (USHORT)AxisNumber, &m_Axishand[AxisNumber]);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Open Axis Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[AxisNumber],0);
|
|
|
|
|
}
|
|
|
|
|
m_bInit = TRUE; //<2F>Ƿ<EFBFBD><C7B7>ɹ<F2BFAAB3>
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->OpenCard 1245L Success");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//ʹ<><CAB9><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>ʹ<EFBFBD><CAB9>
|
|
|
|
|
bool MotionCard_PCI1245::CheckFucCanUsed()
|
|
|
|
|
{
|
|
|
|
|
if(m_bUsed)
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show(_T("ʹ<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>"));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡ<EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ļ<EFBFBD>.cfg
|
|
|
|
|
void MotionCard_PCI1245::LoadConfigFile()
|
|
|
|
|
{
|
|
|
|
|
CString strTemp;
|
|
|
|
|
CFileMgr FileMgr;
|
|
|
|
|
FileMgr.GetFullFilePath(strTemp,CFG_FILE_PATH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
|
|
|
|
|
//Set all configurations for the device according to the loaded file
|
|
|
|
|
U32 Result;
|
|
|
|
|
Result=Acm_DevLoadConfig(m_Devhand,strTemp.GetBuffer(strTemp.GetLength()));
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Load Config Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->LoadConfigFile 1245 Success");
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1//<2F><><EFBFBD>˶<EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ᵽ<EFBFBD><E1B5BD>
|
|
|
|
|
bool MotionCard_PCI1245::AddAsixToGroup(HAND &GpHand,UINT index)
|
|
|
|
|
{
|
|
|
|
|
U32 Result;
|
|
|
|
|
CString strTemp;
|
|
|
|
|
Result = Acm_GpAddAxis(&GpHand,m_Axishand[index]);
|
|
|
|
|
if (Result!=SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Add Axis To Group Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format(_T("AddAsixToGroup [Asix index] = [%d]"),index);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void MotionCard_PCI1245::SetCurGpIdx(int idx)
|
|
|
|
|
{
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format(_T("SetCurGpIdx [index] = [%d]"),idx);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
|
|
|
|
|
m_CurGpIdx = idx;
|
|
|
|
|
|
|
|
|
|
gPlatformXY->SetCoord(GetPlatformXYCoord());
|
|
|
|
|
}
|
|
|
|
|
void MotionCard_PCI1245::ResetAllAsixCoord()
|
|
|
|
|
{
|
|
|
|
|
gLogMgr->WriteDebugLog("ResetAllAsixCoord");
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[m_MotorXAsixIdx],0);
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[m_MotorX2AsixIdx],0);
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[m_MotorYAsixIdx],0);
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[m_MotorZAsixIdx],0);
|
|
|
|
|
//ͬʱ<CDAC><CAB1><EFBFBD>ù<EFBFBD>դ<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Acm_AxSetActualPosition(m_Axishand[m_MotorXAsixIdx],0);
|
|
|
|
|
Acm_AxSetActualPosition(m_Axishand[m_MotorX2AsixIdx],0);
|
|
|
|
|
Acm_AxSetActualPosition(m_Axishand[m_MotorYAsixIdx],0);
|
|
|
|
|
//֪ͨ<CDA8>۲<EFBFBD><DBB2><EFBFBD>ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><E4BBAF>
|
|
|
|
|
gPlatformXY->NotifyObservers();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>ȡƽ̨<C6BD><CCA8>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy MotionCard_PCI1245::GetPlatformXYCoord()
|
|
|
|
|
{
|
|
|
|
|
Dbxy Coord;
|
|
|
|
|
Dbxy OnePulseDis = gPlatformXY->GetMotorXYOnePulseDis();
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
int MotorXAsixIdx = (m_CurGpIdx==0)?m_MotorXAsixIdx:m_MotorX2AsixIdx;
|
|
|
|
|
Acm_AxGetCmdPosition(m_Axishand[MotorXAsixIdx],&Coord.x);
|
|
|
|
|
Acm_AxGetCmdPosition(m_Axishand[m_MotorYAsixIdx],&Coord.y);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Ϊmm <20><>λ
|
|
|
|
|
Coord.x *= OnePulseDis.x;
|
|
|
|
|
Coord.y *= OnePulseDis.y;
|
|
|
|
|
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format(_T("[XYCoord.x] = [%f] [XYCoord.y] = [%f]"),Coord.x,Coord.y);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
return Coord;
|
|
|
|
|
}
|
|
|
|
|
//ǿ<><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ̨<C6BD>ĵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
|
|
|
|
void MotionCard_PCI1245::SetCoord(Dbxy coord)
|
|
|
|
|
{
|
|
|
|
|
if(!m_bUsed)
|
|
|
|
|
return;
|
|
|
|
|
//mm ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy OnePulseDis = gPlatformXY->GetMotorXYOnePulseDis();
|
|
|
|
|
coord.x= coord.x/OnePulseDis.x;
|
|
|
|
|
coord.y = coord.y/OnePulseDis.y;
|
|
|
|
|
|
|
|
|
|
int MotorXAsixIdx = (m_CurGpIdx==0)?m_MotorXAsixIdx:m_MotorX2AsixIdx;
|
|
|
|
|
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[MotorXAsixIdx],coord.x);
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[m_MotorYAsixIdx],coord.y);
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->SetCoord 1245L Success");
|
|
|
|
|
}
|
|
|
|
|
//mm ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD>嵥λ<E5B5A5><CEBB><EFBFBD><EFBFBD>
|
|
|
|
|
Dbxy MotionCard_PCI1245::MM2PulseCoord(Dbxy Coord)
|
|
|
|
|
{
|
|
|
|
|
Dbxy OnePulseDis = gPlatformXY->GetMotorXYOnePulseDis();
|
|
|
|
|
Dbxy PulseCoord;
|
|
|
|
|
PulseCoord.x = Coord.x/OnePulseDis.x;
|
|
|
|
|
PulseCoord.y = Coord.y/OnePulseDis.y;
|
|
|
|
|
|
|
|
|
|
return PulseCoord;
|
|
|
|
|
}
|
|
|
|
|
//<2F>ȴ<EFBFBD>ƽ̨<C6BD>ƶ<EFBFBD>ֹͣ
|
|
|
|
|
void MotionCard_PCI1245::WaitPlatfromStop()
|
|
|
|
|
{
|
|
|
|
|
//<2F>ȴ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>----------------------
|
|
|
|
|
int TotalTimes = 0;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if(TotalTimes++>100000)//<2F><>ֹ<EFBFBD><D6B9>ѭ<EFBFBD><D1AD>
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Sleep(m_CheckDelay);
|
|
|
|
|
//Get the Group's current state
|
|
|
|
|
U16 GpState;
|
|
|
|
|
Acm_GpGetState(m_GpHand, &GpState);
|
|
|
|
|
if(GpState != 4)//STA_GP_MOTION <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>״̬
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ֱ<>߲岹<DFB2>ƶ<EFBFBD>ƽ̨XY ---------------------------------------------------
|
|
|
|
|
Dbxy MotionCard_PCI1245::MovePlatformXY(Dbxy Coord)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Dbxy CurCoord = gPlatformXY->GetCoord();
|
|
|
|
|
CString MotorStr = (m_CurGpIdx==0)?(MOTOR_X):(MOTOR_X2);
|
|
|
|
|
CMotor &MotorX = *(CMotor::GetMotor(MotorStr));
|
|
|
|
|
CMotor &MotorY = *(CMotor::GetMotor(MOTOR_Y));
|
|
|
|
|
double eps = 0.005;//<2F><>Ҫ<EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BF><EFBFBD>
|
|
|
|
|
if(!IsTwoDbEqual(Coord.y,CurCoord.y,eps))
|
|
|
|
|
{
|
|
|
|
|
MoveMotor(MotorY,Coord.y);
|
|
|
|
|
}
|
|
|
|
|
if(!IsTwoDbEqual(Coord.x,CurCoord.x,eps))
|
|
|
|
|
{
|
|
|
|
|
MoveMotor(MotorX,Coord.x);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gLogMgr->WriteDebugLog("Fuc---->MovePlatformXY 1245L");
|
|
|
|
|
CString strTemp;
|
|
|
|
|
strTemp.Format("Coord x : %f,Coord y : %f",Coord.y);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
//<2F><><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>ȡƽ̨<C6BD><CCA8>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>---------------
|
|
|
|
|
return GetPlatformXYCoord();
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ƽֱ̨<CCA8>߲岹<DFB2><E5B2B9><EFBFBD>˶<EFBFBD><CBB6>ٶ<EFBFBD>(bWorkSpeed <20>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>)
|
|
|
|
|
void MotionCard_PCI1245::SetPlatformSpeed(bool bWorkSpeed)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//mm <20><>λת<CEBB><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD>嵥λ
|
|
|
|
|
PCI1245_SpeedParam MotionCard_PCI1245::MM2PulseParam(PCI1245_SpeedParam &SpeedParam,double OnePulseDis)
|
|
|
|
|
{
|
|
|
|
|
PCI1245_SpeedParam Param;
|
|
|
|
|
Param.m_Acc = SpeedParam.m_Acc/OnePulseDis;//<2F><><EFBFBD>ٶ<EFBFBD>(mm/s2)
|
|
|
|
|
Param.m_Dec = SpeedParam.m_Dec/OnePulseDis;//<2F><><EFBFBD>ٶ<EFBFBD>(mm/s2)
|
|
|
|
|
Param.m_VelLow = SpeedParam.m_VelLow/OnePulseDis;//<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s)
|
|
|
|
|
Param.m_VelHigh = SpeedParam.m_VelHigh/OnePulseDis;//<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>(mm/s)
|
|
|
|
|
return Param;
|
|
|
|
|
}
|
|
|
|
|
void MotionCard_PCI1245::SetPlatformSpeedExt(PCI1245_SpeedParam GpParam)
|
|
|
|
|
{
|
|
|
|
|
U32 Result;
|
|
|
|
|
double GpVelLow;
|
|
|
|
|
double GpVelHigh;
|
|
|
|
|
double GpAcc;
|
|
|
|
|
double GpDec;
|
|
|
|
|
double GpJerk;
|
|
|
|
|
CString strTemp;
|
|
|
|
|
|
|
|
|
|
HAND GpHand = m_GpHand;
|
|
|
|
|
|
|
|
|
|
GpVelLow = GpParam.m_VelLow;
|
|
|
|
|
Result = Acm_SetF64Property(GpHand,PAR_GpVelLow,GpVelLow);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Set PAR_GpVelLow Property Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
GpVelHigh = GpParam.m_VelHigh;
|
|
|
|
|
Result = Acm_SetF64Property(GpHand,PAR_GpVelHigh,GpVelHigh);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Set PAR_GpVelHigh Property Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
GpAcc = GpParam.m_Acc;
|
|
|
|
|
Result = Acm_SetF64Property(GpHand,PAR_GpAcc,GpAcc);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Set PAR_GpAcc Property Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
GpDec = GpParam.m_Dec;
|
|
|
|
|
Result = Acm_SetF64Property(GpHand,PAR_GpDec,GpDec);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Set PAR_GpDec Property Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
GpJerk = 0;//<2F><><EFBFBD>ٷ<EFBFBD>ʽ
|
|
|
|
|
Result = Acm_SetF64Property(GpHand,PAR_GpJerk,GpJerk);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strTemp.Format("Set PAR_GpJerk Property Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#if 1//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|
|
|
|
bool MotionCard_PCI1245::FindOrigin(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
bool ret;
|
|
|
|
|
if(m_XYFindOriginByLimit)
|
|
|
|
|
{
|
|
|
|
|
if(Motor.Name() == MOTOR_Z)//Z <20><>ԭ<EFBFBD>㻹<EFBFBD><E3BBB9><EFBFBD><EFBFBD>
|
|
|
|
|
ret = FindOriginExt(Motor);
|
|
|
|
|
else//XY<58><59>ʹ<EFBFBD><CAB9><EFBFBD>Ҽ<EFBFBD><D2BC>ķ<DEB5>ʽ
|
|
|
|
|
ret = FindOriginByLimit(Motor);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ret = FindOriginExt(Motor);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ԭ<EFBFBD>㿪<EFBFBD>صķ<D8B5>ʽ
|
|
|
|
|
bool MotionCard_PCI1245::FindOriginExt(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[AsixIdx],0);
|
|
|
|
|
|
|
|
|
|
U32 HomeMode = 6;//<2F><>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>ģʽ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>,<2C>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>Ƴ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
U32 DirMode = (Motor.GetFindOriginDir())?1:0;//<2F><>ԭ<EFBFBD>㷽<EFBFBD><E3B7BD>
|
|
|
|
|
Acm_AxHome(m_Axishand[AsixIdx],HomeMode,DirMode);
|
|
|
|
|
//<2F>ȴ<EFBFBD><C8B4><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int TotalTimes = 0;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
if(TotalTimes++>100000)//<2F><>ֹ<EFBFBD><D6B9>ѭ<EFBFBD><D1AD>
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Sleep(m_CheckDelay);
|
|
|
|
|
//Get the Group's current state
|
|
|
|
|
U16 GpState;
|
|
|
|
|
Acm_AxGetState(m_Axishand[AsixIdx],&GpState);
|
|
|
|
|
if(GpState != 4)//STA_AX_HOMING
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
CString LogStr;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[AsixIdx],0);
|
|
|
|
|
|
|
|
|
|
LogStr.Format("Fuc---->FindOrigin Success[Asix Idx]: %d",AsixIdx);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ͨ<><CDA8><EFBFBD>Ҽ<EFBFBD><D2BC>ķ<DEB5>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
|
|
|
|
bool MotionCard_PCI1245::FindOriginByLimit(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[AsixIdx],0);
|
|
|
|
|
//<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㹻<EFBFBD><E3B9BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(ֱ<><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
double ReverseMoveDis = Motor.GetReverseMoveDis();
|
|
|
|
|
if(Motor.GetFindOriginDir()==false)
|
|
|
|
|
ReverseMoveDis *=(-1);
|
|
|
|
|
MoveMotor(Motor,ReverseMoveDis);
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format("Fuc---->FindOriginByLimit [Asix Idx]: %d",AsixIdx);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
//Acm_AxSetCmdPosition(m_Axishand[AsixIdx],0);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>״̬
|
|
|
|
|
void MotionCard_PCI1245::ResetAllAsixErr()
|
|
|
|
|
{
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format("Fuc---->ResetAllAsixErr");
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
for(int k=0;k<=MAX_ASIX_IDX;k++)
|
|
|
|
|
{
|
|
|
|
|
Acm_AxResetError(m_Axishand[k]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F>ƶ<EFBFBD><C6B6><EFBFBD>ԭ<EFBFBD><D4AD>ƫ<EFBFBD><C6AB>λ<EFBFBD><CEBB>
|
|
|
|
|
bool MotionCard_PCI1245::MoveToOriginOffset(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
double OffsetDis = Motor.GetOriginOffsetDis();//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool bFindOriginDir = Motor.GetFindOriginDir();//<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
|
|
|
|
OffsetDis *= bFindOriginDir?(1):(-1);
|
|
|
|
|
MoveMotor(Motor,OffsetDis);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
Acm_AxSetCmdPosition(m_Axishand[AsixIdx],0);
|
|
|
|
|
Motor.SetCoord(0);
|
|
|
|
|
CString LogStr;
|
|
|
|
|
LogStr.Format("Fuc---->MoveToOriginOffset Success[Asix Idx]: %d",AsixIdx);
|
|
|
|
|
gLogMgr->WriteDebugLog(LogStr);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Coord(<28><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>ʽ)
|
|
|
|
|
bool MotionCard_PCI1245::MoveMotor(CMotor &Motor,double &Coord)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
U32 Result;
|
|
|
|
|
CString strString;
|
|
|
|
|
//ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>----------------------------------
|
|
|
|
|
if(Motor.IsbReverseDir())
|
|
|
|
|
Coord *= -1;
|
|
|
|
|
|
|
|
|
|
F64 Position = Coord/Motor.GetOnePulseDis();
|
|
|
|
|
strString.Format("Move Coord: %f",Coord);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
strString.Format("Move Position: %d",(int)Position);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
Result=Acm_AxMoveAbs(m_Axishand[AsixIdx],Position);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Move Failed With Error Code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
PCI1245_SpeedParam MotionCard_PCI1245::GetMotorSpeed(CMotor &Motor,ESpeedType SpeedType)
|
|
|
|
|
{
|
|
|
|
|
PCI1245_SpeedParam MotorSpeedParam;
|
|
|
|
|
if(Motor.Name() == MOTOR_X || Motor.Name() == MOTOR_X2)
|
|
|
|
|
{
|
|
|
|
|
if(SpeedType==_SpeedType_Org)
|
|
|
|
|
MotorSpeedParam = m_OrgSpeedMotorXY;
|
|
|
|
|
else if(SpeedType==_SpeedType_Move)
|
|
|
|
|
MotorSpeedParam = m_MoveSpeedMotorX;
|
|
|
|
|
else if(SpeedType==_SpeedType_Work)
|
|
|
|
|
MotorSpeedParam = m_WorkSpeedMotorX;
|
|
|
|
|
}
|
|
|
|
|
else if(Motor.Name() == MOTOR_Y)
|
|
|
|
|
{
|
|
|
|
|
if(SpeedType==_SpeedType_Org)
|
|
|
|
|
MotorSpeedParam = m_OrgSpeedMotorXY;
|
|
|
|
|
else if(SpeedType==_SpeedType_Move)
|
|
|
|
|
MotorSpeedParam = m_MoveSpeedMotorY;
|
|
|
|
|
else if(SpeedType==_SpeedType_Work)
|
|
|
|
|
MotorSpeedParam = m_WorkSpeedMotorY;
|
|
|
|
|
}
|
|
|
|
|
else if(Motor.Name() == MOTOR_Z)
|
|
|
|
|
{
|
|
|
|
|
if(SpeedType==_SpeedType_Org)
|
|
|
|
|
MotorSpeedParam = m_OrgSpeedMotorZ;
|
|
|
|
|
else if(SpeedType==_SpeedType_Move)
|
|
|
|
|
MotorSpeedParam = m_MoveSpeedMotorZ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD>嵥λ
|
|
|
|
|
double OnePulseDis = Motor.GetOnePulseDis();
|
|
|
|
|
PCI1245_SpeedParam SpeedParam = MM2PulseParam(MotorSpeedParam,OnePulseDis);
|
|
|
|
|
|
|
|
|
|
return SpeedParam;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|
|
|
|
void MotionCard_PCI1245::SetMotorSpeed(CMotor &Motor,ESpeedType SpeedType)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
|
|
PCI1245_SpeedParam SpeedParam = GetMotorSpeed(Motor,SpeedType);
|
|
|
|
|
|
|
|
|
|
U32 Result;
|
|
|
|
|
double AxVelLow;
|
|
|
|
|
double AxVelHigh;
|
|
|
|
|
double AxAcc;
|
|
|
|
|
double AxDec;
|
|
|
|
|
double AxJerk;
|
|
|
|
|
CString strString;
|
|
|
|
|
AxVelLow = SpeedParam.m_VelLow;
|
|
|
|
|
AxVelHigh = SpeedParam.m_VelHigh;
|
|
|
|
|
AxAcc = SpeedParam.m_Acc;
|
|
|
|
|
AxDec = SpeedParam.m_Dec;
|
|
|
|
|
|
|
|
|
|
Result = Acm_SetF64Property(m_Axishand[AsixIdx],PAR_AxVelLow,AxVelLow);
|
|
|
|
|
if (Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Set low velocity failed with error code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Result = Acm_SetF64Property(m_Axishand[AsixIdx],PAR_AxVelHigh,AxVelHigh);
|
|
|
|
|
if (Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Set high velocity failed with error code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Result = Acm_SetF64Property(m_Axishand[AsixIdx],PAR_AxAcc,AxAcc);
|
|
|
|
|
if (Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Set acceleration failed with error code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Result = Acm_SetF64Property(m_Axishand[AsixIdx],PAR_AxDec,AxDec);
|
|
|
|
|
if (Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Set deceleration failed with error code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
AxJerk = 0;
|
|
|
|
|
Result = Acm_SetF64Property(m_Axishand[AsixIdx],PAR_AxJerk,AxJerk);
|
|
|
|
|
if(Result != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
strString.Format("Set the type of velocity profile failed with error code: %x",Result);
|
|
|
|
|
gLogMgr->WriteDebugLog(strString);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
void MotionCard_PCI1245::CheckAsixState()
|
|
|
|
|
{
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
Sleep(m_CheckDelay);
|
|
|
|
|
|
|
|
|
|
m_bMotorXMoveStop = CheckAsixStateExt(m_Axishand[m_MotorXAsixIdx]);
|
|
|
|
|
m_bMotorX2MoveStop = CheckAsixStateExt(m_Axishand[m_MotorX2AsixIdx]);
|
|
|
|
|
m_bMotorYMoveStop = CheckAsixStateExt(m_Axishand[m_MotorYAsixIdx]);
|
|
|
|
|
m_bMotorZMoveStop = CheckAsixStateExt(m_Axishand[m_MotorZAsixIdx]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bool MotionCard_PCI1245::CheckAsixStateExt(HAND AxisHandle)
|
|
|
|
|
{
|
|
|
|
|
U16 GpState;
|
|
|
|
|
Acm_AxGetState(AxisHandle,&GpState);
|
|
|
|
|
//STA_AX_PTP_MOT <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>״̬
|
|
|
|
|
if(GpState != STA_AX_HOMING && GpState != STA_AX_PTP_MOT)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>AsixIdx <20><>Port <20>˿ڵ<CBBF>״̬(<28><><EFBFBD><EFBFBD>-1:<3A><><EFBFBD><EFBFBD>,0:<3A><>,1:<3A><>)
|
|
|
|
|
int MotionCard_PCI1245::ReadIOState(CPci1245IOPort IOPort)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = IOPort.m_AsixNum;
|
|
|
|
|
int Port = IOPort.m_PortNum;
|
|
|
|
|
|
|
|
|
|
if(Port<0 || Port>7)
|
|
|
|
|
return -1;
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
U32 Ret; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
U8 bitData;
|
|
|
|
|
Ret = Acm_AxDiGetBit(m_Axishand[AsixIdx],Port,&bitData);
|
|
|
|
|
if(Ret != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
CString strTemp;
|
|
|
|
|
strTemp.Format("ReadIOState Failed With Error Code: %x",Ret);
|
|
|
|
|
gLogMgr->WriteDebugLog(strTemp);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if(IOPort.m_bRev)
|
|
|
|
|
{
|
|
|
|
|
if(bitData==0)
|
|
|
|
|
bitData = 1;
|
|
|
|
|
else
|
|
|
|
|
bitData = 0;
|
|
|
|
|
}
|
|
|
|
|
return bitData;//bitData <20><>ֵΪ0 <20><>1
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>״̬(false <20><>ʾ<EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ȫ)
|
|
|
|
|
bool MotionCard_PCI1245::CheckUnloadState()
|
|
|
|
|
{
|
|
|
|
|
int Ret = ReadIOState(m_InPortUnload);
|
|
|
|
|
if(Ret == 1)
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
//<2F><><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double MotionCard_PCI1245::GetMotorCoord(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
double Coord;
|
|
|
|
|
double OnePulseDis = Motor.GetOnePulseDis();
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
Acm_AxGetCmdPosition(m_Axishand[AsixIdx],&Coord);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Ϊmm <20><>λ
|
|
|
|
|
Coord *= OnePulseDis;
|
|
|
|
|
return Coord;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>λ<EFBFBD><CEBB>(<28><>դ<EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ֵ)
|
|
|
|
|
double MotionCard_PCI1245::GetMotorActCoord(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return -1;
|
|
|
|
|
double Coord;
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
Acm_AxGetActualPosition(m_Axishand[AsixIdx],&Coord);
|
|
|
|
|
return Coord;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><D5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
bool MotionCard_PCI1245::CheckMotorActCoord(CMotor &Motor)
|
|
|
|
|
{
|
|
|
|
|
if(!m_bCheckActCoord)
|
|
|
|
|
return true;
|
|
|
|
|
int AsixIdx = Motor.GetAsixIdx();//<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
if(!CheckRange(AsixIdx,0,MAX_ASIX_IDX))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
double CmdCoord;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Acm_AxGetCmdPosition(m_Axishand[AsixIdx],&CmdCoord);
|
|
|
|
|
double ActualCoord;//<2F><>դ<EFBFBD><D5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
Acm_AxGetActualPosition(m_Axishand[AsixIdx],&ActualCoord);
|
|
|
|
|
if(Motor.IsbRevActCoordDir())
|
|
|
|
|
ActualCoord *=(-1);
|
|
|
|
|
|
|
|
|
|
double ActPluseErrCnt = CmdCoord-ActualCoord;
|
|
|
|
|
if(fabs(ActPluseErrCnt)>m_MaxActCoordErr)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|