You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.3 KiB
C++
49 lines
2.3 KiB
C++
#pragma once
|
|
#include "module.h"
|
|
#include "EnumPropertieType.h"
|
|
#include "PlatformXY.h"
|
|
#include "WorkCmdInvoker.h"
|
|
|
|
typedef pair<double,double> TypePosError;//(first 是平台理论坐标,second 是误差值)
|
|
class CGratingRuler :public CModule
|
|
{
|
|
public:
|
|
CGratingRuler(void);
|
|
~CGratingRuler(void);
|
|
virtual CMFCPropertyGridProperty *CreatGridProperty();
|
|
virtual MODULE GetModuleType(){return _GRATING_RULER_PROP;};
|
|
virtual void ExportPar(ofstream *pFile);
|
|
|
|
bool ReadGratingRuler(Dbxy &pt);
|
|
bool SetOriginCoord();
|
|
bool GetCurCoord(Dbxy &pt);
|
|
bool PlatformOriginCalibration(CPlatformXY &PlatformXY);
|
|
bool MeasurePlatfromError(DbRect rect,CPlatformXY &PlatformXY);
|
|
private:
|
|
bool IsUsed(){return m_bUseGratingRuler;};//是否使用光栅尺
|
|
bool AnalysisRulerRet(char *str,Dbxy &pt);
|
|
bool AnalysisSymbol(BYTE byte,bool &bIsNegativeX,bool &bIsNegativeY);
|
|
bool AnalysisXYState(BYTE byte);
|
|
double AnalysisCoord(BYTE byte1,BYTE byte2,BYTE byte3,BYTE byte4);
|
|
void GetTwoNum(BYTE byte,double &high,double &low);
|
|
bool MeasureMotorError(CPlatformXY &PlatformXY,X_OR_Y xy,double Start,double End,vector<TypePosError> &ErrorTable);
|
|
void ExportErrorTable(ofstream *pFile,vector<TypePosError> &ErrorTable);
|
|
private:
|
|
|
|
bool m_bIni;//光栅尺是否初始化
|
|
Dbxy m_OriginCoord;//平台设定原点时光栅尺的度数坐标(实际坐标都以这个基准来计算)
|
|
//要保存的参数--------------------------------------
|
|
bool m_bUseGratingRuler;//是否使用光栅尺
|
|
int m_CommPort;//串口编号
|
|
double m_OriginCalibrationError;//原点校准误差(mm)(平台回原点时误差大于这个值需要补偿脉冲)
|
|
int m_MaxCalibrationTimes;//最大校准次数,避免死循环
|
|
double m_MeasureErrorGap;//校准平台误差的间隔(单位: mm)
|
|
double m_MaxOriginError;/*回原点时平台原点和光栅尺原点最大允许的误差(mm)(大于这个误差时报错,可能是手动修改了数显表的值,避免硬件损坏)*/
|
|
|
|
//误差补偿表-----------------------------------------
|
|
vector<TypePosError> m_ErrorTableX;//X 轴误差补偿表
|
|
vector<TypePosError> m_ErrorTableY;//X 轴误差补偿表
|
|
};
|
|
|
|
extern CGratingRuler *gGratingRuler;
|