subject-two/entry/src/main/cpp/sdk/judge/sub3/ISub3JudgeWrap.h
2025-03-26 16:56:51 +08:00

129 lines
5.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 说明: 科目三评判项目的基类
*
* 作者: 杨海洋
* 日期: 2024-01-02
*
* ***************************************************************************************
*
* 学校区域的速度要求比较简单全程速度不超过30KM/H只要速度大于30就扣速度分。
*
* 路口项目:直行路口、左转弯、右转弯、路口掉头
* 普通掉头
*
* 学校区域、公交站台、人行横道。
*
* 以上项目是需要评判速度或者减速的。
*
* 掉头相关的修改2024-03-16
*
*/
#ifndef ISUB3JUDGEWRAP_H
#define ISUB3JUDGEWRAP_H
#include "IGraphicAbstract.h"
#include "IExamCarAbstract.h"
#include "IExamCar.h"
#include "ISub3JudgeItem.h"
class JUDGE_API ISub3JudgeWrap : public ISub3JudgeItem
{
//itemno, serial, once, force, event, type
#define JUDGE_MARK_SUB3(itemno, serial, ...) \
{ \
if(this->examMarkAuto(JUDGE_EXPAND(itemno, serial, __VA_ARGS__))) \
{ \
logtrace("sub3-mark itemno=%d,serial=%s", itemno, serial); \
} \
} \
#define JUDGE_MARK_NSUB3(itemno, serial, ...) \
{ \
if(this->examMarkNS3(JUDGE_EXPAND(itemno, serial, __VA_ARGS__))) \
{ \
logtrace("sub3-mark-ns3 itemno=%d,serial=%s", itemno, serial); \
} \
}
protected:
bool examMarkAuto(ExamItemCode itemno, const std::string& serial, bool once=false, bool force=false, bool event=true, MarkType type=MarkTypeAuto) const
{
return m_car->examMarkItem(itemno, serial, once, force, event, type);
}
bool examMarkNS3(ExamItemCode itemno, const std::string& serial, bool once=false, bool force=false, bool event=true, MarkType type=MarkTypeNS3) const
{
return m_car->examMarkItem(itemno, serial, once, force, event, type);
}
public:
explicit ISub3JudgeWrap() = default;
virtual ~ISub3JudgeWrap() = default;
DEAL_API bool dealBuildItem(IExamCarAbstract* car) override;
DEAL_API void dealJudgeItem() override { TASSERT_VOID(false, "not!"); }
DEAL_API std::string dealHintStage() override { return m_exam->MsgData; }
DEAL_API bool dealJudgeEnter() override { m_exam->TestPro = ItemProFlagJudge; return true; }
DEAL_API bool dealJudgeFinish() override { return m_exam->TestPro == ItemProFlagEnd; }
DEAL_API bool dealJudgeCancel() override { TASSERT_BOOL(false, "not!"); return false; }
virtual TKM3Item* getExamItem() const noexcept override { return m_exam; }
virtual ExamItemCode itemNo() const noexcept override { return m_exam->ItemNo; }
virtual ItemState getState() const noexcept override { return m_exam->Item_Color; }
protected:
void setSeed(int64 seed) { m_seed = seed % 603528; }
int random2(int a, int b) { return Tools::randomx(a, b, m_seed++); }
//从当前位置向倒退jl米的距离内是否有刹车动作
bool CheckJL_ShaChe(int JL) const;
//从当前位置向倒退jl米的距离内是否减速低于30
bool CheckJL_CS(int JL, int CS = 30) const;
//从当前位置向倒退jl米的距离内是否停车
bool CheckJL_TingChe(int JL) const;
bool CheckJL_TC(int JL) const { return CheckJL_TingChe(JL); }
//从当前位置向倒退jl米的距离内是否减速低于30
bool CheckJL_CheShu_New(int JL) const ;
//路口减速相关评判
void Judge_LuKou_TZX_JianSu(int TempItemNo, int TempJianSuLeiXing, int TempSD) const;
//大车夜考通过路口时使用远光灯评判 yhy 2025-02-13
void Judge_LuKou_TZX_Night(int TempItemNo) const;
//没有信号灯的路口/人行横道,通过控制线前未闪灯
bool CheckJL_YJG(int jl)const;
void Update_DiaoTou_JianSuRec(TSlowDown& JianSuRec, int SuDuValue = -1);
//当前路段是否禁止左右转、直行、掉头
bool forbidInLane(const std::string& laneDir, TURN_TYPE d);
//显示状态信息
void showStatus(const std::string& msg);
protected:
ExamCarType m_carType = examCarTypeUnknown;
IExamCarSub3* m_car = nullptr;
TKM3Item* m_exam = nullptr;
int64 m_seed = 0;
//**********************以下是新科目三************************
public:
enum NS3UsingType
{
NS3UsingRadar = 0x0001 << 0,
NS3UsingPose = 0x0001 << 1,
NS3UsingBeha = 0x0001 << 2,
NS3UsingTarg = 0x0001 << 3,
NS3UsingAll = NS3UsingRadar | NS3UsingPose | NS3UsingBeha | NS3UsingTarg,
NS3UsingRadar_Targ = NS3UsingRadar | NS3UsingTarg
};
bool NS3UsingAndData(NS3UsingType type);
//绿灯亮起后前方无其他车辆、行人等影响通行时10s内未完成起步
//采集路口信号灯信号或视觉识别
void NS3JudgeVision_30107(TNS3LKGreen& green, int LuK_Fx);
protected:
protected:
ExamCarSub3New* m_nsub3 = nullptr;
};
#endif // ISUB3JUDGEWRAP_H