| | |
| | | #include "../jni_log.h" |
| | | #include "road_exam.h" |
| | | #include "../master/comm_if.h" |
| | | #include "../common/apptimer.h" |
| | | #include <cmath> |
| | | |
| | | #define DEBUG(fmt, args...) LOGD("<drive_straight> <%s>: " fmt, __func__, ##args) |
| | |
| | | static bool reportOffsetOver; |
| | | static double edgeDistance; |
| | | static double distanceToStartSum; |
| | | static int examTtsSeq; |
| | | |
| | | static double CalcDistance2Edge(road_t &road, const car_model *car); |
| | | static void PlayTTSTimeout(union sigval sig); |
| | | |
| | | void StartDriveStraightExam(std::string tts) { |
| | | DEBUG("开始直线行驶"); |
| | | |
| | | ttsPlayEnd = 0; |
| | | if (!tts.empty()) { |
| | | PlayTTS(tts.c_str()); |
| | | examTtsSeq = PlayTTS(tts.c_str()); |
| | | } else { |
| | | DEBUG("没有TTS"); |
| | | examTtsSeq = PlayTTS("请保持直线行驶"); |
| | | } |
| | | |
| | | distanceToStartSum = 0; |
| | | reportOffsetOver = false; |
| | | |
| | | AppTimer_delete(PlayTTSTimeout); |
| | | AppTimer_add(PlayTTSTimeout, D_SEC(5)); |
| | | } |
| | | |
| | | int ExecuteDriveStraightExam(road_t &road, const car_model *car, |
| | | LIST_CAR_MODEL &CarModelList, double speed, int moveDirect, const struct RtkTime *rtkTime) { |
| | | const trigger_line_t *item, const struct RtkTime *rtkTime) { |
| | | static PointF startPoint; |
| | | |
| | | double dis2roadEdge = 0; |
| | |
| | | return 1; |
| | | } |
| | | |
| | | void DriveStraightTTSDone(int id) |
| | | { |
| | | // 等语音播报完毕后计时 |
| | | if (id == examTtsSeq) { |
| | | DEBUG("StopCarTTSDone %d", id); |
| | | ttsPlayEnd = 1; |
| | | } |
| | | } |
| | | |
| | | void TerminateDriveStraightExam(void) |
| | | { |
| | | AppTimer_delete(PlayTTSTimeout); |
| | | } |
| | | |
| | | static void PlayTTSTimeout(union sigval sig) |
| | | { |
| | | AppTimer_delete(PlayTTSTimeout); |
| | | |
| | | ttsPlayEnd = 1; |
| | | } |
| | | |
| | | static double CalcDistance2Edge(road_t &road, const car_model *car) |
| | | { |
| | | PointF vp; |