增加校验计算方法

This commit is contained in:
TAO Cheng
2013-06-09 18:16:29 +08:00
parent 4e286a5367
commit b1841d69f6
16 changed files with 1836 additions and 15 deletions
@@ -111,7 +111,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
//calibrate
ReferencePlanePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue;
ThreePntsConstructionPanel(ReferencePlanePnts,ReferencePlaneCoeff);
ThreePntsConstructPlane(ReferencePlanePnts,ReferencePlaneCoeff);
//=====================Top Surface==================================
GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X4)->GetWindowText(str);
cTempValue=T2A(str);
@@ -147,7 +147,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
//calibrate
TopSurfacePnts[2].z=TopLaserValue-CalibrateTopLaserValue+CalibrateValue+CalibrateBottomLaserValue;
ThreePntsConstructionPanel(TopSurfacePnts,TopPlaneCoeff);
ThreePntsConstructPlane(TopSurfacePnts,TopPlaneCoeff);
//====================Bottom Surface================================
GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_X7)->GetWindowText(str);
cTempValue=T2A(str);
@@ -177,7 +177,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
cTempValue=T2A(str);
BottomSurfacePnts[2].z=atof(cTempValue);
ThreePntsConstructionPanel(BottomSurfacePnts,BottomPlaneCoeff);
ThreePntsConstructPlane(BottomSurfacePnts,BottomPlaneCoeff);
/***************************************************************
result
@@ -187,9 +187,9 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
double dAnswer(0.0);
CString csOutput;
//==================Top - Reference================================
Top2ReferenceDis[0]=PointToPanelDistance(TopSurfacePnts[0],ReferencePlaneCoeff);
Top2ReferenceDis[1]=PointToPanelDistance(TopSurfacePnts[1],ReferencePlaneCoeff);
Top2ReferenceDis[2]=PointToPanelDistance(TopSurfacePnts[2],ReferencePlaneCoeff);
Top2ReferenceDis[0]=PointToPlaneDistance(TopSurfacePnts[0],ReferencePlaneCoeff);
Top2ReferenceDis[1]=PointToPlaneDistance(TopSurfacePnts[1],ReferencePlaneCoeff);
Top2ReferenceDis[2]=PointToPlaneDistance(TopSurfacePnts[2],ReferencePlaneCoeff);
Top2ReferenceDis[3]=(Top2ReferenceDis[0]+Top2ReferenceDis[1]+Top2ReferenceDis[2])/3.0;
@@ -203,9 +203,9 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
((CButton*)(GetDlgItem(IDC_EDIT_IMAGEDLL_2LASER_MEASURED_VALUE4)))->SetWindowText(csOutput);
Bottom2ReferenceDis[0]=PointToPanelDistance(BottomSurfacePnts[0],ReferencePlaneCoeff);
Bottom2ReferenceDis[1]=PointToPanelDistance(BottomSurfacePnts[1],ReferencePlaneCoeff);
Bottom2ReferenceDis[2]=PointToPanelDistance(BottomSurfacePnts[2],ReferencePlaneCoeff);
Bottom2ReferenceDis[0]=PointToPlaneDistance(BottomSurfacePnts[0],ReferencePlaneCoeff);
Bottom2ReferenceDis[1]=PointToPlaneDistance(BottomSurfacePnts[1],ReferencePlaneCoeff);
Bottom2ReferenceDis[2]=PointToPlaneDistance(BottomSurfacePnts[2],ReferencePlaneCoeff);
Bottom2ReferenceDis[3]=(Bottom2ReferenceDis[0]+Bottom2ReferenceDis[1]+Bottom2ReferenceDis[2])/3.0;
dAnswer=Top2ReferenceDis[3]-Bottom2ReferenceDis[3];
@@ -224,7 +224,7 @@ void CSO7_Verfication_Algorithm::OnBnClickedButtonImagedll2laserCalculate()
}
//===================================================================
BOOL CSO7_Verfication_Algorithm::ThreePntsConstructionPanel(Struct_3DPoint* pArr,double* Coe)
BOOL CSO7_Verfication_Algorithm::ThreePntsConstructPlane(Struct_3DPoint* pArr,double* Coe)
{
Struct_3DPoint p1,p2,p3;
@@ -244,7 +244,7 @@ BOOL CSO7_Verfication_Algorithm::ThreePntsConstructionPanel(Struct_3DPoint* pArr
return TRUE;
};
//===================================================================
double CSO7_Verfication_Algorithm::PointToPanelDistance(Struct_3DPoint PntPos,double* Coe)
double CSO7_Verfication_Algorithm::PointToPlaneDistance(Struct_3DPoint PntPos,double* Coe)
{
double m_result(0.0);
double a(0.0),b(0.0),c(0.0),d(0.0);
@@ -154,19 +154,62 @@ void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineCommonCmd3()
//===================================================
void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeHex()
{
// TODO: Add your control notification handler code here
m_SendType=HEXADECIMAL;
}
//===================================================
void CSo7_Manual_Machine::OnBnClickedRadioSo7ManualMachineSendDataTypeAnscii()
{
// TODO: Add your control notification handler code here
m_SendType=ANSCII;
}
//===================================================
void CSo7_Manual_Machine::OnBnClickedButtonSo7ManualMachineSendData()
{
// TODO: Add your control notification handler code here
/*
UpdateData(TRUE);
USES_CONVERSION;
CString csSendData(L"");
GetDlgItem(IDC_EDIT_SO7_MANUAL_MACHINE_DATA)->GetWindowText(csSendData);
const char* cSendData=T2A(csSendData);
if (m_SendType==HEXADECIMAL)
{
char* stop;
BYTE bSendData[MAX_OUTPUT_BUFFER_SIZE]={0};
INT iSendDataLength=(csSendData.GetLength()+1)/3;
for(INT i=0;i<iSendDataLength;i++)
{
bSendData[i]=(BYTE)strtol(cSendData+i*3,&stop,16);
}
}
else
{
m_pSO7_Serial->m_csRecv=_T("");
//加上回车换行符
CString csTemp;
csTemp.Format(_T("\r\n"));
csSendData+=csTemp;
cSendData=T2A(csSendData);
}
DWORD iSendDataLength=csSendData.GetLength();
DWORD iWriteByte=m_pSO7_Serial->Send(cSendData,iSendDataLength);
((CListBox *)GetDlgItem(IDC_LIST_SHOWMESSAGE))->InsertString(-1,CString(_T("[Send]: "))+cSendData);//
csSendData.Format(_T("Send(%dByte)"),iWriteByte);
m_StatusBar.SetText(csSendData, 1, 0);
//接受数据
INT iRetrys(0);
while(!m_pSO7_Serial->m_iRecvState && iRetrys<20)
{
iRetrys++;
Sleep(100);
}
*/
}
//===================================================
@@ -1,6 +1,9 @@
#pragma once
typedef enum{
HEXADECIMAL = 0,
ANSCII,
}RS232SendType;
// CSo7_Manual_Machine dialog
class CSo7_Manual_Machine : public CDialog
@@ -21,6 +24,7 @@ protected:
protected:
CStatusBarCtrl m_StatusBar;
CEdit m_edit_Log;
char m_SendType;
public:
afx_msg void OnBnClickedButtonSo7ManualMachineStartMachine();
afx_msg void OnBnClickedButtonSo7ManualMachineStopMachine();