Commit 4cdf08f0 authored by liyuanhong's avatar liyuanhong

修复车安优模拟器轨迹跑完,反向行驶,导致数组越界问题

parent ec393d29
......@@ -340,9 +340,11 @@ class MessageSimulaterService():
obdMsg = obdObj.generateMsg_GUI(self.OBDdata)
if self.fixCurPosition == 0:
if self.travelDirection == 0:
self.gpsLineIndex = self.gpsLineIndex + 1 # 正向行驶
if self.gpsLineIndex < len(self.gpsLine):
self.gpsLineIndex = self.gpsLineIndex + 1 # 正向行驶
else:
self.gpsLineIndex = self.gpsLineIndex - 1 # 反向行驶
if self.gpsLineIndex > 0:
self.gpsLineIndex = self.gpsLineIndex - 1 # 反向行驶
elif self.gpsLineIndex == len(self.gpsLine) or self.gpsLineIndex == -1: #如果反向行驶和反向行驶刚好跑完
if int(self.data["travelData"]["travelLoop"]) == 0: #没有设置循环行驶
self.gpsLineIndex = self.gpsLineIndex - 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment