//
|
// Created by YY on 2020/8/21.
|
//
|
|
#include "change_lane.h"
|
#include "../test_common/odo_graph.h"
|
#include "../native-lib.h"
|
#include "../jni_log.h"
|
#include "../driver_test.h"
|
|
#define DEBUG(fmt, args...) LOGD("<road_exam change_lane> <%s>: " fmt, __func__, ##args)
|
|
static double maxMoveDistance;
|
static int originalLane;
|
static bool start;
|
|
static void TtsBack(int seq)
|
{
|
maxMoveDistance = ReadOdo();
|
start = true;
|
DEBUG("变道开始里程 %f", maxMoveDistance);
|
}
|
|
void StartChaneLaneExam(int ori_lane)
|
{
|
DEBUG("变更车道");
|
|
start = false;
|
originalLane = ori_lane;
|
PlayTTS(examParam.change_lane_begin_tts, TtsBack);
|
}
|
|
bool TestChangeLane(int currLane, const struct RtkTime *rtkTime)
|
{
|
if (!start)
|
return true;
|
if (originalLane != currLane) {
|
DEBUG("完成变道");
|
PlayTTS(examParam.change_lane_end_tts, NULL);
|
return false;
|
}
|
|
if (ReadOdo() - maxMoveDistance > examParam.change_lane_limit_distance) {
|
// 超车未完成
|
DEBUG("变道固定距离内未完成 当前里程 %f", ReadOdo());
|
AddExamFault(3, rtkTime);
|
return false;
|
}
|
|
return true;
|
}
|