|
@@ -28,15 +28,21 @@
|
|
|
#define CARD_LOST_TIME_OUT_SPECIAL_AREA 1800
|
|
|
#define READER_SEND_STATE_TIMEOUT 30 // (2* 60 * 60)
|
|
|
#define OVER_TIME (480 * 60)
|
|
|
-
|
|
|
#define MAX_SEMACOUNT 64
|
|
|
|
|
|
//算法类型
|
|
|
//#define ALGORITHM_TYPE_TOF
|
|
|
-#define ALGORITHM_TYPE_TDOA
|
|
|
+//#define ALGORITHM_TYPE_TDOA
|
|
|
//#define ALGORITHM_TYPE_INS //使用惯导判断
|
|
|
#define ENABLE_MY_LOG
|
|
|
|
|
|
+#define NEED_DISPLAY_RULES 1 // lemon 2017/08/01
|
|
|
+#define NEED_DISPLAY_VALID 0
|
|
|
+#define NEED_DISPLAY_INVALID 1
|
|
|
+#define PATROL_LEVEL_ID 3
|
|
|
+
|
|
|
+#define INDEXFORRECONEREADER 10
|
|
|
+
|
|
|
#include <string>
|
|
|
#include <ctime>
|
|
|
#include <map>
|
|
@@ -65,17 +71,21 @@ const double INS_WEIGHT = 9.0; //
|
|
|
const double UWB_WEIGHT = 1.0; //UWB权重
|
|
|
const double MAX_VECHILE_SPEED = 30.0; //25
|
|
|
const double NEAR_READER = 4.0;
|
|
|
-const double MIN_DIFFER_DISTANCE = 10.0;
|
|
|
-const double VECHILE_ACCELERATE_THRESHOLD = 10;
|
|
|
-const double PERSON_ACCELERATE_THRESHOLD = 10;
|
|
|
+const double MIN_DIFFER_DISTANCE = 10.0; // 使用其他分站校验计算结果时,判断该结果到校验分站的距离差允许的范围
|
|
|
+const double VECHILE_ACCELERATE_THRESHOLD = 10; // 校验加速度阈值
|
|
|
+const double PERSON_ACCELERATE_THRESHOLD = 10; // 校验速度阈值
|
|
|
const int ACCELERATE_INIT_STATE = -10;
|
|
|
const double INVALID_COORDINATE = -1000.0;
|
|
|
-const double CHAMBER_WIDTH = 10.0; //特指前端展现巷道的宽度,单位为像素
|
|
|
+
|
|
|
+const double CHAMBER_WIDTH = 3.0; //特指前端展现巷道的宽度,单位为像素
|
|
|
const double VEHICLE_WIDTH = 10.0;
|
|
|
const int MAX_READER_TDOA_PATH_NUMS = 10; //主要是因为拐弯处可能存在多解的原因
|
|
|
const int LIGHT_CTRL_DELAY = 1000;
|
|
|
const int MAX_REBOUND_COUNTS = 5;
|
|
|
|
|
|
+const double TOF_HEIGHT_ERROR = 2; //tof定位时的高度误差,单位为米
|
|
|
+const double READER_SYNC_INTERVAL_TIME = 0.2; //分站同步序号的时间差,估计值
|
|
|
+
|
|
|
#define OFFSET_THRE_IN_LINE 1 //判断是否在线段上,允许的误差为1米,用于isinline
|
|
|
#define ZERO_PRECISION 1E-3 //为零的精度
|
|
|
#define MAX_REBOUND_COUNTS 5
|
|
@@ -93,7 +103,9 @@ enum ALARM_FLAG{
|
|
|
AF_AREA_OVER_COUNT,
|
|
|
AF_AREA_OVER_TIME,
|
|
|
AF_AREA_FORBIDDEN,
|
|
|
- AF_CARD_OVER_COUNT
|
|
|
+ AF_CARD_OVER_COUNT,
|
|
|
+ AF_CARD_NEAR_WARNING_POINT,//lemon
|
|
|
+ AF_CARD_NEAR_DRRIVINGFACE_VEHICLE //lemon 2017/08/01
|
|
|
};
|
|
|
|
|
|
enum AREA_TYPE
|
|
@@ -108,7 +120,12 @@ enum EDIT_TYPE_ID{
|
|
|
ET_UPDATE, // 修改
|
|
|
ET_DELETE // 删除
|
|
|
};
|
|
|
-
|
|
|
+//车辆烈性
|
|
|
+enum VECHILE_TYPE_ID
|
|
|
+{
|
|
|
+ VT_DIGGINGCOAL_MACHINE=25,
|
|
|
+ VT_DRIVINGFACE_MACHINE=26
|
|
|
+};
|
|
|
enum ALARM_TYPE_ID
|
|
|
{
|
|
|
ATID_OVER_COUNT_PERSON = 1,
|
|
@@ -209,6 +226,7 @@ enum LIGHT_SHAPE{
|
|
|
};
|
|
|
|
|
|
enum LIGHT_STREAM{
|
|
|
+ INIT_STREAM = 0,
|
|
|
UP_STREAM = 1, //上行
|
|
|
DOWN_STREAM = 2 //下行
|
|
|
};
|
|
@@ -288,6 +306,7 @@ enum ALGO_RETURN_VALUE{
|
|
|
ALGO_CALC_ONE_DATA,
|
|
|
|
|
|
SOLUTION_NO_SOLUTION = 40001,
|
|
|
+ SOLUTION_NOT_EXIST_READRE,
|
|
|
SOLUTION_NEAR_READER,
|
|
|
SOLUTION_TWO_SOLUTION,
|
|
|
SOLUTION_ERROR_STREAM,
|
|
@@ -299,7 +318,8 @@ enum ALGO_RETURN_VALUE{
|
|
|
|
|
|
KALMAN_FILTER_LONG_INTERVAL = 60001,
|
|
|
|
|
|
- ALGO_USE_KALMAN_FILTER = 70001
|
|
|
+ ALGO_USE_KALMAN_FILTER = 70001,
|
|
|
+ ALGO_DIVIDE_ZERO = 80001,
|
|
|
};
|
|
|
|
|
|
extern unsigned int g_nAlgoFailedCounts[ALGO_LOC_TOTAL]; //全局的统计所有次数
|
|
@@ -338,9 +358,14 @@ enum CALL_STATE{
|
|
|
CALL_NONE = 0, //无呼叫信息
|
|
|
CALL_SUCCESSED = 1, //呼叫成功
|
|
|
CALL_ING = 2, //呼叫中
|
|
|
- CALL_FAILED = 3 //呼叫失败
|
|
|
+ CALL_FAILED = 3, //呼叫失败
|
|
|
};
|
|
|
|
|
|
+enum LOCATEDATATYPE // 定位数据类型
|
|
|
+{
|
|
|
+ LDT_TOF = 0,
|
|
|
+ LDT_TDOA
|
|
|
+};
|
|
|
struct SQLTHREAD_DATA//写数据库线程传递的参数
|
|
|
{
|
|
|
char* pText;//数据库语句地址指针
|
|
@@ -368,11 +393,12 @@ struct _coordinate{
|
|
|
acce_state = 0;
|
|
|
acce_state_last = 0;
|
|
|
ins_direction = 0;
|
|
|
+ rangingtype = 1; // 0 tof,1 toda
|
|
|
}
|
|
|
int t; // 定位时间戳
|
|
|
- int reader_id;
|
|
|
- unsigned long long syncRootId;
|
|
|
- unsigned long long tt;
|
|
|
+ int reader_id; // 分站编号
|
|
|
+ unsigned long long syncRootId; // tdoa主节点
|
|
|
+ unsigned long long tt; // 分站接收的时间,为同步及线性插值后的时间
|
|
|
double d; // 距离
|
|
|
|
|
|
double x; // x坐标
|
|
@@ -390,6 +416,8 @@ struct _coordinate{
|
|
|
int ins_direction; //惯导方向
|
|
|
int special; //分站是否属于特殊分站,0属于特殊分站,1普通分站
|
|
|
|
|
|
+ int rangingtype;
|
|
|
+
|
|
|
int reason;
|
|
|
|
|
|
_coordinate& operator=(_coordinate &tmp){
|
|
@@ -410,6 +438,7 @@ struct _coordinate{
|
|
|
acce_state = tmp.acce_state;
|
|
|
acce_state_last = tmp.acce_state_last;
|
|
|
ins_direction = tmp.ins_direction;
|
|
|
+ rangingtype = tmp.rangingtype;
|
|
|
reason = ALGO_LOC_SUCCESSED;
|
|
|
return *this;
|
|
|
}
|
|
@@ -523,6 +552,27 @@ struct INFO_PRE{
|
|
|
int sta_num;
|
|
|
};
|
|
|
|
|
|
+struct TOF_REFER_DATA{
|
|
|
+ unsigned int nCardTimeStamp; // 卡的ct号
|
|
|
+ long long llDeltaTime; //
|
|
|
+ double dDistance; // 距离
|
|
|
+ unsigned int nAntennaIndex; // 分站天线索引号
|
|
|
+ unsigned int nReaderId; // 分站id
|
|
|
+ double x; // 参考点x坐标
|
|
|
+ double y; // 参考点y坐标
|
|
|
+ double z; // 参考点z坐标
|
|
|
+ int a; // 加速度状态
|
|
|
+
|
|
|
+ TOF_REFER_DATA(){
|
|
|
+ nCardTimeStamp = 0;
|
|
|
+ llDeltaTime = 0;
|
|
|
+ dDistance = 0.0;
|
|
|
+ nAntennaIndex = nReaderId = 0;
|
|
|
+ x = y = z = 0.0;
|
|
|
+ a = 0;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
struct POS{
|
|
|
double posx;
|
|
|
double posy;
|
|
@@ -556,6 +606,8 @@ struct POS{
|
|
|
|
|
|
//当前分站同步序号与参考数据的分站同步序号时间差值
|
|
|
double diff_reader_sync_num;
|
|
|
+
|
|
|
+ double delta_time; //时间差
|
|
|
//参考数据的定位坐标
|
|
|
double ref_x;
|
|
|
double ref_y;
|
|
@@ -567,7 +619,7 @@ struct POS{
|
|
|
POS(){
|
|
|
nFirstReader = 0;
|
|
|
nSecondReader = 0;
|
|
|
- pos_radius = 0;
|
|
|
+ pos_radius = 999999.9;
|
|
|
posx = posy = posz = INVALID_COORDINATE;
|
|
|
cx = cy = cz = cvx = cvy = cvz = 0.0;
|
|
|
av = 0.0;
|
|
@@ -577,7 +629,7 @@ struct POS{
|
|
|
{
|
|
|
dDiff[i] = 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
dis_diff = 999999.9;
|
|
|
update = false;
|
|
|
is_fit = false;
|
|
@@ -585,6 +637,7 @@ struct POS{
|
|
|
origin_speed = 0;
|
|
|
sumVariance = 0;
|
|
|
diff_reader_sync_num = 0;
|
|
|
+ delta_time = 0.0;
|
|
|
ref_x = ref_y = ref_z = 0;
|
|
|
reason = -1;
|
|
|
reason = ALGO_LOC_SUCCESSED;
|
|
@@ -608,6 +661,7 @@ struct POS{
|
|
|
status = tmp.status;
|
|
|
is_back = tmp.is_back;
|
|
|
diff_reader_sync_num = tmp.diff_reader_sync_num;
|
|
|
+ delta_time = tmp.delta_time;
|
|
|
dis_diff = tmp.dis_diff;
|
|
|
ref_x = tmp.ref_x;
|
|
|
ref_y = tmp.ref_y;
|
|
@@ -644,7 +698,9 @@ class Mine;
|
|
|
class Area;
|
|
|
class SpecialAreaEntry;
|
|
|
class DrivingfaceRender;
|
|
|
+class DrivingfaceCard;
|
|
|
class DrivingfaceWarningPoint;
|
|
|
+class VehicleTypeAttRule;
|
|
|
class Reader;
|
|
|
class Card;
|
|
|
class MapInfo;
|
|
@@ -654,6 +710,7 @@ class OccLevel;
|
|
|
class ReaderPath;
|
|
|
class PatrolPoint;
|
|
|
class PatrolTask;
|
|
|
+class LeaderArrange;
|
|
|
|
|
|
class Section;
|
|
|
class Chamber;
|
|
@@ -668,8 +725,10 @@ class MapDirectionInfo;
|
|
|
typedef map<string, std::shared_ptr<Card>> CardMap;
|
|
|
typedef map<int, std::shared_ptr<Area>> AreaMap;
|
|
|
typedef map<int, std::shared_ptr<DrivingfaceWarningPoint>>DrivingfaceWarningPointMap;
|
|
|
+typedef map<int,std::vector<std::shared_ptr<DrivingfaceWarningPoint>>> DrivingfaceWarningPointMapAll;
|
|
|
typedef map<int, std::shared_ptr<SpecialAreaEntry>> SpecilaAreaEntryMap;
|
|
|
typedef map<int, std::shared_ptr<DrivingfaceRender>> DrivingfaceRenderMap;
|
|
|
+typedef map<string,std::shared_ptr<DrivingfaceCard>> DrivingfaceCardMap;
|
|
|
typedef map<int, std::shared_ptr<Reader>> ReaderMap;
|
|
|
typedef map<int, std::shared_ptr<MapInfo>> MapInfoMap;
|
|
|
typedef map<int, std::shared_ptr<MapDirectionInfo>>MapDirectionInfoMap;
|
|
@@ -679,6 +738,7 @@ typedef map<int, std::shared_ptr<BanShift>> BanShiftMap;
|
|
|
typedef map<int, std::shared_ptr<OccLevel>> OccLevelMap;
|
|
|
typedef map<int, string> AlarmTypeMap;
|
|
|
typedef map<int,std::shared_ptr<ReaderPath>> ReaderPathMap;
|
|
|
+typedef map<int,std::shared_ptr<ReaderPath>> TOFReaderPathMap;
|
|
|
typedef unordered_map<int,std::shared_ptr<ReaderPathMap>> TDOAReaderPathMap;
|
|
|
typedef unordered_map<std::string, std::shared_ptr<_coordinate>> DistMap;
|
|
|
typedef map<unsigned long long ,std::shared_ptr<ReceiveData>> ReceiveDataMap;
|
|
@@ -693,21 +753,25 @@ typedef map<unsigned int, std::shared_ptr<PatrolPoint>> PatrolPointMap;
|
|
|
typedef map<unsigned int, std::shared_ptr<PatrolTask>> PatrolTaskMap;
|
|
|
typedef map<std::string, std::shared_ptr<PatrolTask>> PatrolTaskCheckMap;
|
|
|
typedef deque<std::shared_ptr<StorePostion>> QueStrorePos;
|
|
|
+typedef map<std::string, std::shared_ptr<LeaderArrange>> LeaderArrangeMap;
|
|
|
+typedef map<int,string> WorkTypePermissionMap;
|
|
|
+typedef map<int,int> RulesMap; //lemon 2017/08/01
|
|
|
+typedef map<int, std::shared_ptr<VehicleTypeAttRule>> VehicleTypeAttRuleMap;
|
|
|
|
|
|
typedef std::map<std::string,std::list<std::shared_ptr<Cell>>> CellPathMap;
|
|
|
|
|
|
typedef struct key_value_pair
|
|
|
{
|
|
|
- int key;
|
|
|
- int value;
|
|
|
- struct key_value_pair* next;
|
|
|
+ int key;
|
|
|
+ int value;
|
|
|
+ struct key_value_pair* next;
|
|
|
}KeyValuePair;
|
|
|
|
|
|
typedef struct statistic_data_str
|
|
|
{
|
|
|
- int index;
|
|
|
- KeyValuePair* data_info;
|
|
|
- struct statistic_data_str* next;
|
|
|
+ int index;
|
|
|
+ KeyValuePair* data_info;
|
|
|
+ struct statistic_data_str* next;
|
|
|
}StatisticDataStr;
|
|
|
|
|
|
struct DistQueMapItem
|
|
@@ -745,8 +809,8 @@ public:
|
|
|
class LandmarkInfo
|
|
|
{
|
|
|
public:
|
|
|
- int landmark_id;
|
|
|
- string landmark_name;
|
|
|
+ int landmark_id;
|
|
|
+ string landmark_name;
|
|
|
int map_id;
|
|
|
double x;
|
|
|
double y;
|
|
@@ -756,9 +820,9 @@ public:
|
|
|
class MapDirectionInfo
|
|
|
{
|
|
|
public:
|
|
|
- int map_direction_id;
|
|
|
- int map_id;
|
|
|
- int north_angle;
|
|
|
+ int map_direction_id;
|
|
|
+ int map_id;
|
|
|
+ int north_angle;
|
|
|
};
|
|
|
// 区域
|
|
|
class Area // 矩形
|
|
@@ -865,12 +929,25 @@ class DrivingfaceRender
|
|
|
public:
|
|
|
DrivingfaceRender(){}
|
|
|
public:
|
|
|
- INT drivingface_id;
|
|
|
- INT reader_id;
|
|
|
- double vertical_distance;
|
|
|
- double x;
|
|
|
- double y;
|
|
|
- double z;
|
|
|
+ INT drivingface_id;
|
|
|
+ INT reader_id;
|
|
|
+ double vertical_distance;
|
|
|
+ double x;
|
|
|
+ double y;
|
|
|
+ double z;
|
|
|
+};
|
|
|
+
|
|
|
+// 工作面与卡绑定信息
|
|
|
+class DrivingfaceCard
|
|
|
+{
|
|
|
+public:
|
|
|
+ double x;
|
|
|
+ double y;
|
|
|
+ double z;
|
|
|
+ INT drivingface_id;
|
|
|
+ string card_id;
|
|
|
+ INT area_id;
|
|
|
+ float warning_threshold;
|
|
|
};
|
|
|
|
|
|
// 自组网预置坐标
|
|
@@ -967,38 +1044,34 @@ class Card
|
|
|
public:
|
|
|
Card(void);
|
|
|
~Card(void);
|
|
|
- Card(string cardid, int cardtype,double z_offset, double offset_x = 12.0, double offset_y =12.0);
|
|
|
+ Card(string cardid, int cardtype,double z_offset);
|
|
|
|
|
|
public:
|
|
|
CRITICAL_SECTION m_csCard;
|
|
|
+ bool is_registered;
|
|
|
public:
|
|
|
int card_type; // 卡类型 0x01人, 0x02车
|
|
|
- //int64_t card_id; // 卡唯一标识, 高位为卡号,低位为卡类型, ((card_id << 8) | card_type)
|
|
|
string card_id;
|
|
|
-
|
|
|
+
|
|
|
// 人员
|
|
|
- string level; // 级别
|
|
|
- string occupation; // 职务
|
|
|
+ int level_id;
|
|
|
+ int worktype_id;// 工种lemon 2017/07/31 车辆为vehicle_type_id
|
|
|
+ int vehice_type_id;
|
|
|
// 人员、车辆
|
|
|
- string id; // 编号,人员或车辆
|
|
|
- string name; // 姓名、车辆名称
|
|
|
- string number; // 身份证号码,车牌号码
|
|
|
- //string photo; // 照片
|
|
|
- //string company; // 单位
|
|
|
- string department; // 部门
|
|
|
- string group; // 班组
|
|
|
- string worktype; // 工种、车辆类型
|
|
|
- int dept_id;
|
|
|
+ int id; // 编号,人员或车辆
|
|
|
+ int dept_id; // 部门
|
|
|
int occlevel_id; // 职务id
|
|
|
- int group_id;
|
|
|
-
|
|
|
- string driver_id; //如果是车辆,则有司机id
|
|
|
- int light_id;
|
|
|
+ int group_id; // 班组
|
|
|
+ int need_display;// lemon 2071/08/01 是否在Web端显示
|
|
|
+ int shift_type_id; // 人员或者车辆执行的班次类型
|
|
|
|
|
|
- //time_t deal_time; // 最后处理卡逻辑时间
|
|
|
- SYSTEMTIME deal_time;
|
|
|
+ string driver_id; //如果是车辆,则有司机id
|
|
|
+ int light_id; // 闯红灯的灯编号
|
|
|
+ int shift_id;
|
|
|
+ SYSTEMTIME deal_time; // 最后处理卡逻辑时间
|
|
|
SYSTEMTIME enter_area_time;
|
|
|
-
|
|
|
+ //
|
|
|
+ int m_indexForRcvOneReader;
|
|
|
//driving face write database time
|
|
|
ULONGLONG drive_face_location_write_time;
|
|
|
ULONGLONG drive_face_location_end_time;
|
|
@@ -1013,38 +1086,30 @@ public:
|
|
|
double x;
|
|
|
double y;
|
|
|
double z;
|
|
|
-
|
|
|
- //double driving_face_x; //cur shift start point
|
|
|
- //double driving_face_y;
|
|
|
- //double driving_face_z;
|
|
|
+ //查看掘进机变量是否为初始化值,如果是不进行插入库操作
|
|
|
+ bool is_drivingface_Initialization;
|
|
|
|
|
|
int driving_face_id;
|
|
|
double driving_face_cur_shift_start_x; //cur shift start position
|
|
|
double driving_face_cur_shift_start_y;
|
|
|
double driving_face_cur_shift_start_z;
|
|
|
-
|
|
|
+
|
|
|
double driving_face_cur_shift_x; //cur shift real point
|
|
|
double driving_face_cur_shift_y;
|
|
|
double driving_face_cur_shift_z;
|
|
|
|
|
|
double drving_face_cur_shift_max_speed;
|
|
|
-
|
|
|
+
|
|
|
double a; // 上次定位时的角度
|
|
|
int t; // 上次定位时的时间戳
|
|
|
+
|
|
|
+ double v; //速度
|
|
|
+ double mileage; // 里程,距离上次保存数据时的距离
|
|
|
double z_offset;
|
|
|
bool init_postion;
|
|
|
bool is_first_location;
|
|
|
int is_driving_face_start;
|
|
|
- double v; //速度
|
|
|
- double mileage;
|
|
|
|
|
|
- double xx;
|
|
|
- double yy;
|
|
|
- double zz;
|
|
|
-
|
|
|
- double x1, x2, x3, x4;
|
|
|
- double y1, y2, y3, y4;
|
|
|
- double z1, z2, z3, z4;
|
|
|
double right_x,right_y,right_z; //分别指卡位置右边偏移的x,y,z坐标
|
|
|
double left_x,left_y,left_z; //分别指卡位置左边偏移的x,y,z坐标
|
|
|
|
|
@@ -1052,6 +1117,9 @@ public:
|
|
|
double last_y;
|
|
|
double last_z;
|
|
|
|
|
|
+ double last_offset_x;
|
|
|
+ double last_offset_y;
|
|
|
+
|
|
|
double stored_x;
|
|
|
double stored_y;
|
|
|
double stored_z;
|
|
@@ -1063,8 +1131,8 @@ public:
|
|
|
double last_vy;
|
|
|
|
|
|
int state; // 0 正常, 共32bit,每个bit代表一个状态,从右起:
|
|
|
- // 第一位 0x01 井下超时, 第二位 0x02 区域超时, 第三位 0x04 超速, 第四位 0x08, 进入限制区域
|
|
|
- // 状态,故障、电量低等
|
|
|
+ // 第一位 0x01 井下超时, 第二位 0x02 区域超时, 第三位 0x04 超速, 第四位 0x08, 进入限制区域
|
|
|
+ // 状态,故障、电量低等
|
|
|
int state_moving; // 运动状态, 0 静止,1 启动
|
|
|
|
|
|
// 电量低、 呼叫、呼救
|
|
@@ -1077,7 +1145,7 @@ public:
|
|
|
int status_call; // 0 未呼叫 1 呼叫
|
|
|
int status_power; // 0 电量正常,1 电量低
|
|
|
int status_lost; // 0 未进入盲区,1 盲区状态
|
|
|
-
|
|
|
+
|
|
|
int map_id; // 当前地图
|
|
|
double map_scale; // 地图比例尺
|
|
|
int map_id_old; // 上次测距所在地图
|
|
@@ -1088,15 +1156,12 @@ public:
|
|
|
int reader_id; // 当前分站
|
|
|
|
|
|
Reader* p_reader;
|
|
|
- std::shared_ptr<ReaderPathMap> pReaderPathMap;
|
|
|
+ std::shared_ptr<ReaderPathMap> pTofReaderPathMap;
|
|
|
std::shared_ptr<TDOAReaderPathMap> pTdoaReaderPathMap;
|
|
|
- _coordinate** p_dists_locate;
|
|
|
map<unsigned long long,std::shared_ptr<_coordinate>> mp_dists_locate;
|
|
|
+ _coordinate** p_dists_locate;
|
|
|
_coordinate last_locate;
|
|
|
_coordinate origin_locate;
|
|
|
- _coordinate kalman_locate;
|
|
|
- double m_dFirstDiff;
|
|
|
- double m_dSecondDiff;
|
|
|
|
|
|
QueStrorePos _storepostions;
|
|
|
DistQueMap _dists;
|
|
@@ -1112,34 +1177,38 @@ public:
|
|
|
int m_nMoveDirection; //1为正向运动,-1为负向运动
|
|
|
int m_nIsRailroad; //是否为有轨车,0为无轨车,1为有轨车
|
|
|
int m_nOutputPosState; //0为正常输出中间坐标,1为输出靠左偏移坐标,2为输出靠右偏移坐标
|
|
|
+ bool bIsBack;
|
|
|
|
|
|
bool issent; // true 已发送至客户端,false 新数据,需要发送至客户端
|
|
|
bool issaved; //true 已保存到数据库,false 生成新的考勤记录,需要保存到数据库
|
|
|
bool isdealed; // 已经处理
|
|
|
bool isreceive; // 接收到
|
|
|
bool is_pos_changed;
|
|
|
- bool is_deal_by_algo;
|
|
|
+ bool is_deal_by_algo; //是否经过算法处理
|
|
|
bool is_hist;
|
|
|
bool is_need_cal;
|
|
|
+
|
|
|
bool m_bUseFilter;
|
|
|
bool isoutput; //是否输出到json
|
|
|
bool is_red_light;
|
|
|
|
|
|
bool is_mine_over_time; // 是否井下超时
|
|
|
- bool is_mine_over_speed;
|
|
|
+ bool is_mine_over_speed; // 是否井下超速
|
|
|
+
|
|
|
bool is_area_over_time; // 是否区域超时, 区域超时分车辆超时、人员超时
|
|
|
bool is_area_over_speed; // 是否区域超速
|
|
|
-
|
|
|
+
|
|
|
time_t time_area_over_time; // 区域超时开始时间
|
|
|
time_t time_over_time; // 井下超时开始时间
|
|
|
time_t time_area_forbidden; // 进入限制区域时间
|
|
|
time_t time_over_speed; // 超速开始时间
|
|
|
time_t time_area_over_speed;
|
|
|
time_t time_low_power;
|
|
|
+
|
|
|
time_t time_red_light; //闯红灯时间
|
|
|
time_t last_locate_time; // 最后定位时间
|
|
|
|
|
|
- void reset();
|
|
|
+ void reset(); // 重置所有状态
|
|
|
void set_reader(std::shared_ptr<Reader> preader);
|
|
|
void add_dist(_coordinate* dist);
|
|
|
void add_dist(std::shared_ptr<_coordinate> dist);
|
|
@@ -1151,8 +1220,7 @@ public:
|
|
|
double get_speed();
|
|
|
void set_speed(double v);
|
|
|
int get_effictive_dist_count(int offset = 0);
|
|
|
- void set_reader_path_tof(std::shared_ptr<ReaderPathMap> rpm);
|
|
|
- void set_reader_path_tdoa(std::shared_ptr<TDOAReaderPathMap> trpm);
|
|
|
+ void set_reader_path(std::shared_ptr<ReaderPathMap> rpm, std::shared_ptr<TDOAReaderPathMap> trpm);
|
|
|
void inspect_coordinate(int acce_state);
|
|
|
bool checkStream(double x1,double y1,double x2,double y2,int nStream);
|
|
|
|
|
@@ -1163,6 +1231,21 @@ public:
|
|
|
int const StateBiz();
|
|
|
|
|
|
INT64 m_event_list[CARD_EVENT_COUNT]; // 保存事件Id
|
|
|
+public://lemon
|
|
|
+ int m_warning_point_id;
|
|
|
+ bool m_isWarning; // 0
|
|
|
+ double m_minDistanceToWarningpoint; //
|
|
|
+ double m_warning_threshold; //limit value
|
|
|
+ bool m_CardHasBeenInDrivingfaceAlarm;
|
|
|
+ int m_DrivingfaceAlarmFlag;
|
|
|
+ //lemon 2017/08/01
|
|
|
+ inline double getDrivingfaceCulValue(){return m_drivingface_distance_cul_values;}
|
|
|
+ inline double getDrivingfaceLimitValue(){return m_drivingface_distance_limit_values;}
|
|
|
+ inline void setDrivingfaceCulValue(double cvalue){m_drivingface_distance_cul_values = cvalue;}
|
|
|
+ inline void setDrivingfaceLimitValue(double lvalue){m_drivingface_distance_limit_values = lvalue;}
|
|
|
+private:
|
|
|
+ double m_drivingface_distance_cul_values;
|
|
|
+ double m_drivingface_distance_limit_values;
|
|
|
public:
|
|
|
//算法相关参数及函数
|
|
|
bool is_algo_first_location; //表示算法的第一次定位
|
|
@@ -1171,25 +1254,31 @@ public:
|
|
|
std::list<std::shared_ptr<POS>> idle_pos_list;
|
|
|
|
|
|
void algo_tof(int cnt);
|
|
|
+ int algo_tof_1d(int cnt); // tof一维定位
|
|
|
void algo_tdoa(int cnt);
|
|
|
+
|
|
|
int algo_tdoa_1d(int cnt); //一维定位
|
|
|
int algo_tdoa_2d(int cnt); //二维定位
|
|
|
int algo_tdoa_3d(int cnt); //三维定位
|
|
|
|
|
|
void algo_calc_offset(); //计算偏移坐标
|
|
|
+ double x_offset_after(); //返回偏移后的X坐标
|
|
|
+ double y_offset_after(); //返回偏移后的Y坐标
|
|
|
+ double z_offset_after(); //返回偏移后的Z坐标
|
|
|
bool algo_is_same_direction(double x,double y,double z); //检查此次方向
|
|
|
|
|
|
int CheckDistData(int cnt);
|
|
|
int AssembleDistData(std::shared_ptr<ReceiveDataMap> pRdm);
|
|
|
int SaveCardAlgoData(std::shared_ptr<POS>& pos);
|
|
|
- int SaveCardAlgoData(std::shared_ptr<Cell>& cell);
|
|
|
+ int SaveTofData(const std::shared_ptr<POS> pos);
|
|
|
+ int SaveTdoaData(const std::shared_ptr<POS> pos);
|
|
|
int SaveOriginDataBeforeFilter(std::shared_ptr<POS> pos);
|
|
|
int ChooseOneSolution(std::shared_ptr<ReceiveDataMap> pRdm, std::vector<std::shared_ptr<POS>> udm_pos, std::shared_ptr<POS>& pos);// 输出唯一解
|
|
|
- int CheckSolution(std::shared_ptr<POS>& p); // 验证唯一解合法性,如速度、加速度
|
|
|
- int CheckSulutionByStream(std::shared_ptr<POS> p); //参数使用非引用,即不可修改其值
|
|
|
- int GetStream(double x1,double y1,double x2,double y2); //获得上下行方向
|
|
|
- int CalcPositionBySpeed(std::shared_ptr<POS>& pos,double v);
|
|
|
|
|
|
+ int CheckSolution(std::shared_ptr<POS>& p); // 验证唯一解合法性,如速度、加速度
|
|
|
+ int CheckSulutionByStream(std::shared_ptr<POS> p); // 参数使用非引用,即不可修改其值
|
|
|
+ int GetStream(double x1,double y1,double x2,double y2); // 获得上下行方向
|
|
|
+ int CalcPositionBySpeed(std::shared_ptr<POS>& pos,double v);
|
|
|
bool CheckStreamUniformity(double x1,double y1,double x2,double y2,int nStream);
|
|
|
bool IsExistPath(int left,int right);
|
|
|
int CopySolution(std::shared_ptr<POS> source,std::shared_ptr<POS>& dest);
|
|
@@ -1198,10 +1287,20 @@ public:
|
|
|
int CheckCardStatus();
|
|
|
bool IsIdleStatus(std::shared_ptr<POS> pos);
|
|
|
bool IsRebound(std::shared_ptr<POS> pos); //判断是否回退
|
|
|
+ bool CheckPositionValid(const std::shared_ptr<POS> pos); //检查解的有效性
|
|
|
|
|
|
+ double GetDeltaT(); //获取时间差值
|
|
|
+public:
|
|
|
+ //tof相关变量及函数
|
|
|
+ time_t time_last_tof;
|
|
|
+
|
|
|
+ bool CheckSolutionTof(std::shared_ptr<POS>& pos); //通过速度及加速度检查定位结果是否正确
|
|
|
+private:
|
|
|
+ void set_reader_path_tof(std::shared_ptr<ReaderPathMap> rpm); // 设置tof路径集
|
|
|
+ void set_reader_path_tdoa(std::shared_ptr<TDOAReaderPathMap> trpm); // 设置tdoa路径集
|
|
|
public:
|
|
|
// 滤波算法相关
|
|
|
- std::unique_ptr<CKalmanFilter> m_pKalmanFilter;
|
|
|
+ std::unique_ptr<CKalmanFilter> m_pKalmanFilter; // 卡尔曼滤波器
|
|
|
list<sync_data> m_syncNumList;
|
|
|
std::list<std::shared_ptr<POS>> his_idle_pos;
|
|
|
|
|
@@ -1255,7 +1354,7 @@ public:
|
|
|
double long_fitting_ct[REF_POSITION_NUM];
|
|
|
double long_fitting_x[REF_POSITION_NUM];
|
|
|
double long_fitting_y[REF_POSITION_NUM];
|
|
|
-
|
|
|
+
|
|
|
double long_fit_new_x[FIT_POSITION_NUM*4];
|
|
|
double long_fit_new_y[FIT_POSITION_NUM*4];
|
|
|
|
|
@@ -1275,14 +1374,25 @@ public:
|
|
|
private:
|
|
|
bool b_long_interval; //上一次定位的间隔时间差大于10s
|
|
|
|
|
|
- int state_biz; //业务状态,呼叫/超时/进入禁区等
|
|
|
+ int state_biz; //业务状态,呼叫/超时/进入禁区等
|
|
|
|
|
|
- int pos_state; // 位置状态,0初始化,1井下,2井上,3车场分站
|
|
|
+ int pos_state; // 位置状态,0初始化,1井下,2井上,3车场分站
|
|
|
int pos_state_old;
|
|
|
- int pos_state_count; // 当前位置状态确认次数
|
|
|
- int pos_state_confirm_times; // 井下、井上状态确认次数,默认为1
|
|
|
-public:
|
|
|
- AlgoFailedMsg m_afmData;
|
|
|
+ int pos_state_count; // 当前位置状态确认次数
|
|
|
+ int pos_state_confirm_times; // 井下、井上状态确认次数,默认为1
|
|
|
+
|
|
|
+public: // 采集到的底层数据
|
|
|
+ int time_stamp_last; // 定位时间戳
|
|
|
+ int context_type_last; // 报文类型 tof,tdoa
|
|
|
+ int accelerate_state_last; // 上一次加速度状态
|
|
|
+ int antenna_id_last; // 天线号
|
|
|
+ double antenna_angle_last; // 天线角度
|
|
|
+ double distance_last; // 距离
|
|
|
+ int64_t flying_time_last; // 飞行时间
|
|
|
+ int power_state_last; // 电量
|
|
|
+ int ins_direction; //上一次的惯导合成方向
|
|
|
+ int direction; //上下行概念
|
|
|
+ int reader_id_last; //上一次定位时间戳的分站id
|
|
|
public:
|
|
|
bool b_pos_change; //位置发生了改变
|
|
|
bool b_enter_intersection; //车辆是否进入过路口区域
|
|
@@ -1298,20 +1408,16 @@ public: //
|
|
|
int power_state; // 电量
|
|
|
int sync_num;
|
|
|
|
|
|
- int time_stamp_last; // 定位时间戳
|
|
|
- int context_type_last; // 报文类型 tof,tdoa
|
|
|
- int accelerate_state_last; // 上一次加速度状态
|
|
|
- int antenna_id_last; // 天线号
|
|
|
- double antenna_angle_last; // 天线角度
|
|
|
- double distance_last; // 距离
|
|
|
- int64_t flying_time_last; // 飞行时间
|
|
|
- int power_state_last; // 电量
|
|
|
- int ins_direction; //上一次的惯导合成方向
|
|
|
- int direction; //上下行概念
|
|
|
- int reader_id_last; //上一次定位时间戳的分站id
|
|
|
-
|
|
|
string str_his_time;
|
|
|
string str_rec_time;
|
|
|
+ //呼叫信息
|
|
|
+ int call_type;
|
|
|
+ std::vector<int> vt_deal_call_reader_id;
|
|
|
+ time_t recv_call_time; //卡接收到呼叫的时间戳
|
|
|
+
|
|
|
+public:
|
|
|
+ //测试及统计功能
|
|
|
+ AlgoFailedMsg m_afmData;
|
|
|
|
|
|
public:
|
|
|
//格子算法的代码
|
|
@@ -1348,11 +1454,9 @@ public:
|
|
|
std::shared_ptr<Cell> last_cell;
|
|
|
std::list<std::shared_ptr<Cell>> his_cell;
|
|
|
std::list<std::shared_ptr<Cell>> locate_cells;
|
|
|
-
|
|
|
|
|
|
int DiscreteLocate(int cnt);
|
|
|
int PersonLocation(int cnt);
|
|
|
-
|
|
|
bool CheckIdleStatus();
|
|
|
bool CheckStartRule();
|
|
|
bool isOverThreshold();
|
|
@@ -1370,7 +1474,8 @@ public:
|
|
|
int colourfulCloudsChasingTheMoon(std::shared_ptr<Cell> &cell, std::list<std::shared_ptr<Cell>> &myCellList);
|
|
|
int MappingCell2FitLinear(std::shared_ptr<Cell>& cell); //将格子拟合到线上
|
|
|
bool cftool(float *data_x, float *data_y, int data_n, std::vector<float> &vResult);
|
|
|
-
|
|
|
+ int SaveCardAlgoData(std::shared_ptr<Cell>& cell);
|
|
|
+
|
|
|
//刘思平修订的代码Part 3/Sum 3:begin
|
|
|
//以下函数的声明:将当前时刻的毫秒四舍五入为0ms或者500ms
|
|
|
//by lsp on 2017.07.09 @山西长治
|
|
@@ -1389,12 +1494,6 @@ public:
|
|
|
|
|
|
double dTestDelatT; //测试时间差
|
|
|
double dTestDistance; //测试两次的定位的距离差
|
|
|
-public:
|
|
|
-
|
|
|
- //呼叫信息
|
|
|
- int call_type;
|
|
|
- std::vector<int> vt_deal_call_reader_id;
|
|
|
- time_t recv_call_time; //卡接收到呼叫的时间戳
|
|
|
};
|
|
|
|
|
|
class BanShift
|
|
@@ -1402,12 +1501,27 @@ class BanShift
|
|
|
public:
|
|
|
BanShift();
|
|
|
~BanShift();
|
|
|
- BanShift(int id, std::string s, std::string e);
|
|
|
+ BanShift(int id, std::string s, std::string e, int tid);
|
|
|
int shift_id;
|
|
|
+ int shift_type_id;
|
|
|
std::string start_time;
|
|
|
std::string end_time;
|
|
|
};
|
|
|
|
|
|
+class LeaderArrange
|
|
|
+{
|
|
|
+public:
|
|
|
+ LeaderArrange( string cardid);
|
|
|
+ ~ LeaderArrange();
|
|
|
+
|
|
|
+ int staff_id;
|
|
|
+ string card_id;
|
|
|
+ int shift_id;
|
|
|
+ int shift_type_id;
|
|
|
+ time_t starttime;
|
|
|
+ time_t endtime;
|
|
|
+};
|
|
|
+
|
|
|
class Dept
|
|
|
{
|
|
|
public:
|
|
@@ -1418,7 +1532,7 @@ private:
|
|
|
public:
|
|
|
int dept_id;
|
|
|
string dept_name;
|
|
|
-
|
|
|
+
|
|
|
CardMap dept_card_list_person;
|
|
|
CardMap dept_card_list_vehicle;
|
|
|
};
|
|
@@ -1438,7 +1552,7 @@ public:
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
- * 地图集路径描述
|
|
|
+* 地图集路径描述
|
|
|
*/
|
|
|
class ReaderPath{
|
|
|
public:
|
|
@@ -1446,7 +1560,7 @@ public:
|
|
|
bIsInit = false;
|
|
|
nRealCalcPoints = 0;
|
|
|
x[0] = x[1] = y[0] = y[1] = 0;
|
|
|
- for(int i=0;i<MAX_CALC_POINTS;i++){
|
|
|
+ for(int i = 0;i < MAX_CALC_POINTS;i++){
|
|
|
px[i] = py[i] = pz[i] = 0;
|
|
|
}
|
|
|
}
|
|
@@ -1508,7 +1622,7 @@ class LightsGroup{
|
|
|
public:
|
|
|
int m_nID;
|
|
|
int m_nState;
|
|
|
-
|
|
|
+
|
|
|
bool m_bIsUsed;
|
|
|
|
|
|
std::string m_strName;
|
|
@@ -1587,7 +1701,7 @@ public:
|
|
|
LightMap mp_light_list;
|
|
|
CardMap mp_vehicle_list;
|
|
|
CardMap mp_staffer_list;
|
|
|
-
|
|
|
+
|
|
|
INT64 m_event_list[SECTION_EVENT_COUNT];
|
|
|
public:
|
|
|
Section();
|
|
@@ -1648,8 +1762,8 @@ public:
|
|
|
|
|
|
enum EVENT_TYPE{ // 事件类型
|
|
|
ET_UNKNOWN = 0,
|
|
|
- ET_OVER_COUNT_PERSON = 1, // 井下人员超员
|
|
|
- ET_OVER_COUNT_VEHICLE = 2, // 井下车辆超员
|
|
|
+ ET_OVER_COUNT_PERSON = 1, // 井下人员超员mp_card_list_over_count_person
|
|
|
+ ET_OVER_COUNT_VEHICLE = 2, // 井下车辆超员mp_card_list_over_count_person
|
|
|
|
|
|
ET_AREA_OVER_COUNT_PERSON = 3, // 区域人员超员
|
|
|
ET_AREA_OVER_COUNT_VEHICLE = 4, // 区域车辆超员
|
|
@@ -1664,8 +1778,9 @@ enum EVENT_TYPE{ //
|
|
|
|
|
|
ET_CARD_LOW_POWER = 11, // 电量低
|
|
|
ET_CARD_LOW_POWER_SERIOUS = 12, // 电量极低
|
|
|
- ET_CARD_OVER_TIME_PERSON = 13, // 人员井下超时
|
|
|
- ET_CARD_OVER_TIME_VEHICLE = 14, // 车辆井下超时
|
|
|
+
|
|
|
+ ET_CARD_OVER_TIME_PERSON = 13, // 人员井下超时mp_card_list_over_time_person
|
|
|
+ ET_CARD_OVER_TIME_VEHICLE = 14, // 车辆井下超时mp_card_list_over_time_vehicle
|
|
|
ET_CARD_AREA_OVER_TIME_PERSON = 15, // 人员区域超时
|
|
|
ET_CARD_AREA_OVER_TIME_VEHICLE = 16, // 车辆区域超时
|
|
|
ET_CARD_AREA_LIMIT_PERSON = 17, // 人员进入限制区域
|
|
@@ -1679,8 +1794,9 @@ enum EVENT_TYPE{ //
|
|
|
ET_CARD_CALLED = 25, // 人员已被呼叫
|
|
|
ET_CARD_PATROL_ERROR = 26, // 人员巡检异常
|
|
|
ET_CARD_LOST = 27, // 标识卡信号丢失
|
|
|
- ET_CARD_DRIVINGFACE_WARNING_AREA = 28, //掘进面靠近预警区域告警
|
|
|
- CARD_EVENT_COUNT_MAX
|
|
|
+ ET_CARD_DRIVINGFACE_WARNING_AREA = 28, // 掘进面靠近预警区域告警
|
|
|
+ ET_CARD_NEAR_DRIVINGFACE_VEHICLE=29,// 人员靠近掘进机告警
|
|
|
+ CARD_EVENT_COUNT_MAX,
|
|
|
};
|
|
|
|
|
|
enum OBJECT_TYPE // 对象类型
|
|
@@ -1723,7 +1839,7 @@ public:
|
|
|
YaEvent(){};
|
|
|
YaEvent(INT64 e_id){
|
|
|
ev_id = e_id;
|
|
|
-
|
|
|
+
|
|
|
obj_id = "";
|
|
|
cur_time = time(NULL);
|
|
|
map_id = 0;
|
|
@@ -1746,7 +1862,7 @@ public:
|
|
|
OBJECT_TYPE obj_type;
|
|
|
std::string obj_id;
|
|
|
time_t cur_time;
|
|
|
-
|
|
|
+
|
|
|
int map_id;
|
|
|
int area_id;
|
|
|
double x;
|
|
@@ -1757,7 +1873,7 @@ public:
|
|
|
int landmarkid;
|
|
|
int landmarkdirect;
|
|
|
int landmarkdist;
|
|
|
-
|
|
|
+
|
|
|
bool is_sent; // 已发送
|
|
|
bool is_count;
|
|
|
|
|
@@ -1789,4 +1905,18 @@ enum DIRECTION_TYPE{
|
|
|
NORTH = 4
|
|
|
};
|
|
|
|
|
|
+class VehicleTypeAttRule
|
|
|
+{
|
|
|
+public:
|
|
|
+ VehicleTypeAttRule(int vtid, int pre, int back);
|
|
|
+ ~VehicleTypeAttRule();
|
|
|
+
|
|
|
+ int vehicle_type_id;
|
|
|
+ int offset_pre;
|
|
|
+ int offset_back;
|
|
|
+ std::vector<int> vecArea;
|
|
|
+
|
|
|
+ void Clear();
|
|
|
+ void AddArea(int area_id);
|
|
|
+};
|
|
|
#endif //YASERVER_CLASSDEF_H_
|