Merge remote-tracking branch 'origin/master'
| | |
| | | const int RTK_PLATFORM_PORT = 12125; |
| | | const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x01}; |
| | | |
| | | const char *VIRTUAL_RTK_IP = "192.168.16.100"; |
| | | const char *VIRTUAL_RTK_IP = "192.168.16.212"; |
| | | const int VIRTUAL_RTK_PORT = 9002; |
| | | |
| | | static pthread_mutex_t tts_mutex = PTHREAD_MUTEX_INITIALIZER; |
| | |
| | | PlayTTS("模拟器连接", NULL); |
| | | } else { |
| | | DEBUG("虚拟平台连接失败"); |
| | | if (virtRtkIsValid) { |
| | | PlayTTS("模拟器断开", NULL); |
| | | } |
| | | virtRtkIsValid = false; |
| | | connectCnt++; |
| | | |
| | | if (connectCnt < 3) { |
| | | AppTimer_add(ConnectLater, D_SEC(3), 1); |
| | | } |
| | | PlayTTS("模拟器断开", NULL); |
| | | } |
| | | } |
| | | |
| | |
| | | PlayTTS("灯光模拟器连接", NULL); |
| | | } else { |
| | | DEBUG("灯光虚拟平台连接失败"); |
| | | if (virtRtkIsValid2) { |
| | | PlayTTS("灯光模拟器断开", NULL); |
| | | } |
| | | virtRtkIsValid2 = false; |
| | | connectCnt2++; |
| | | |
| | | if (connectCnt2 < 3) { |
| | | AppTimer_add(ConnectLater2, D_SEC(3), 2); |
| | | } |
| | | PlayTTS("灯光模拟器断开", NULL); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | static int EnterMap(const car_model *car, LIST_CAR_MODEL &CarModelList, LIST_AREA_MAP &mapList) |
| | | { |
| | | vector<int> score(mapList.size(), 0); // 场地重合时,车头尾都在内的优先 |
| | | |
| | | for (int i = 0; i < mapList.size() && car != NULL; ++i) { |
| | | // 车前轮或后轮轨迹越过触发线 |
| | | if (mapList[i].type == MAP_TYPE_STOP_START) { |
| | |
| | | |
| | | if (DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine1) > 0.1 && |
| | | DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine2) > 0.1) |
| | | return i; |
| | | score[i]++; |
| | | } |
| | | // 车尾顶点在场地内 |
| | | if (IntersectionOf(car->carXY[ car->axial[AXIAL_REAR] ], &mapList[i].map) == GM_Containment) { |
| | | Line enterLine1, enterLine2; |
| | | |
| | | MakeLine(&enterLine1, &(mapList[i].map.point[0]), &(mapList[i].map.point[1])); |
| | | MakeLine(&enterLine2, &(mapList[i].map.point[6]), &(mapList[i].map.point[7])); |
| | | |
| | | if (DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine1) > 0.1 && |
| | | DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine2) > 0.1) |
| | | score[i]++; |
| | | } |
| | | } |
| | | if (mapList[i].type == MAP_TYPE_PART_EDGE) { |
| | |
| | | MakeLine(&enterLine, &(mapList[i].map.point[0]), &(mapList[i].map.point[1])); |
| | | |
| | | if (DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine) > 0.1) |
| | | return i; |
| | | score[i]++; |
| | | } |
| | | // 车尾顶点在场地内 |
| | | if (IntersectionOf(car->carXY[ car->axial[AXIAL_REAR] ], &mapList[i].map) == GM_Containment) { |
| | | Line enterLine; |
| | | |
| | | MakeLine(&enterLine, &(mapList[i].map.point[0]), &(mapList[i].map.point[1])); |
| | | |
| | | if (DistanceOf(car->carXY[car->axial[AXIAL_REAR]], enterLine) > 0.1) |
| | | score[i]++; |
| | | } |
| | | } |
| | | if (mapList[i].type == MAP_TYPE_TURN_90) { |
| | |
| | | return i; |
| | | } |
| | | if (mapList[i].type == MAP_TYPE_CURVE) { |
| | | // 车前轮或后轮轨迹越过触发线 |
| | | Line triggerLine; |
| | | |
| | | MakeLine(&triggerLine, &mapList[i].map2.point[0], &mapList[i].map.point[0]); |
| | |
| | | return i; |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < score.size(); ++i) { |
| | | if (score[i] == 2) { |
| | | return i; |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < score.size(); ++i) { |
| | | if (score[i] == 1) { |
| | | return i; |
| | | } |
| | | } |
| | | |
| | | return -1; |
| | | } |
| | | |