fctom1215
2020-08-28 bf8e1f4ef4961b32dfa73a0b898f82c20721bf09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// 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;
}