yy1717
2020-10-23 c484cbb09d445e2ab30ea011c6d2ffd87202bb26
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
51
//
// 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;
}