This commit is contained in:
lixiao 2025-05-14 14:19:43 +08:00
parent d57b3fb067
commit 75b3600a5c
15 changed files with 226 additions and 103 deletions

View File

@ -27,7 +27,7 @@
#define JUDGE_VERSION_MAJOR 1
#define JUDGE_VERSION_MINOR 0
#define JUDGE_VERSION_PATCH 3
#define JUDGE_VERSION_STAMP "2505091540b"
#define JUDGE_VERSION_STAMP "2505132200b"
#if JUDGE_USE_OLD
# undef JUDGE_VERSION_STAMP
# define JUDGE_VERSION_STAMP "2411121010b.old"

View File

@ -1,6 +1,21 @@
#include "Tools.h"
#include "HVersion.h"
#include "Loggerxx.h"
bool Tools::checkVersion(const std::string& version)
{
std::vector<std::string> ver = Tools::split(version, ".");
//int major = std::atoi(ver[0].c_str());
//int minor = std::atoi(ver[1].c_str());
//int patch = std::atoi(ver[2].c_str());
std::string v3 = ver[3];
if(v3.back() == 'b')
{
v3.pop_back();
}
return (v3 < "2505121242");
}
int64 Tools::nowTime()
{
return std::chrono::duration_cast<std::chrono::milliseconds>

View File

@ -13,6 +13,8 @@
class Tools
{
public:
static bool checkVersion(const std::string& version);
//获取当前系统时间,单位:毫秒
static int64 nowTime();
//壁钟,防止有人篡改系统时间,导致考试有些评判项目计时限时不准
@ -190,6 +192,7 @@ public:
//获取当前机器的CPU逻辑核心数
static int getCpuProcessors();
};
#endif // TOOLS_H

View File

@ -284,13 +284,35 @@ bool ExamCarSub2::examMarkItem(ExamItemCode itemNo, const std::string& serial, b
void ExamCarSub2::examNonGps(TChuanGan* cg)
{
const TGpsInfo& gps = cg->real.gps;
if(!gps.rtkEnabled || !gps.valid() || cg->real.gps.errorFlag)
const TGpsInfo* gps = nullptr;
bool ok = true;
const TGpsInfo* gps1 = &cg->real.gps;
//如果gps1异常了就直接报gps1,如gps1正常就检查gps2
if(!gps1->rtkEnabled || !gps1->valid() || gps1->errorFlag)
{
gps = gps1;
ok = false;
}
else
{
ExamCarType cartype = carType();
if(IS_A2C6(cartype))
{
const TGpsInfo* gps2 = &cg->real.gps2;
if(!gps2->rtkEnabled || !gps2->valid() || gps2->errorFlag)
{
gps = gps2;
ok = false;
}
}
}
if(!ok)
{
if(m_nontime == 0)
{
m_nontime = gps.sj;
m_nongps = gps;
m_nontime = Tools::nowTime();
m_nongps = *gps;
createEventNonGps({TNonGpsReport, m_nongps}); //上报GPS异常数据
}
else

View File

@ -268,7 +268,7 @@ bool ExamCarSub3::Init_KM3_Global()
const TDBCarInfo* carInfo = TableCarInfo->findCarInfo(carId);
if(nullptr == carInfo || carInfo->CARCLASS.empty())
{
logerror("database not find carID=%d or carClass=%p is empty, init error", carId, carInfo);
logerror("database carInfo error, carID=%d, carInfo=0x%p, carClass=%s", carId, carInfo, carInfo->CARCLASS.c_str());
return false;
}
TASSERT_BOOL(carInfo->CARCLASS == carClass(), "");
@ -409,7 +409,8 @@ bool ExamCarSub3::Init_KM3_Global()
//当前时间到达夜考时间点了
//if( (Now() - Trunc(now())) > (Car.Night_Hr / 24 + Car.Night_Mi / 24 / 60) )
DateTimex dt = Tools::nowDateTime();
if(dt.hour*60 + dt.minute >= m_car.Night_Hr*60 + m_car.Night_Mi)
//考试模式判断时间,训练模式用外壳传的参数
if((isExamMode() && (dt.hour*60 + dt.minute >= m_car.Night_Hr*60 + m_car.Night_Mi)) || (isExamDrill() && isSfyk()))
{
//如果不考模拟灯光
if(!m_stuInfo.dmndg)
@ -4405,13 +4406,35 @@ bool ExamCarSub3::examMarkItem(ExamItemCode itemNo, const std::string& serial, b
void ExamCarSub3::examNonGps(TChuanGan* cg)
{
const TGpsInfo& gps = cg->real.gps;
if(!gps.rtkEnabled || !gps.valid() || cg->real.gps.errorFlag)
const TGpsInfo* gps = nullptr;
bool ok = true;
const TGpsInfo* gps1 = &cg->real.gps;
//如果gps1异常了就直接报gps1,如gps1正常就检查gps2
if(!gps1->rtkEnabled || !gps1->valid() || gps1->errorFlag)
{
gps = gps1;
ok = false;
}
else
{
ExamCarType cartype = carType();
if(IS_A2C6(cartype))
{
const TGpsInfo* gps2 = &cg->real.gps2;
if(!gps2->rtkEnabled || !gps2->valid() || gps2->errorFlag)
{
gps = gps2;
ok = false;
}
}
}
if(!ok)
{
if(m_nontime == 0)
{
m_nontime = Tools::nowTime();
m_nongps = gps;
m_nongps = *gps;
createEventNonGps({TNonGpsReport, m_nongps}); //上报GPS异常数据
}
else
@ -5848,6 +5871,8 @@ void ExamCarSub3::Calc_LaneDistance_Tail()
{
calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.ZH_W_b_G, RTKKM3_Tail.Wheel_LB_ToBaseLine);
calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.YH_W_b_G, RTKKM3_Tail.Wheel_RB_ToBaseLine);
calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.b(RF_I), RTKKM3_Tail.Body_RF_ToBaseLine);
calcToLaneArc2(Lj, road->Area, body.b1_b_G, body.b(RB_I), RTKKM3_Tail.Body_RB_ToBaseLine);
}
//else if(p == 3) //3车身左侧与本车道左侧距离
@ -5870,6 +5895,8 @@ void ExamCarSub3::Calc_LaneDistance_Tail()
{
calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.ZH_W_b_G, RTKKM3_Tail.Wheel_LB_ToBaseLine);
calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.YH_W_b_G, RTKKM3_Tail.Wheel_RB_ToBaseLine);
calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.b(RF_I), RTKKM3_Tail.Body_RF_ToBaseLine, true);
calcToLaneLine(Lj, road->Area.Pts, body.b1_b_G, body.b(RB_I), RTKKM3_Tail.Body_RB_ToBaseLine, true);
}
//else if(p == 3) //3车身左侧与本车道左侧距离

View File

@ -168,6 +168,9 @@ bool ExamSensor::convertDatas(TChuanGan* cg)
//}
//航向角(默认是按诺瓦泰的数据格式定义的所以要加上180度) 1:天宝(北云)/C1 2:诺瓦泰
//2505121242兼容这个时间之前的特殊版卡类型做航向角转换处理的
if(Tools::checkVersion(m_car->carVerison()))
{
if(gps.bklx == boardTypeTB)
{
gps.hxj += 180.0;
@ -176,6 +179,8 @@ bool ExamSensor::convertDatas(TChuanGan* cg)
{
gps.hxj -= 360.0;
}
}
//实际上车这里经纬度要转化,测试的数据都是转化好的
gps.jd = GpsMath::convertGpsCoord2(gps.jd);
gps.wd = GpsMath::convertGpsCoord2(gps.wd);
@ -190,6 +195,9 @@ bool ExamSensor::convertDatas(TChuanGan* cg)
if(IS_A2C6(cartype))
{
TGpsInfo& gps2 = cg->real.gps2;
//2505121242兼容这个时间之前的特殊版卡类型做航向角转换处理的
if(Tools::checkVersion(m_car->carVerison()))
{
if(gps2.bklx == boardTypeTB)
{
gps2.hxj += 180.0;
@ -198,11 +206,12 @@ bool ExamSensor::convertDatas(TChuanGan* cg)
{
gps2.hxj -= 360.0;
}
}
//实际上车这里经纬度要转化,测试的数据都是转化好的
gps2.jd = GpsMath::convertGpsCoord2(gps2.jd);
gps2.wd = GpsMath::convertGpsCoord2(gps2.wd);
#if !JUDGE_USE_INSPECT
gps.sd *= GPS_VEL_COEFF; //无锡所检测不需要乘这个系数因为我们实际用的时候是gps速度无锡所是加工后的数据
gps2.sd *= GPS_VEL_COEFF; //无锡所检测不需要乘这个系数因为我们实际用的时候是gps速度无锡所是加工后的数据
#endif
}
@ -995,80 +1004,78 @@ void ExamSensor::setStatus(TChuanGan* cg, CarMoveState s)
bool ExamSensor::filterWrong(TChuanGan* cg)
{
TGpsInfo& gps = cg->real.gps;
//位置差分, 角度差分
if(gps.dwzt == gpsStatusNARROW_INT && gps.jdzt == gpsStatusANGLE)
{
gps.rtkEnabled = true;
}
else
{
gps.rtkEnabled = false;
logwarning("rtk Enabled not, dwzt=%d, jdzt=%d", gps.dwzt, gps.jdzt);
}
TChuanGan* his = m_car->historyChuanGan();
gps.errorFlag = false;
//过滤GPS漂移数据
if(his != nullptr)
bool ok1 = filterGpsWrong(&cg->real.gps, his != nullptr ? &his->real.gps : nullptr);
bool ok2 = true;
ExamCarType cartype = m_car->carType();
if(IS_A2C6(cartype))
{
const TGpsInfo& h_gps = his->real.gps;
int64 interval = std::abs(gps.sj - h_gps.sj);
//如果是正常连续数据才判断漂移,有可能是断网收不到数据,然后过了几秒又收到数据距离会远超过限制距离
if(interval < 1*SECOND)
{
TGPSPoint p1 = h_gps.to();
TGPSPoint p2 = gps.to();
double distance = GpsMath::calcGpsDistanceCM(p1, p2, p1.gc);
if(distance > DEVIATION_RANGE_DISTANCE_CM)
{
logwarning("deviation rang distance=%0.2f CM", distance);
gps.errorFlag = true;
}
double angle = std::abs(gps.hxj - h_gps.hxj);
if(angle > DEVIATION_RANGE_ANGLE_MIN && angle < DEVIATION_RANGE_ANGLE_MAX)
{
logwarning("deviation rang angle=%0.2f", angle);
gps.errorFlag = true;
}
}
ok2 = filterGpsWrong(&cg->real.gps2, his != nullptr ? &his->real.gps2 : nullptr);
}
m_car->examNonGps(cg);
if(gps.errorFlag)
{
logwarning("errorFlag invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps.dwzt, gps.jdzt, gps.jd, gps.wd);
return false;
//ExamSubject sub = m_car->examSubject();
//if(ExamSubject2 == sub)
//{
// return ok1 && ok2;
//}
//else if(ExamSubject3 == sub)
//{
// return ok1 && ok2;
//}
return ok1 && ok2;
}
if(!gps.valid())
bool ExamSensor::filterGpsWrong(TGpsInfo* gps, const TGpsInfo* h_gps)
{
logwarning("gps invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps.dwzt, gps.jdzt, gps.jd, gps.wd);
return false;
}
ExamSubject sub = m_car->examSubject();
if(ExamSubject2 == sub)
//位置差分, 角度差分
if(gps->dwzt == gpsStatusNARROW_INT && gps->jdzt == gpsStatusANGLE)
{
//return gps.rtkEnabled == true && gps.valid();
return gps.valid(); //2025-03-20 modify
}
else if(ExamSubject3 == sub)
{
if(gps.valid()) //20240811 yhy
{
//数据是正常的
gps->rtkEnabled = true;
}
else
{
//if(m_car->historyCount() > 0)
//{
// cloneWith(m_car->historyChuanGan(), cg);
//}
gps->rtkEnabled = false;
logwarning("rtk Enabled not, dwzt=%d, jdzt=%d", gps->dwzt, gps->jdzt);
}
return true;
gps->errorFlag = false;
//过滤GPS漂移数据
if(h_gps != nullptr)
{
int64 interval = std::abs(gps->sj - h_gps->sj);
//如果是正常连续数据才判断漂移,有可能是断网收不到数据,然后过了几秒又收到数据距离会远超过限制距离
if(interval < 1*SECOND)
{
TGPSPoint p1 = h_gps->to();
TGPSPoint p2 = gps->to();
double distance = GpsMath::calcGpsDistanceCM(p1, p2, p1.gc);
if(distance > DEVIATION_RANGE_DISTANCE_CM)
{
logwarning("deviation rang distance=%0.2f CM", distance);
gps->errorFlag = true;
}
double angle = std::abs(gps->hxj - h_gps->hxj);
if(angle > DEVIATION_RANGE_ANGLE_MIN && angle < DEVIATION_RANGE_ANGLE_MAX)
{
logwarning("deviation rang angle=%0.2f", angle);
gps->errorFlag = true;
}
}
}
if(gps->errorFlag)
{
logwarning("errorFlag invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps->dwzt, gps->jdzt, gps->jd, gps->wd);
return false;
}
if(!gps->valid())
{
logwarning("gps invalid dwzt=%d, jdzt=%d, jd=%0.8f, wd=%0.8f", gps->dwzt, gps->jdzt, gps->jd, gps->wd);
return false;
}
return true;

View File

@ -26,6 +26,7 @@ public:
virtual bool calcCarBody(TChuanGan* cg);
//过滤异常数据
virtual bool filterWrong(TChuanGan* cg);
virtual bool filterGpsWrong(TGpsInfo* gps, const TGpsInfo* h_gps);
//计算考车状态(科目三)
virtual bool GetCarDirStauts(TChuanGan* cg);
//计算考车状态(科目二)

View File

@ -483,6 +483,26 @@ void IExamCar::examPerformSummary()
exam.bxjl = dis.y*10; //单位毫米 所以要乘10
exam.hint = m_message;
exam.lane = historyChuanGan()->RTKKM3;
ExamCarType cartype = carType();
if(IS_A2C6(cartype))
{
//对于牵引车,车身距离都是指的挂车(车厢),如果车轮,车前轮指的是车头的轮子,车后轮指的挂车最后面轮子,和军华确认过的 2025-05-13
const TRTKResult& rtkTail = historyChuanGan()->RTKKM3_Tail;
TRTKResult& lane = exam.lane;
lane.Body_LF_ToLeftEdge = rtkTail.Body_LF_ToLeftEdge;
lane.Body_LB_ToLeftEdge = rtkTail.Body_LB_ToLeftEdge;
lane.Body_RF_ToRightEdge = rtkTail.Body_RF_ToRightEdge;
lane.Body_RB_ToRightEdge = rtkTail.Body_RB_ToRightEdge;
lane.Body_RF_ToBaseLine = rtkTail.Body_RF_ToBaseLine;
lane.Body_RB_ToBaseLine = rtkTail.Body_RB_ToBaseLine;
lane.Wheel_RB_ToRightEdge = rtkTail.Wheel_RB_ToRightEdge;
lane.Wheel_RB_ToBaseLine = rtkTail.Wheel_RB_ToBaseLine;
lane.Wheel_LB_ToRightEdge = rtkTail.Wheel_LB_ToRightEdge;
lane.Wheel_LB_ToBaseLine = rtkTail.Wheel_LB_ToBaseLine;
}
std::string data = XParser::toAny(exam);
FactoryExamService->examJudgeCallbackPerformToCaller(data.c_str(), data.size());

View File

@ -89,6 +89,7 @@ public:
virtual ISurveyCarAbstract* carModel() MEANS { return m_carModel; }
virtual int modelSize() MEANS { return m_carModel->size(); }
virtual ExamSubject examSubject() MEANS { return ExamSubject(m_carInfo->kskm); }
virtual const std::string& carVerison() MEANS { return m_carInfo->sdkver; }
virtual int carID() MEANS { return m_carInfo->kchm; }
virtual const std::string& carClass() MEANS { return m_carInfo->name; }
virtual int carCode() MEANS { return m_carCode; }

View File

@ -104,6 +104,8 @@ public:
virtual int modelSize() const = 0;
//考试科目
virtual ExamSubject examSubject() const = 0;
//轨迹初始化版本号
virtual const std::string& carVerison() const = 0;
//考车ID
virtual int carID() const = 0;
//考车名称

View File

@ -136,12 +136,6 @@ const char* GraphicImage::image()
#endif
int offset_y = 1;
if(m_showVersion)
{
drawText(Pointi(1, offset_y), JUDGE_VERSION_INFO, RGB_BLUE, 16);
offset_y += 16;
}
if(m_showTime)
{
int64 tick = Tools::nowTime();
@ -149,6 +143,11 @@ const char* GraphicImage::image()
drawText(Pointi(1, offset_y), tm.c_str(), RGB_PERILLA, 16);
offset_y += 16;
}
//if(m_showVersion)
//{
// drawText(Pointi(1, offset_y), JUDGE_VERSION_INFO, RGB_BLUE, 16);
// offset_y += 16;
//}
toRgb();
return (const char*)m_rgb;

View File

@ -52,6 +52,16 @@ bool Sub3Judge02Qbxx::dealJudgeEnter()
m_exam->TestPro = ItemProFlagJudge;
//ToDo2:生成进项目事件
if(m_car->examAlready(Sub3ItemType01Sczb) && m_car->examAlready(Sub3ItemType41Mndg))
{
if(!m_sound_qibu)
{
m_sound_qibu = true;
m_car->createEventSound({m_exam->ItemNo, sound::sub3_402001});
}
}
return true;
}

View File

@ -69,7 +69,7 @@ protected:
private:
TSub3Item02Qbxx m_itemv;
bool m_Pub_First_QiBu_Flag = false; //起步方向灯和喇叭 只判一次 第一次进起步项目才判
bool m_sound_qibu = false;
//**********************以下是新科目三************************
private:
//起步项目中车辆状态从停止切换前进前10s内头部姿态没有大于左后侧角度【23度】

View File

@ -554,7 +554,7 @@ void Sub3Judge11Kbtc::DoStatus_2()
else if(s430 == "1") //拉手刹放空挡
{
//20180625
if(sor.ssc == SYES && sor.dw == 0)
if(sor.ssc == SYES && (sor.dw == 0 || sor.dw == 10))
{
m_itemv.Status = 3;
return;
@ -699,8 +699,14 @@ void Sub3Judge11Kbtc::DoStatus_3()
}
//压路边线
if(!IS_A2C6(m_carType))
{
Judge_KBTC_YaXian();
}
else
{
Judge_KBTC_YaXian_Tail(); //A2C6-20250314
}
}
else
@ -1076,10 +1082,16 @@ void Sub3Judge11Kbtc::DoStatus_4()
if(ksdd == siteof::hbtskm3 || ksdd == siteof::lyggy)
{
if(m_car->rtkEnabled())
{
if(!IS_A2C6(m_carType))
{
Judge_KBTC_YaXian();
}
else
{
Judge_KBTC_YaXian_Tail(); //A2C6-20250314
}
}
} // 20171211
}
else //20170215
@ -1307,7 +1319,6 @@ void Sub3Judge11Kbtc::Judge_KBTC_YaXian()
RightJL1_RF = RTKKM3_1.Body_RF_ToBaseLine;
RightJL2_RF = RTKKM3_2.Body_RF_ToBaseLine;
RightJL0_RB = RTKKM3_0.Body_RB_ToBaseLine;
RightJL1_RB = RTKKM3_1.Body_RB_ToBaseLine;
RightJL2_RB = RTKKM3_2.Body_RB_ToBaseLine;
@ -1457,16 +1468,20 @@ void Sub3Judge11Kbtc::Judge_KBTC_YaXian_Tail()
RightJL1_RF = RTKKM3_Tail_1.Body_RF_ToBaseLine;
RightJL2_RF = RTKKM3_Tail_2.Body_RF_ToBaseLine;
RightJL0_RB = RTKKM3_Tail_0.Body_RB_ToBaseLine;
RightJL1_RB = RTKKM3_Tail_1.Body_RB_ToBaseLine;
RightJL2_RB = RTKKM3_Tail_2.Body_RB_ToBaseLine;
}
else
{
RightJL0_RF = RTKKM3_Tail_0.Wheel_RF_ToBaseLine;
RightJL1_RF = RTKKM3_Tail_1.Wheel_RF_ToBaseLine;
RightJL2_RF = RTKKM3_Tail_2.Wheel_RF_ToBaseLine;
//对于牵引车,车身距离都是指的挂车(车厢),如果车轮,车前轮指的是车头的轮子,车后轮指的挂车最后面轮子,和军华确认过的 2025-05-13
const TRTKResult& RTKKM3_0 = m_car->historyRtkKM3(0);
const TRTKResult& RTKKM3_1 = m_car->historyRtkKM3(1);
const TRTKResult& RTKKM3_2 = m_car->historyRtkKM3(2);
RightJL0_RF = RTKKM3_0.Wheel_RF_ToBaseLine;
RightJL1_RF = RTKKM3_1.Wheel_RF_ToBaseLine;
RightJL2_RF = RTKKM3_2.Wheel_RF_ToBaseLine;
RightJL0_RB = RTKKM3_Tail_0.Wheel_RB_ToBaseLine;
RightJL1_RB = RTKKM3_Tail_1.Wheel_RB_ToBaseLine;

View File

@ -868,7 +868,8 @@ void Sub3Judge20Comm::CallMoNiDengGuang()
if(m > 0)
{
if(m_engineTick > 0 && cg->tkCnt - m_engineTick > m*SECOND)
//if(m_engineTick > 0 && cg->tkCnt - m_engineTick > m*SECOND)
if(m_engineTick > 0 && m_car->timeElapsed() > m*SECOND)
{
JUDGE_MARK_SUB3(20, "94", true);
}