mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-22 14:03:43 +08:00
7021d2ce20
* UI: Debug: Tap on Ui to capture snapshot of debug data * UI: Debug UI: Toggle to display debug UI elements & UI prerequisites * UI: VisionTurnController Implementation * UI: Debug UI: Toggle to display debug UI elements * UI: LiveMapData: Implementation * UI: SpeedLimitControl: Implementation * UI: TurnSpeedController: Implementation * fixup! UI: SpeedLimitControl: Implementation * Add adjustable speed limit offset (in % or actual values) * fix * fix 2 * fix 3 * wrong value used * don't need this * needs this! * and this? * needs to be at the top * has to be public * take them off * gotta have this * wrong! * update this every time * try to update * hmm maybe it was this * missed this * Revert "missed this" This reverts commit 926b45410544e4f1bbc5174d0d7b03fafedf610f. * Revert "hmm maybe it was this" This reverts commit 7f75543db71d6f438f6473c66d4f94df317f16f2. * refresh them * update them in both places! * make them public please * don't forget this path * try this refresh? * Revert "make them public please" This reverts commit 669a3ee1d5607c84109294db7a567ca86cb91b0f. * revert these * try using signals to update * Revert "try using signals to update" This reverts commit f3ad02bde71467aa7fc27c0b95d03748345193e6. * update state after it's emitted * make it public * Revert "make it public" This reverts commit ddf431d198133359b8bd656dde9061ec671f2312. * Revert "update state after it's emitted" This reverts commit aad2876166843b63d889e90830bf3d32edaa2857. * try this out * fixup! try this out * fixup! try this out * fixup! try this out * fixup! try this out * don't need this * fixup! try this out * fixup! try this out * fixup! try this out * fixup! try this out * make sure we can see it * make it float * Try to update this way * fixup! Try to update this way * Revert "fixup! Try to update this way" This reverts commit f4725bcb070cc8e8ebeb6e37afeb930694e96e22. * Revert "Try to update this way" This reverts commit af72af8a4a193b24e99931200fac18c6625a2431. * new method to hide/show * fixup! new method to hide/show * fixup! new method to hide/show * fixup! new method to hide/show * fixup! new method to hide/show * fixup! new method to hide/show * omg it works?! * run these at 2Hz pls * UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * fixup! UI: use comma speed limit design instead of move-fast * garbage collection * redundant * gc attempt? * Revert "garbage collection" This reverts commit 127fc8bd9d1eaea7725cf775dc7034ac6aaf09f4. * garbage collection * catch exceptions * ignore mapd if crashed * copy dependencies after first download * changed dir * oops * proper termination before exiting * same class * Revert "same class" This reverts commit dda695477371bf259b89aae726210dfe9d5f913e. * Revert "proper termination before exiting" This reverts commit 95c039dac86a389c0be043aadf2a3e8cbd4515c8. * don't let accelerator press to re-engage SLC when NDOG is off * can we free them up? * Revert "can we free them up?" This reverts commit d7736524645376ffb43acb77678086f6ae3c4e0b. * fixup! don't let accelerator press to re-engage SLC when NDOG is off * introduce navInstruction speed limits into SLC * nuke UI for now - memory test * do this instead * Overpass: does not exist * Revert "nuke UI for now - memory test" This reverts commit fd81ffde0443917580ec4ad71095c178173883fe. * meh
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
import overpy
|
|
import numpy as np
|
|
from selfdrive.mapd.lib.geo import R
|
|
|
|
|
|
def create_way(way_id, node_ids, from_way):
|
|
"""
|
|
Creates and OSM Way with the given `way_id` and list of `node_ids`, copying attributes and tags from `from_way`
|
|
"""
|
|
return overpy.Way(way_id, node_ids=node_ids, attributes={}, result=from_way._result,
|
|
tags=from_way.tags)
|
|
|
|
|
|
class OSM:
|
|
def __init__(self):
|
|
self.api = overpy.Overpass()
|
|
# self.api = overpy.Overpass(url='http://3.65.170.21/api/interpreter')
|
|
|
|
def fetch_road_ways_around_location(self, lat, lon, radius):
|
|
# Calculate the bounding box coordinates for the bbox containing the circle around location.
|
|
bbox_angle = np.degrees(radius / R)
|
|
# fetch all ways and nodes on this ways in bbox
|
|
bbox_str = f'{str(lat - bbox_angle)},{str(lon - bbox_angle)},{str(lat + bbox_angle)},{str(lon + bbox_angle)}'
|
|
q = """
|
|
way(""" + bbox_str + """)
|
|
[highway]
|
|
[highway!~"^(footway|path|corridor|bridleway|steps|cycleway|construction|bus_guideway|escape|service|track)$"];
|
|
(._;>;);
|
|
out;
|
|
"""
|
|
try:
|
|
ways = self.api.query(q).ways
|
|
except Exception as e:
|
|
print(f'Exception while querying OSM:\n{e}')
|
|
ways = []
|
|
|
|
return ways
|