commit
342b249407
11 changed files with 100 additions and 20 deletions
@ -0,0 +1,24 @@ |
||||
# navigation |
||||
|
||||
This directory contains two daemons, `navd` and `map_renderer`, which support navigation in the openpilot stack. |
||||
|
||||
### navd |
||||
|
||||
`navd` takes in a route through the `NavDestination` param and sends out two packets: `navRoute` and `navInstruction`. These packets contain the coordinates of the planned route and turn-by-turn instructions. |
||||
|
||||
### map renderer |
||||
|
||||
The map renderer listens for the `navRoute` and publishes a rendered map view over VisionIPC for the navigation model, which lives in `selfdrive/modeld/`. The rendered maps look like this: |
||||
|
||||
 |
||||
|
||||
## development |
||||
|
||||
Currently, [mapbox](https://www.mapbox.com/) is used for navigation. |
||||
|
||||
* get an API token: https://docs.mapbox.com/help/glossary/access-token/ |
||||
* set an API token using the `MAPBOX_TOKEN` environment variable |
||||
* routes/destinations are set through the `NavDestination` param |
||||
* use `set_destination.py` for debugging |
||||
* edit the map: https://www.mapbox.com/contribute |
||||
* mapbox API playground: https://docs.mapbox.com/playground/ |
@ -0,0 +1,33 @@ |
||||
#!/usr/bin/env python3 |
||||
import json |
||||
import sys |
||||
|
||||
from common.params import Params |
||||
|
||||
if __name__ == "__main__": |
||||
params = Params() |
||||
|
||||
# set from google maps url |
||||
if len(sys.argv) > 1: |
||||
coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",") |
||||
dest = { |
||||
"latitude": float(coords[0]), |
||||
"longitude": float(coords[1]) |
||||
} |
||||
params.put("NavDestination", json.dumps(dest)) |
||||
params.remove("NavDestinationWaypoints") |
||||
else: |
||||
print("Setting to Taco Bell") |
||||
dest = { |
||||
"latitude": 32.71160109904473, |
||||
"longitude": -117.12556569985693, |
||||
} |
||||
params.put("NavDestination", json.dumps(dest)) |
||||
|
||||
waypoints = [ |
||||
(-117.16020713111648, 32.71997612490662), |
||||
] |
||||
params.put("NavDestinationWaypoints", json.dumps(waypoints)) |
||||
|
||||
print(dest) |
||||
print(waypoints) |
@ -1 +1 @@ |
||||
67a4bd615017128ce04d0836608d2c7f32432e3e |
||||
358d330ffde4ecd679129b0e0a20806aaf21b786 |
@ -1,10 +0,0 @@ |
||||
#!/usr/bin/env python3 |
||||
import json |
||||
import sys |
||||
|
||||
from common.params import Params |
||||
|
||||
if __name__ == "__main__": |
||||
coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",") |
||||
dest = {"latitude": float(coords[0]), "longitude": float(coords[1])} |
||||
Params().put("NavDestination", json.dumps(dest)) |
Loading…
Reference in new issue