【运动控制】C++接口要求
2016-04-26 09:04
423 查看
//软件要求:控制软件提供C++ DLL,接口按照下面一样设置,直接调用 //参考头文件: // PTMotion.h : main header file for the PTMOTION DLL // #if !defined(AFX_APTMOTION_H__B7A1D957_F7BB_4EA2_885B_6023ABB126CA__INCLUDED_) #define AFX_APTMOTION_H__B7A1D957_F7BB_4EA2_885B_6023ABB126CA__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifndef __AFXWIN_H__ #error include "stdafx.h" before including this file for PCH #endif #include "resource.h" // main symbols ///////////////////////////////////////////////////////////////////////////// // CPTMotionApp // See PTMotion.cpp for the implementation of this class // class CPTMotionApp : public CWinApp { public: CPTMotionApp(); DECLARE_MESSAGE_MAP() }; #if _USRDLL #define PTMOTION_EXPORTS __declspec(dllexport) #else #define PTMOTION_EXPORTS __declspec(dllimport) #endif class PTMOTION_EXPORTS CPTMotion { public: CPTMotion(); virtual ~CPTMotion(); ///////////////////////////////////////////////////////////////////////////////////////////////// //所有函数为BOOL类型,返回FALSE说明运动控制异常,异常原因见CL_GetErrorCode函数 //启动时调用此函数。 //包括电机复位,参数导入 //线程用来监控按钮信号 BOOL CL_Init(int nPort); ///////////////////////////////////////////////////////////////////////////////////////////////// //关闭串口资源 VOID PX_Close(); ////////////////////////////////////////////////////////////////////////////////////////////// //移动探头时调用此函数,到位后返回 //此函数将xyz轴运行到目标位置 //包括转换成机器坐标和xyz位置补偿(传送线与X轴在水平面上的平行度补偿Y,传送线与X轴在垂直面上的平行度补偿Z) //坐标换算见参数...,xyz位置补偿见参数... BOOL PX_MoveTo(double x, double y, double z);//x,y,z为客户坐标,单位mm ////////////////////////////////////////////////////////////////////////////////////////////// //获取当前探头坐标位置 BOOL PX_GetCurrentPos(double *x, double *y, double *z); ////////////////////////////////////////////////////////////////////////////////////////////// //立即停止机器人运动并返回初始位置 BOOL PX_AllStopAndReturn(BOOL tagStop, BOOL tagHome); //////////////////////////////////////////////////////////////////////////////////// //获得错误信息 VOID PX_GetErrorCode(CString &csError); //当其他函数返回FALSE后,调用此函数获取错误原因。 }; #endif // !defined(AFX_PTMOTION_H__B7A1D957_F7BB_4EA2_885B_6023ABB126CA__INCLUDED_)