Commit ec393d29 authored by liyuanhong's avatar liyuanhong

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

parent 96b4a4cc
...@@ -168,8 +168,10 @@ class ProtocolSimulaterService(): ...@@ -168,8 +168,10 @@ class ProtocolSimulaterService():
gpsMsg = self.genGPSMsg(latitude, longitude) gpsMsg = self.genGPSMsg(latitude, longitude)
if self.fixPosition == 0: #是否固定当前位置的判断 if self.fixPosition == 0: #是否固定当前位置的判断
if self.travelDirection == 0: if self.travelDirection == 0:
if self.gpsLineIndex < len(self.gpsLine):
self.gpsLineIndex = self.gpsLineIndex + 1 #正向行驶 self.gpsLineIndex = self.gpsLineIndex + 1 #正向行驶
else: else:
if self.gpsLineIndex > 0:
self.gpsLineIndex = self.gpsLineIndex - 1 #反向行驶 self.gpsLineIndex = self.gpsLineIndex - 1 #反向行驶
elif self.gpsLineIndex == len(self.gpsLine) or self.gpsLineIndex == -1: #如果反向行驶和反向行驶刚好跑完 elif self.gpsLineIndex == len(self.gpsLine) or self.gpsLineIndex == -1: #如果反向行驶和反向行驶刚好跑完
if int(self.data["travelData"]["travelLoop"]) == 0: #没有设置循环行驶 if int(self.data["travelData"]["travelLoop"]) == 0: #没有设置循环行驶
......
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