researchman 8 years ago
parent
commit
7a02a3bec9
10 changed files with 42 additions and 18 deletions
  1. 8 2
      Filter/KalmanFilter.cpp
  2. 1 2
      Filter/KalmanFilter.h
  3. 1 2
      SyncTime/SyncManager.cpp
  4. 4 4
      YAServer.vcxproj
  5. 23 2
      YAServerDlg.cpp
  6. 3 0
      classdef.h
  7. 0 3
      global.h
  8. 1 1
      locate_algorithm.cpp
  9. 0 2
      stdafx.cpp
  10. 1 0
      stdafx.h

+ 8 - 2
Filter/KalmanFilter.cpp

@@ -1,4 +1,6 @@
-//#include "stdafx.h"
+#ifndef KALMAN_FILTER_CPP
+#define KALMAN_FILTER_CPP
+
 #include "KalmanFilter.h"
 
 CKalmanFilter::CKalmanFilter()
@@ -8,6 +10,7 @@ CKalmanFilter::CKalmanFilter()
 		m_pCar = new Car;
 	}
 }
+
 CKalmanFilter::~CKalmanFilter()
 {
 	if(m_pCar){
@@ -15,6 +18,7 @@ CKalmanFilter::~CKalmanFilter()
 		m_pCar = NULL;
 	}
 }
+
 /*
  * º¯ÊýÃû£ºInitial
  *
@@ -70,4 +74,6 @@ void CKalmanFilter::Predict_Correct()
 	Eigen::MatrixXd K = m_pCar->P * m_pCar->H.adjoint() * (m_pCar->H * m_pCar->P *m_pCar->H.adjoint() + m_pCar->R).inverse();
 	m_pCar->x = m_pCar->x + K * (m_pCar->z - m_pCar->H * m_pCar->x);
 	m_pCar->P = m_pCar->P - K * m_pCar->H * m_pCar->P.adjoint();
-}
+}
+
+#endif

+ 1 - 2
Filter/KalmanFilter.h

@@ -2,8 +2,7 @@
 #ifndef KALMAN_FILTER_H
 #define KALMAN_FILTER_H
 
-
-#include "../global.h"
+#include <Eigen/Dense>
 
 //ÓÃÓÚ¿¨¶ûÂüÂ˲¨
 const int READER_NUMS = 4;

+ 1 - 2
SyncTime/SyncManager.cpp

@@ -1,7 +1,6 @@
 #include"SyncManager.h"
 #include <deque>
-//#include <Eigen/Dense>
-#include "../global.h"
+#include <Eigen/Dense>
 
 HostServer::SyncManager::SyncManager()
 {

+ 4 - 4
YAServer.vcxproj

@@ -225,7 +225,7 @@ xcopy "$(SolutionDir)..\config.ini" "D:\0a-share\$(Configuration)\" /Y /C /D /S<
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="classdef.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
     </ClCompile>
     <ClInclude Include="locate_algorithm.h">
       <FileType>CppCode</FileType>
@@ -235,7 +235,7 @@ xcopy "$(SolutionDir)..\config.ini" "D:\0a-share\$(Configuration)\" /Y /C /D /S<
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="locate_algorithm.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="LogSetting.cpp" />
     <ClCompile Include="MysqlConnPool.cpp" />
@@ -253,10 +253,10 @@ xcopy "$(SolutionDir)..\config.ini" "D:\0a-share\$(Configuration)\" /Y /C /D /S<
     </ClCompile>
     <ClCompile Include="SysSetting.cpp" />
     <ClCompile Include="YAServer.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="YAServerDlg.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>

+ 23 - 2
YAServerDlg.cpp

@@ -739,6 +739,9 @@ int CYAServerDlg::init_staffer(string staff_id /* = "" */, bool is_card /*= fals
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_RES* pRes;
 	MYSQL_ROW pRow;
 	int err = 0;
@@ -806,6 +809,9 @@ int CYAServerDlg::init_vehicle(string vehicle_id /* = "" */, bool is_card /*= fa
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_RES* pRes;
 	MYSQL_ROW pRow;
 	int err = 0;
@@ -873,6 +879,9 @@ int CYAServerDlg::init_map(int map_id /*= 0*/)
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_ROW pRow;
 	MYSQL_RES *pRes = NULL;
 	int err = 0;
@@ -911,6 +920,9 @@ int CYAServerDlg::init_area(int area_id /* = 0 */)
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_ROW pRow;
 	MYSQL_RES *pRes = NULL;
 	int err = 0;
@@ -972,6 +984,9 @@ int CYAServerDlg::init_reader(int reader_id /* = 0 */)
 	// 从数据库中读取
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_ROW pRow;
 	MYSQL_RES *pRes = NULL;
 	int err = 0;
@@ -1030,6 +1045,9 @@ int CYAServerDlg::init_antenna(int reader_id /* = 0 */)
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_ROW pRow;
 	MYSQL_RES *pRes = NULL;
 	int err = 0;
@@ -1070,6 +1088,9 @@ int CYAServerDlg::init_dev_adhoc( int reader_id /*= 0*/ )
 {
 	CMysqlConn* pConn = NULL;
 	CDBConnGuard pDbGuard(pConn);
+	if(pConn == NULL){
+		return 1;
+	}
 	MYSQL_ROW pRow;
 	MYSQL_RES *pRes = NULL;
 	int err = 0;
@@ -1127,7 +1148,7 @@ int CYAServerDlg::init_all_readers_coverage(int reader_id)
 
 	//如果无可用数据库连接,不执行后续操作
 	if(pConn == NULL){
-		return -1;
+		return 1;
 	}
 
 	char sql[LENGTH_SQL] = {0};
@@ -1256,7 +1277,7 @@ int CYAServerDlg::init_tdoa_all_readers_coverage(int reader_id)
 
 	//无可用数据库连接
 	if(pConn == NULL){
-		return -1;
+		return 1;
 	}
 
 	char sql[LENGTH_SQL] = {0};

+ 3 - 0
classdef.h

@@ -45,6 +45,9 @@
 //#define ALGORITHM_TYPE_TOF
 #define ALGORITHM_TYPE_TDOA
 
+//Â˲¨¹¦ÄÜ¿ªÆô
+#define FILTER_KALMAN
+
 using namespace std;
 
 enum TIMER_ID

+ 0 - 3
global.h

@@ -1,3 +0,0 @@
-#pragma once
-#include <Eigen/Dense>
-//using namespace Eigen;

+ 1 - 1
locate_algorithm.cpp

@@ -1,4 +1,4 @@
-//#include "stdafx.h"
+#include "stdafx.h"
 #include "locate_algorithm.h"
 #include <math.h>
 #include <algorithm>

+ 0 - 2
stdafx.cpp

@@ -4,5 +4,3 @@
 // stdafx.obj ½«°üº¬Ô¤±àÒëÀàÐÍÐÅÏ¢
 
 #include "stdafx.h"
-
-

+ 1 - 0
stdafx.h

@@ -3,4 +3,5 @@
 #define _USE_MFC
 #define _DETECT_MEMORY_LEAK
 
+#include <Eigen/Dense>
 #include <GeneralHelper.h>