Skip to content

Commit 6744458

Browse files
committed
navd: handle maxspeed being none
1 parent c851cf7 commit 6744458

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

selfdrive/navd/navd.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ def calculate_route(self, destination):
143143
coord = Coordinate.from_mapbox_tuple(c)
144144

145145
# Last step does not have maxspeed
146-
if (maxspeed_idx < len(maxspeeds)) and ('unknown' not in maxspeeds[maxspeed_idx]):
147-
coord.annotations['maxspeed'] = maxspeed_to_ms(maxspeeds[maxspeed_idx])
146+
if (maxspeed_idx < len(maxspeeds)):
147+
maxspeed = maxspeeds[maxspeed_idx]
148+
if ('unknown' not in maxspeed) and maxspeed['speed']:
149+
coord.annotations['maxspeed'] = maxspeed_to_ms(maxspeed)
148150

149151
coords.append(coord)
150152
maxspeed_idx += 1

0 commit comments

Comments
 (0)