//
|
// 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;
|
}
|
|
void StartChaneLaneExam(int ori_lane)
|
{
|
DEBUG("变更车道");
|
|
start = false;
|
originalLane = ori_lane;
|
PlayTTS("前方请变更车道", TtsBack);
|
}
|
|
bool TestChangeLane(int currLane, const struct RtkTime *rtkTime)
|
{
|
if (!start)
|
return true;
|
if (originalLane != currLane) {
|
DEBUG("完成变道");
|
PlayTTS("完成变道", NULL);
|
return false;
|
}
|
|
if (ReadOdo() - maxMoveDistance > 100) {
|
// 超车未完成
|
DEBUG("超车固定距离内未完成");
|
AddExamFault(3, rtkTime);
|
return false;
|
}
|
|
return true;
|
}
|