mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-23 20:52:06 +08:00
Merge branch 'hooks-fix' into master-dev-c3
This commit is contained in:
@@ -219,7 +219,7 @@ def crash_log(candidate):
|
||||
while True:
|
||||
if is_connected_to_internet():
|
||||
sentry.get_init()
|
||||
sentry.capture_info("fingerprinted %s" % candidate)
|
||||
sentry.capture_info(f"fingerprinted {candidate}")
|
||||
break
|
||||
else:
|
||||
no_internet += 1
|
||||
@@ -233,7 +233,7 @@ def crash_log2(fingerprints, fw):
|
||||
while True:
|
||||
if is_connected_to_internet():
|
||||
sentry.get_init()
|
||||
sentry.capture_warning("car doesn't match any fingerprints: %s" % repr(fingerprints))
|
||||
sentry.capture_warning(f"car doesn't match any fingerprints: {repr(fingerprints)}")
|
||||
break
|
||||
else:
|
||||
no_internet += 1
|
||||
|
||||
@@ -104,7 +104,7 @@ def get_torque_params():
|
||||
# lateral neural network feedforward
|
||||
class FluxModel:
|
||||
def __init__(self, params_file, zero_bias=False):
|
||||
with open(params_file, "r") as f:
|
||||
with open(params_file) as f:
|
||||
params = json.load(f)
|
||||
|
||||
self.input_size = params["input_size"]
|
||||
@@ -163,7 +163,7 @@ class FluxModel:
|
||||
return float(output_array[0, 0])
|
||||
|
||||
def validate_layers(self):
|
||||
for W, b, activation in self.layers:
|
||||
for _, _, activation in self.layers:
|
||||
if not hasattr(self, activation):
|
||||
raise ValueError(f"Unknown activation: {activation}")
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ CAMERA_OFFSET = 0.04
|
||||
REPLAY = "REPLAY" in os.environ
|
||||
SIMULATION = "SIMULATION" in os.environ
|
||||
TESTING_CLOSET = "TESTING_CLOSET" in os.environ
|
||||
IGNORE_PROCESSES = {"loggerd", "encoderd", "statsd", "mapd", "gpxd", "gpxd_uploader", "mapd", "otisserv", "fleet_manager"}
|
||||
IGNORE_PROCESSES = {"loggerd", "encoderd", "statsd", "gpxd", "gpxd_uploader", "mapd", "otisserv", "fleet_manager"}
|
||||
|
||||
ThermalStatus = log.DeviceState.ThermalStatus
|
||||
State = log.ControlsState.OpenpilotState
|
||||
@@ -300,7 +300,8 @@ class Controls:
|
||||
self.events.add(EventName.calibrationInvalid)
|
||||
|
||||
# Handle lane change
|
||||
lane_change_edge_block = self.sm['lateralPlanSPDEPRECATED'].laneChangeEdgeBlockDEPRECATED if self.model_use_lateral_planner else self.sm['modelV2SP'].laneChangeEdgeBlock
|
||||
lane_change_edge_block = self.sm['lateralPlanSPDEPRECATED'].laneChangeEdgeBlockDEPRECATED if self.model_use_lateral_planner else \
|
||||
self.sm['modelV2SP'].laneChangeEdgeBlock
|
||||
lane_change_svs = self.sm['lateralPlanDEPRECATED'] if self.model_use_lateral_planner else self.sm['modelV2'].meta
|
||||
if lane_change_svs.laneChangeState == LaneChangeState.preLaneChange and lane_change_edge_block:
|
||||
self.events.add(EventName.laneChangeRoadEdge)
|
||||
@@ -620,9 +621,10 @@ class Controls:
|
||||
CC.latActive = (self.active or self.mads_ndlob) and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
|
||||
(not standstill or self.joystick_mode) and CS.madsEnabled and (not CS.brakePressed or self.mads_ndlob) and \
|
||||
(not CS.belowLaneChangeSpeed or (not (((self.sm.frame - self.last_blinker_frame) * DT_CTRL) < 1.0) and
|
||||
not (CS.leftBlinker or CS.rightBlinker))) and CS.latActive and self.sm['liveCalibration'].calStatus == log.LiveCalibrationData.Status.calibrated and \
|
||||
not self.process_not_running
|
||||
CC.longActive = self.enabled_long and not (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) and not self.events.contains(ET.OVERRIDE_LONGITUDINAL)
|
||||
not (CS.leftBlinker or CS.rightBlinker))) and CS.latActive and \
|
||||
self.sm['liveCalibration'].calStatus == log.LiveCalibrationData.Status.calibrated and not self.process_not_running
|
||||
CC.longActive = self.enabled_long and not (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) and \
|
||||
not self.events.contains(ET.OVERRIDE_LONGITUDINAL)
|
||||
|
||||
actuators = CC.actuators
|
||||
actuators.longControlState = self.LoC.long_control_state
|
||||
@@ -829,7 +831,8 @@ class Controls:
|
||||
|
||||
controlsState.longitudinalPlanMonoTime = self.sm.logMonoTime['longitudinalPlan']
|
||||
controlsState.lateralPlanMonoTime = self.sm.logMonoTime[lp_mono_time_svs]
|
||||
controlsState.enabled = not (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) and (self.enabled or CS.cruiseState.enabled) and CS.gearShifter not in [GearShifter.park, GearShifter.reverse]
|
||||
controlsState.enabled = not (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) and \
|
||||
(self.enabled or CS.cruiseState.enabled) and CS.gearShifter not in [GearShifter.park, GearShifter.reverse]
|
||||
controlsState.active = not (CS.brakePressed and (not self.CS_prev.brakePressed or not CS.standstill)) and (self.active or CS.cruiseState.enabled)
|
||||
controlsState.curvature = curvature
|
||||
controlsState.desiredCurvature = self.desired_curvature
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import numpy as np
|
||||
from cereal import car
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.common.realtime import Priority, config_realtime_process
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.selfdrive.modeld.constants import ModelConstants
|
||||
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
|
||||
from openpilot.selfdrive.controls.lib.lateral_planner import LateralPlanner
|
||||
from openpilot.selfdrive.modeld.custom_model_metadata import CustomModelMetadata, ModelCapabilities
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from enum import IntFlag
|
||||
import os
|
||||
from typing import TypeAlias
|
||||
|
||||
from cereal import custom
|
||||
from openpilot.common.params import Params
|
||||
|
||||
SIMULATION = "SIMULATION" in os.environ
|
||||
|
||||
ModelGeneration = custom.ModelGeneration
|
||||
ModelGeneration: TypeAlias = custom.ModelGeneration
|
||||
|
||||
|
||||
class ModelCapabilities(IntFlag):
|
||||
@@ -15,7 +16,7 @@ class ModelCapabilities(IntFlag):
|
||||
Default = 1
|
||||
"""Default capability, used for the prebuilt model."""
|
||||
|
||||
NoO = 2
|
||||
NavigateOnOpenpilot = 2
|
||||
"""Navigation on Openpilot capability, used for models support navigation."""
|
||||
|
||||
LateralPlannerSolution = 2 ** 2
|
||||
@@ -56,11 +57,11 @@ class CustomModelMetadata:
|
||||
elif self.generation == ModelGeneration.four:
|
||||
return ModelCapabilities.DesiredCurvatureV2
|
||||
elif self.generation == ModelGeneration.three:
|
||||
return ModelCapabilities.DesiredCurvatureV2 | ModelCapabilities.NoO
|
||||
return ModelCapabilities.DesiredCurvatureV2 | ModelCapabilities.NavigateOnOpenpilot
|
||||
elif self.generation == ModelGeneration.two:
|
||||
return ModelCapabilities.DesiredCurvatureV1 | ModelCapabilities.NoO
|
||||
return ModelCapabilities.DesiredCurvatureV1 | ModelCapabilities.NavigateOnOpenpilot
|
||||
elif self.generation == ModelGeneration.one:
|
||||
return ModelCapabilities.LateralPlannerSolution | ModelCapabilities.NoO
|
||||
return ModelCapabilities.LateralPlannerSolution | ModelCapabilities.NavigateOnOpenpilot
|
||||
else:
|
||||
# Default model is meant to represent the capabilities of the prebuilt model
|
||||
return ModelCapabilities.Default
|
||||
|
||||
@@ -78,7 +78,7 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D
|
||||
modelV2.frameAge = frame_age
|
||||
modelV2.frameDropPerc = frame_drop_perc
|
||||
modelV2.timestampEof = timestamp_eof
|
||||
model_use_nav = custom_model_valid and custom_model_capabilities & ModelCapabilities.NoO
|
||||
model_use_nav = custom_model_valid and custom_model_capabilities & ModelCapabilities.NavigateOnOpenpilot
|
||||
if model_use_nav:
|
||||
modelV2.locationMonoTimeDEPRECATED = timestamp_llk
|
||||
modelV2.modelExecutionTime = model_execution_time
|
||||
@@ -104,8 +104,8 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D
|
||||
# lateral planning
|
||||
if model_use_lateral_planner:
|
||||
solution = modelV2.lateralPlannerSolutionDEPRECATED
|
||||
solution.x, solution.y, solution.yaw, solution.yawRate = [net_output_data['lat_planner_solution'][0,:,i].tolist() for i in range(4)]
|
||||
solution.xStd, solution.yStd, solution.yawStd, solution.yawRateStd = [net_output_data['lat_planner_solution_stds'][0,:,i].tolist() for i in range(4)]
|
||||
solution.x, solution.y, solution.yaw, solution.yawRate = (net_output_data['lat_planner_solution'][0,:,i].tolist() for i in range(4))
|
||||
solution.xStd, solution.yStd, solution.yawStd, solution.yawRateStd = (net_output_data['lat_planner_solution_stds'][0,:,i].tolist() for i in range(4))
|
||||
else:
|
||||
action = modelV2.action
|
||||
action.desiredCurvature = float(net_output_data['desired_curvature'][0,0])
|
||||
|
||||
@@ -81,7 +81,7 @@ class ModelState:
|
||||
'lateral_control_params': np.zeros(ModelConstants.LATERAL_CONTROL_PARAMS_LEN, dtype=np.float32),
|
||||
'prev_desired_curvs': np.zeros(ModelConstants.PREV_DESIRED_CURVS_LEN, dtype=np.float32),
|
||||
}
|
||||
if self.custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if self.custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
_inputs_2 = {
|
||||
'nav_features': np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32),
|
||||
'nav_instructions': np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32),
|
||||
@@ -101,10 +101,10 @@ class ModelState:
|
||||
_metadata_name = self.param_s.get("DrivingModelMetadataText", encoding="utf8")
|
||||
_metadata_path = f"{CUSTOM_MODEL_PATH}/supercombo_metadata_{_metadata_name}.pkl" if _model_name else METADATA_PATH
|
||||
else:
|
||||
_model_paths = MODEL_PATHS
|
||||
_model_paths = MODEL_PATHS # type: ignore
|
||||
_metadata_path = METADATA_PATH
|
||||
|
||||
with open(_metadata_path, 'rb') as f:
|
||||
with open(_metadata_path, 'rb') as f: # type: ignore
|
||||
model_metadata = pickle.load(f)
|
||||
|
||||
self.output_slices = model_metadata['output_slices']
|
||||
@@ -135,7 +135,7 @@ class ModelState:
|
||||
self.inputs['traffic_convention'][:] = inputs['traffic_convention']
|
||||
if not (self.custom_model_metadata.valid and self.custom_model_metadata.capabilities & ModelCapabilities.LateralPlannerSolution):
|
||||
self.inputs['lateral_control_params'][:] = inputs['lateral_control_params']
|
||||
if self.custom_model_metadata.valid and self.custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if self.custom_model_metadata.valid and self.custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
self.inputs['nav_features'][:] = inputs['nav_features']
|
||||
self.inputs['nav_instructions'][:] = inputs['nav_instructions']
|
||||
|
||||
@@ -207,7 +207,7 @@ def main(demo=False):
|
||||
|
||||
# messaging
|
||||
extended_svs = ["lateralPlanDEPRECATED", "lateralPlanSPDEPRECATED"]
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
extended_svs += ["navModelDEPRECATED", "navInstruction"]
|
||||
pm = PubMaster(["modelV2", "modelV2SP", "drivingModelData", "cameraOdometry"])
|
||||
sm = SubMaster(["deviceState", "carState", "roadCameraState", "liveCalibration", "driverMonitoringState", "carControl"] + extended_svs)
|
||||
@@ -225,7 +225,7 @@ def main(demo=False):
|
||||
live_calib_seen = False
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.LateralPlannerSolution:
|
||||
driving_style = np.array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], dtype=np.float32)
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
nav_features = np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32)
|
||||
nav_instructions = np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32)
|
||||
buf_main, buf_extra = None, None
|
||||
@@ -303,7 +303,7 @@ def main(demo=False):
|
||||
|
||||
timestamp_llk = 0
|
||||
nav_enabled = False
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
# Enable/disable nav features
|
||||
timestamp_llk = sm["navModelDEPRECATED"].locationMonoTime
|
||||
nav_valid = sm.valid["navModelDEPRECATED"] # and (nanos_since_boot() - timestamp_llk < 1e9)
|
||||
@@ -349,7 +349,7 @@ def main(demo=False):
|
||||
_inputs = {
|
||||
'lateral_control_params': lateral_control_params
|
||||
}
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if custom_model_metadata.valid and custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
_inputs_2 = {
|
||||
'nav_features': nav_features,
|
||||
'nav_instructions': nav_instructions
|
||||
|
||||
@@ -4,7 +4,6 @@ import math
|
||||
import time
|
||||
import ctypes
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
from cereal import messaging
|
||||
from cereal.messaging import PubMaster, SubMaster
|
||||
@@ -21,7 +20,7 @@ NAV_INPUT_SIZE = 256*256
|
||||
NAV_FEATURE_LEN = 256
|
||||
NAV_DESIRE_LEN = 32
|
||||
NAV_OUTPUT_SIZE = 2*2*ModelConstants.IDX_N + NAV_DESIRE_LEN + NAV_FEATURE_LEN
|
||||
MODEL_PATHS = {}
|
||||
MODEL_PATHS = {} # type: ignore
|
||||
|
||||
CUSTOM_MODEL_PATH = Paths.model_root()
|
||||
|
||||
@@ -51,7 +50,7 @@ class ModelState:
|
||||
self.output = np.zeros(NAV_OUTPUT_SIZE, dtype=np.float32)
|
||||
self.param_s = Params()
|
||||
self.custom_model_metadata = CustomModelMetadata(params=self.param_s, init_only=True)
|
||||
if self.custom_model_metadata.valid and self.custom_model_metadata.capabilities & ModelCapabilities.NoO:
|
||||
if self.custom_model_metadata.valid and self.custom_model_metadata.capabilities & ModelCapabilities.NavigateOnOpenpilot:
|
||||
_model_name = self.param_s.get("NavModelText", encoding="utf8")
|
||||
_model_paths = {
|
||||
ModelRunner.SNPE: f"{CUSTOM_MODEL_PATH}/navmodel_q_{_model_name}.dlc"}
|
||||
|
||||
Regular → Executable
+19
-17
@@ -22,7 +22,7 @@
|
||||
# THE SOFTWARE.
|
||||
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from cgi import parse_header, parse_multipart
|
||||
from cgi import parse_header
|
||||
from urllib.parse import parse_qs, unquote
|
||||
import json
|
||||
import requests
|
||||
@@ -184,7 +184,7 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
name = postvars.get("name")[0] if postvars.get("name") is not None else ""
|
||||
if use_amap:
|
||||
lng, lat = self.gcj02towgs84(lng, lat)
|
||||
params.put('NavDestination', "{\"latitude\": %f, \"longitude\": %f, \"place_name\": \"%s\"}" % (lat, lng, name))
|
||||
params.put('NavDestination', f'{{"latitude": {lat:.6f}, "longitude": {lng:.6f}, "place_name": "{name}"}}')
|
||||
self.to_json(lat, lng, save_type, name)
|
||||
if postvars is not None:
|
||||
latitude_value = postvars.get("latitude")
|
||||
@@ -194,7 +194,7 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
lng = float(longitude_value)
|
||||
save_type = "recent"
|
||||
name = postvars.get("place_name", [""])
|
||||
params.put('NavDestination', "{\"latitude\": %f, \"longitude\": %f, \"place_name\": \"%s\"}" % (lat, lng, name))
|
||||
params.put('NavDestination', f'{{"latitude": {lat:.6f}, "longitude": {lng:.6f}, "place_name": "{name}"}}')
|
||||
self.to_json(lat, lng, save_type, name)
|
||||
# favorites
|
||||
if not use_gmap and "fav_val" in postvars:
|
||||
@@ -244,7 +244,7 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type','image/png')
|
||||
self.end_headers()
|
||||
f = open("%s/selfdrive/assets/img_spinner_comma.png" % BASEDIR, "rb")
|
||||
f = open(f"{BASEDIR}/selfdrive/assets/img_spinner_comma.png", "rb")
|
||||
self.wfile.write(f.read())
|
||||
f.close()
|
||||
|
||||
@@ -323,17 +323,19 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
self.wfile.write(bytes(self.get_parsed_template("body", {"{{content}}": self.get_parsed_template("addr_input", {"{{msg}}": msg})}), "utf-8"))
|
||||
|
||||
def display_page_nav_confirmation(self, addr, lon, lat):
|
||||
content = self.get_parsed_template("addr_input", {"{{msg}}": ""}) + self.get_parsed_template("nav_confirmation", {"{{token}}": self.get_public_token(), "{{lon}}": lon, "{{lat}}": lat, "{{addr}}": addr})
|
||||
content = self.get_parsed_template("addr_input", {"{{msg}}": ""}) + self.get_parsed_template("nav_confirmation", {"{{token}}": self.get_public_token(), "{{lon}}": lon, "{{lat}}": lat, "{{addr}}": addr}) # noqa: E501
|
||||
self.wfile.write(bytes(self.get_parsed_template("body", {"{{content}}": content }), "utf-8"))
|
||||
|
||||
def display_page_gmap(self):
|
||||
self.wfile.write(bytes(self.get_parsed_template("gmap/index.html", {"{{gmap_key}}": self.get_gmap_key()}), "utf-8"))
|
||||
|
||||
def display_page_amap(self):
|
||||
self.wfile.write(bytes(self.get_parsed_template("amap/index.html", {"{{amap_key}}": self.get_amap_key(), "{{amap_key_2}}": self.get_amap_key_2()}), "utf-8"))
|
||||
self.wfile.write(bytes(self.get_parsed_template("amap/index.html", {"{{amap_key}}": self.get_amap_key(), "{{amap_key_2}}": self.get_amap_key_2()}), "utf-8")) # noqa: E501
|
||||
|
||||
def get_parsed_template(self, name, replace = {}):
|
||||
f = open('%s/selfdrive/navd/tpl/%s.tpl' % (BASEDIR, name), mode='r', encoding='utf-8')
|
||||
def get_parsed_template(self, name, replace=None):
|
||||
if replace is None:
|
||||
replace = {}
|
||||
f = open(f'{BASEDIR}/selfdrive/navd/tpl/{name}.tpl', encoding='utf-8')
|
||||
content = f.read()
|
||||
for key in replace:
|
||||
content = content.replace(key, str(replace[key]))
|
||||
@@ -348,7 +350,7 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
last_pos = Params().get("LastGPSPosition")
|
||||
if last_pos is not None and last_pos != "":
|
||||
l = json.loads(last_pos)
|
||||
query += "&proximity=%s,%s" % (l["longitude"], l["latitude"])
|
||||
query += f"&proximity={l['longitude']},{l['latitude']}"
|
||||
|
||||
r = requests.get(query)
|
||||
if r.status_code != 200:
|
||||
@@ -407,16 +409,16 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
ret += (150.0 * math.sin(lng / 12.0 * pi) + 300.0 * math.sin(lng / 30.0 * pi)) * 2.0 / 3.0
|
||||
return ret
|
||||
|
||||
def to_json(self, lat, lng, type = "recent", name = ""):
|
||||
def to_json(self, lat, lng, _type="recent", name=""):
|
||||
if name == "":
|
||||
name = str(lat) + "," + str(lng)
|
||||
new_dest = {"latitude": float(lat), "longitude": float(lng), "place_name": name}
|
||||
|
||||
if type == "recent":
|
||||
if _type == "recent":
|
||||
new_dest["save_type"] = "recent"
|
||||
else:
|
||||
new_dest["save_type"] = "favorite"
|
||||
new_dest["label"] = type
|
||||
new_dest["label"] = _type
|
||||
|
||||
val = params.get("ApiCache_NavDestinations", encoding='utf8')
|
||||
if val is not None:
|
||||
@@ -433,17 +435,17 @@ class OtisServ(BaseHTTPRequestHandler):
|
||||
type_label_ids["recent"].append(idx)
|
||||
idx += 1
|
||||
|
||||
if type == "recent":
|
||||
id = None
|
||||
if _type == "recent":
|
||||
_id = None
|
||||
if len(type_label_ids["recent"]) > 10:
|
||||
dests.pop(type_label_ids["recent"][-1])
|
||||
else:
|
||||
id = type_label_ids[type]
|
||||
_id = type_label_ids[_type]
|
||||
|
||||
if id is None:
|
||||
if _id is None:
|
||||
dests.insert(0, new_dest)
|
||||
else:
|
||||
dests[id] = new_dest
|
||||
dests[_id] = new_dest
|
||||
|
||||
params.put("ApiCache_NavDestinations", json.dumps(dests).rstrip("\n\r"))
|
||||
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
@@ -242,7 +243,7 @@ public:
|
||||
inline SponsorRoleModel sunnylinkSponsorRole() const {
|
||||
std::optional<SponsorRoleModel> sponsorRoleWithHighestTier = std::nullopt;
|
||||
for (const auto &role : sunnylinkRoles) {
|
||||
if(role.roleType != RoleType::Sponsor)
|
||||
if (role.roleType != RoleType::Sponsor)
|
||||
continue;
|
||||
|
||||
if (auto sponsorRole = role.as<SponsorRoleModel>(); !sponsorRoleWithHighestTier.has_value() || sponsorRoleWithHighestTier->roleTier < sponsorRole.roleTier) {
|
||||
|
||||
@@ -80,7 +80,7 @@ def _request_refresh_osm_bounds_data(self):
|
||||
mem_params.put("OSMDownloadBounds", json.dumps(current_bounding_box))
|
||||
|
||||
|
||||
def request_refresh_osm_location_data(nations: [str], states: [str] = None):
|
||||
def request_refresh_osm_location_data(nations: list[str], states: list[str]=None):
|
||||
params.put("OsmDownloadedDate", str(time.time()))
|
||||
params.put_bool("OsmDbUpdatesCheck", False)
|
||||
|
||||
@@ -93,7 +93,7 @@ def request_refresh_osm_location_data(nations: [str], states: [str] = None):
|
||||
mem_params.put("OSMDownloadLocations", osm_download_locations)
|
||||
|
||||
|
||||
def filter_nations_and_states(nations: [str], states: [str] = None):
|
||||
def filter_nations_and_states(nations: list[str], states: list[str]=None):
|
||||
"""Filters and prepares nation and state data for OSM map download.
|
||||
|
||||
If the nation is 'US' and a specific state is provided, the nation 'US' is removed from the list.
|
||||
|
||||
+4
-4
@@ -10,8 +10,8 @@ from sentry_sdk.integrations.threading import ThreadingIntegration
|
||||
from openpilot.common.api.sunnylink import UNREGISTERED_SUNNYLINK_DONGLE_ID
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.params import Params
|
||||
from openpilot.system.athena.registration import UNREGISTERED_DONGLE_ID, is_registered_device
|
||||
from openpilot.system.hardware import HARDWARE, PC
|
||||
from openpilot.system.athena.registration import UNREGISTERED_DONGLE_ID
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
from openpilot.system.hardware.hw import Paths
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.system.version import get_build_metadata, get_version
|
||||
@@ -21,7 +21,7 @@ class SentryProject(Enum):
|
||||
# python project
|
||||
SELFDRIVE = "https://7e3be9bfcfe04c9abe58bd25fe290d1a@o1138119.ingest.sentry.io/6191481"
|
||||
# native project
|
||||
SELFDRIVE_NATIVE = "https://7e3be9bfcfe04c9abe58bd25fe290d1a@o1138119.ingest.sentry.io/6191481"
|
||||
SELFDRIVE_NATIVE = "https://7e3be9bfcfe04c9abe58bd25fe290d1a@o1138119.ingest.sentry.io/6191481" # noqa: PIE796
|
||||
|
||||
|
||||
CRASHES_DIR = Paths.community_crash_root()
|
||||
@@ -68,7 +68,7 @@ def save_exception(exc_text: str) -> None:
|
||||
else:
|
||||
f.write(exc_text)
|
||||
|
||||
print('Logged current crash to {}'.format(files))
|
||||
print(f'Logged current crash to {files}')
|
||||
|
||||
|
||||
def bind_user() -> None:
|
||||
|
||||
Reference in New Issue
Block a user