Revert "CI: pylint to ruff (#29276)" (#29284)

This reverts commit ffad7279cbad3c4f2ea786287b4624d3a3aa18d7.
old-commit-hash: a91764954b
beeps
Justin Newberry 2 years ago committed by GitHub
parent c1bcb53d4e
commit ff96892511
  1. 28
      .pre-commit-config.yaml
  2. 4
      poetry.lock
  3. 10
      pyproject.toml
  4. 2
      selfdrive/car/body/carcontroller.py
  5. 2
      selfdrive/controls/lib/events.py
  6. 2
      selfdrive/debug/clear_dtc.py
  7. 7
      selfdrive/debug/dump.py
  8. 6
      selfdrive/locationd/test/test_laikad.py
  9. 2
      selfdrive/modeld/runners/onnx_runner.py
  10. 3
      selfdrive/modeld/thneed/lib.py
  11. 16
      selfdrive/navd/tests/test_map_renderer.py
  12. 4
      selfdrive/test/process_replay/capture.py
  13. 4
      selfdrive/test/process_replay/migration.py
  14. 28
      selfdrive/test/process_replay/process_replay.py
  15. 2
      selfdrive/test/process_replay/regen.py
  16. 34
      selfdrive/test/process_replay/test_processes.py
  17. 14
      selfdrive/thermald/tests/test_power_monitoring.py
  18. 2
      selfdrive/updated.py
  19. 2
      system/sensord/rawgps/structs.py

@ -34,11 +34,31 @@ repos:
types: [python] types: [python]
args: ['--explicit-package-bases'] args: ['--explicit-package-bases']
exclude: '^(third_party/)|(cereal/)|(opendbc/)|(panda/)|(laika/)|(laika_repo/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(xx/)' exclude: '^(third_party/)|(cereal/)|(opendbc/)|(panda/)|(laika/)|(laika_repo/)|(rednose/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(xx/)'
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/PyCQA/flake8
rev: v0.0.282 rev: 6.1.0
hooks: hooks:
- id: ruff - id: flake8
exclude: '^(third_party/)|(cereal/)|(body/)|(rednose/)|(rednose_repo/)|(opendbc/)|(panda/)|(tools/)|(selfdrive/modeld/thneed/debug/)|(selfdrive/modeld/test/)|(selfdrive/camerad/test/)|(installer/)|(tinygrad_repo/)' exclude: '^(third_party/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(opendbc/)|(laika_repo/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)|(selfdrive/debug/)/'
additional_dependencies: ['flake8-no-implicit-concat']
args:
- --indent-size=2
- --enable-extensions=NIC
- --select=F,E112,E113,E304,E502,E701,E702,E703,E71,E72,E731,W191,W6
- --statistics
- -j4
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
exclude: '^(third_party/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(laika_repo/)|(rednose_repo/)|(tinygrad/)|(tinygrad_repo/)'
args:
- -j0
- -rn
- -sn
- --rcfile=.pylintrc
- repo: local - repo: local
hooks: hooks:
- id: cppcheck - id: cppcheck

4
poetry.lock generated

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:36187dd8afc0afe0abdb6976b5d31bb07294ec91c96022b426e86a0484216d8e oid sha256:4bdf2a7ffee6dd09d6532b7e2a2cd5d6af889658cfbbe0d02deac92e14be33e9
size 792009 size 809997

@ -19,6 +19,7 @@ cffi = "*"
crcmod = "*" crcmod = "*"
cryptography = "*" cryptography = "*"
Cython = "*" Cython = "*"
flake8 = "*"
Flask = "*" Flask = "*"
future-fstrings = "*" # for acados future-fstrings = "*" # for acados
gunicorn = "*" gunicorn = "*"
@ -91,6 +92,7 @@ pprofile = "*"
pre-commit = "*" pre-commit = "*"
pycurl = "*" pycurl = "*"
pygame = "*" pygame = "*"
pylint = "*"
pyprof2calltree = "*" pyprof2calltree = "*"
pytest = "*" pytest = "*"
pytest-xdist = "*" pytest-xdist = "*"
@ -159,7 +161,6 @@ PyMySQL = "~0.9"
pyproj = "*" pyproj = "*"
python-logstash = "*" python-logstash = "*"
redis = "*" redis = "*"
ruff = "*"
s2sphere = "*" s2sphere = "*"
scikit-image = "*" scikit-image = "*"
scikit-learn = "*" scikit-learn = "*"
@ -185,10 +186,3 @@ opencv-python-headless = { url = "https://github.com/commaai/opencv-python-build
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
[tool.ruff]
select = ["E", "F", "W"]
ignore = ["W292", "E741"]
line-length = 2500
target-version="py311"

@ -56,7 +56,7 @@ class CarController:
speed_error = speed_desired - speed_measured speed_error = speed_desired - speed_measured
if self.wheeled_body is None: if self.wheeled_body is None:
freeze_integrator = ((speed_error < 0 and self.speed_pid.error_integral <= -MAX_POS_INTEGRATOR) or freeze_integrator = ((speed_error < 0 and self.speed_pid.error_integral <= -MAX_POS_INTEGRATOR) or
(speed_error > 0 and self.speed_pid.error_integral >= MAX_POS_INTEGRATOR)) (speed_error > 0 and self.speed_pid.error_integral >= MAX_POS_INTEGRATOR))
angle_setpoint = self.speed_pid.update(speed_error, freeze_integrator=freeze_integrator) angle_setpoint = self.speed_pid.update(speed_error, freeze_integrator=freeze_integrator)

@ -724,7 +724,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
ET.SOFT_DISABLE: soft_disable_alert("Calibration Incomplete"), ET.SOFT_DISABLE: soft_disable_alert("Calibration Incomplete"),
ET.NO_ENTRY: NoEntryAlert("Calibration in Progress"), ET.NO_ENTRY: NoEntryAlert("Calibration in Progress"),
}, },
EventName.calibrationRecalibrating: { EventName.calibrationRecalibrating: {
ET.PERMANENT: calibration_incomplete_alert, ET.PERMANENT: calibration_incomplete_alert,
ET.SOFT_DISABLE: soft_disable_alert("Device Remount Detected: Recalibrating"), ET.SOFT_DISABLE: soft_disable_alert("Device Remount Detected: Recalibrating"),

@ -35,6 +35,6 @@ try:
except MessageTimeoutError: except MessageTimeoutError:
# functional address isn't properly handled so a timeout occurs # functional address isn't properly handled so a timeout occurs
if args.addr != 0x7DF: if args.addr != 0x7DF:
pass pass
print("") print("")
print("you may need to power cycle your vehicle now") print("you may need to power cycle your vehicle now")

@ -3,15 +3,14 @@ import os
import sys import sys
import argparse import argparse
import json import json
from hexdump import hexdump
import codecs import codecs
import cereal.messaging as messaging codecs.register_error("strict", codecs.backslashreplace_errors)
from hexdump import hexdump
from cereal import log from cereal import log
import cereal.messaging as messaging
from cereal.services import service_list from cereal.services import service_list
codecs.register_error("strict", codecs.backslashreplace_errors)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Dump communication sockets. See cereal/services.py for a complete list of available sockets.') parser = argparse.ArgumentParser(description='Dump communication sockets. See cereal/services.py for a complete list of available sockets.')

@ -111,7 +111,7 @@ class TestLaikad(unittest.TestCase):
laikad = Laikad() laikad = Laikad()
laikad.fetch_navs(gpstime, block=False) laikad.fetch_navs(gpstime, block=False)
laikad.orbit_fetch_future.result(30) laikad.orbit_fetch_future.result(30)
# Get results and save orbits to laikad: # Get results and save orbits to laikad:
laikad.fetch_navs(gpstime, block=False) laikad.fetch_navs(gpstime, block=False)
ephem = laikad.astro_dog.navs['G01'][0] ephem = laikad.astro_dog.navs['G01'][0]
@ -238,7 +238,7 @@ class TestLaikad(unittest.TestCase):
if len(out_msg.gnssMeasurements.ephemerisStatuses): if len(out_msg.gnssMeasurements.ephemerisStatuses):
seen_chip_eph = seen_chip_eph or any([x.source == 'gnssChip' for x in out_msg.gnssMeasurements.ephemerisStatuses]) seen_chip_eph = seen_chip_eph or any([x.source == 'gnssChip' for x in out_msg.gnssMeasurements.ephemerisStatuses])
seen_internet_eph = seen_internet_eph or any([x.source == 'internet' for x in out_msg.gnssMeasurements.ephemerisStatuses]) seen_internet_eph = seen_internet_eph or any([x.source == 'internet' for x in out_msg.gnssMeasurements.ephemerisStatuses])
self.assertTrue(has_navs or has_polys) self.assertTrue(has_navs or has_polys)
self.assertTrue(has_fix) self.assertTrue(has_fix)
self.assertTrue(seen_chip_eph or auto_fetch_navs) self.assertTrue(seen_chip_eph or auto_fetch_navs)
@ -281,7 +281,7 @@ class TestLaikad(unittest.TestCase):
self.assertTrue(any([x.source=='cache' for x in msg.gnssMeasurements.ephemerisStatuses])) self.assertTrue(any([x.source=='cache' for x in msg.gnssMeasurements.ephemerisStatuses]))
self.assertIsNotNone(msg) self.assertIsNotNone(msg)
#TODO test cache with only orbits #TODO test cache with only orbits
#with patch('selfdrive.locationd.laikad.get_orbit_data', return_value=None) as mock_method: #with patch('selfdrive.locationd.laikad.get_orbit_data', return_value=None) as mock_method:
# # Verify no orbit downloads even if orbit fetch times is reset since the cache has recently been saved and we don't want to download high frequently # # Verify no orbit downloads even if orbit fetch times is reset since the cache has recently been saved and we don't want to download high frequently
# laikad.astro_dog.orbit_fetched_times = TimeRangeHolder() # laikad.astro_dog.orbit_fetched_times = TimeRangeHolder()

@ -8,7 +8,7 @@ from typing import Tuple, Dict, Union, Any
os.environ["OMP_NUM_THREADS"] = "4" os.environ["OMP_NUM_THREADS"] = "4"
os.environ["OMP_WAIT_POLICY"] = "PASSIVE" os.environ["OMP_WAIT_POLICY"] = "PASSIVE"
import onnxruntime as ort # noqa: E402 import onnxruntime as ort # pylint: disable=import-error
ORT_TYPES_TO_NP_TYPES = {'tensor(float16)': np.float16, 'tensor(float)': np.float32, 'tensor(uint8)': np.uint8} ORT_TYPES_TO_NP_TYPES = {'tensor(float16)': np.float16, 'tensor(float)': np.float32, 'tensor(uint8)': np.uint8}

@ -1,5 +1,4 @@
import struct import struct, json
import json
def load_thneed(fn): def load_thneed(fn):
with open(fn, "rb") as f: with open(fn, "rb") as f:

@ -30,7 +30,7 @@ class MapBoxInternetDisabledRequestHandler(http.server.BaseHTTPRequestHandler):
def setup(self): def setup(self):
if self.INTERNET_ACTIVE: if self.INTERNET_ACTIVE:
super().setup() super().setup()
def handle(self): def handle(self):
if self.INTERNET_ACTIVE: if self.INTERNET_ACTIVE:
super().handle() super().handle()
@ -38,7 +38,7 @@ class MapBoxInternetDisabledRequestHandler(http.server.BaseHTTPRequestHandler):
def finish(self): def finish(self):
if self.INTERNET_ACTIVE: if self.INTERNET_ACTIVE:
super().finish() super().finish()
def do_GET(self): def do_GET(self):
url = f'https://api.mapbox.com{self.path}' url = f'https://api.mapbox.com{self.path}'
@ -50,7 +50,7 @@ class MapBoxInternetDisabledRequestHandler(http.server.BaseHTTPRequestHandler):
self.send_response(r.status_code) self.send_response(r.status_code)
self.end_headers() self.end_headers()
self.wfile.write(r.content) self.wfile.write(r.content)
def log_message(self, *args: Any) -> None: def log_message(self, *args: Any) -> None:
return return
@ -62,13 +62,13 @@ class MapBoxInternetDisabledServer(threading.Thread):
def run(self): def run(self):
self.server = http.server.HTTPServer(("127.0.0.1", 5000), MapBoxInternetDisabledRequestHandler) self.server = http.server.HTTPServer(("127.0.0.1", 5000), MapBoxInternetDisabledRequestHandler)
self.server.serve_forever() self.server.serve_forever()
def stop(self): def stop(self):
self.server.shutdown() self.server.shutdown()
def disable_internet(self): def disable_internet(self):
MapBoxInternetDisabledRequestHandler.INTERNET_ACTIVE = False MapBoxInternetDisabledRequestHandler.INTERNET_ACTIVE = False
def enable_internet(self): def enable_internet(self):
MapBoxInternetDisabledRequestHandler.INTERNET_ACTIVE = True MapBoxInternetDisabledRequestHandler.INTERNET_ACTIVE = True
@ -110,7 +110,7 @@ class TestMapRenderer(unittest.TestCase):
assert self.vipc.connect(False) assert self.vipc.connect(False)
self.vipc.recv() self.vipc.recv()
def _run_test(self, expect_valid, location=LOCATION1): def _run_test(self, expect_valid, location=LOCATION1):
starting_frame_id = None starting_frame_id = None
@ -127,7 +127,7 @@ class TestMapRenderer(unittest.TestCase):
else: else:
prev_valid = self.sm.valid['mapRenderState'] prev_valid = self.sm.valid['mapRenderState']
prev_frame_id = self.sm['mapRenderState'].frameId prev_frame_id = self.sm['mapRenderState'].frameId
if starting_frame_id is None: if starting_frame_id is None:
starting_frame_id = prev_frame_id starting_frame_id = prev_frame_id
@ -172,7 +172,7 @@ class TestMapRenderer(unittest.TestCase):
self.server.disable_internet() self.server.disable_internet()
self._setup_test() self._setup_test()
self._run_test(False) self._run_test(False)
def test_recover_from_no_internet(self): def test_recover_from_no_internet(self):
self._setup_test() self._setup_test()
self._run_test(True) self._run_test(True)

@ -22,7 +22,7 @@ class FdRedirect:
def read(self) -> bytes: def read(self) -> bytes:
with open(self.dest_fname, "rb") as f: with open(self.dest_fname, "rb") as f:
return f.read() or b"" return f.read() or b""
def link(self) -> None: def link(self) -> None:
os.dup2(self.dest_fd, self.source_fd) os.dup2(self.dest_fd, self.source_fd)
@ -39,7 +39,7 @@ class ProcessOutputCapture:
@no_type_check # ipython classes have incompatible signatures @no_type_check # ipython classes have incompatible signatures
def link_with_current_proc(self) -> None: def link_with_current_proc(self) -> None:
try: try:
# prevent ipykernel from redirecting stdout/stderr of python subprocesses # prevent ipykernel from redirecting stdout/stderr of python subprocesses
from ipykernel.iostream import OutStream from ipykernel.iostream import OutStream
if isinstance(sys.stdout, OutStream): if isinstance(sys.stdout, OutStream):

@ -20,13 +20,13 @@ def migrate_cameraStates(lr):
for msg in lr: for msg in lr:
if msg.which() not in ["roadEncodeIdx", "wideRoadEncodeIdx", "driverEncodeIdx"]: if msg.which() not in ["roadEncodeIdx", "wideRoadEncodeIdx", "driverEncodeIdx"]:
continue continue
encode_index = getattr(msg, msg.which()) encode_index = getattr(msg, msg.which())
meta = meta_from_encode_index(msg.which()) meta = meta_from_encode_index(msg.which())
assert encode_index.segmentId < 1200, f"Encoder index segmentId greater that 1200: {msg.which()} {encode_index.segmentId}" assert encode_index.segmentId < 1200, f"Encoder index segmentId greater that 1200: {msg.which()} {encode_index.segmentId}"
frame_to_encode_id[meta.camera_state][encode_index.frameId] = encode_index.segmentId frame_to_encode_id[meta.camera_state][encode_index.frameId] = encode_index.segmentId
for msg in lr: for msg in lr:
if msg.which() not in ["roadCameraState", "wideRoadCameraState", "driverCameraState"]: if msg.which() not in ["roadCameraState", "wideRoadCameraState", "driverCameraState"]:
all_msgs.append(msg) all_msgs.append(msg)

@ -52,7 +52,7 @@ class ReplayContext:
self.main_pub_drained = cfg.main_pub_drained self.main_pub_drained = cfg.main_pub_drained
self.unlocked_pubs = cfg.unlocked_pubs self.unlocked_pubs = cfg.unlocked_pubs
assert(len(self.pubs) != 0 or self.main_pub is not None) assert(len(self.pubs) != 0 or self.main_pub is not None)
def __enter__(self): def __enter__(self):
self.open() self.open()
@ -82,7 +82,7 @@ class ReplayContext:
@property @property
def all_recv_called_events(self): def all_recv_called_events(self):
return [man.recv_called_event for man in self.events.values()] return [man.recv_called_event for man in self.events.values()]
@property @property
def all_recv_ready_events(self): def all_recv_ready_events(self):
return [man.recv_ready_event for man in self.events.values()] return [man.recv_ready_event for man in self.events.values()]
@ -142,7 +142,7 @@ class ProcessContainer:
self.cnt = 0 self.cnt = 0
self.pm: Optional[messaging.PubMaster] = None self.pm: Optional[messaging.PubMaster] = None
self.sockets: Optional[List[messaging.SubSocket]] = None self.sockets: Optional[List[messaging.SubSocket]] = None
self.rc: Optional[ReplayContext] = None self.rc: Optional[ReplayContext] = None
self.vipc_server: Optional[VisionIpcServer] = None self.vipc_server: Optional[VisionIpcServer] = None
self.capture: Optional[ProcessOutputCapture] = None self.capture: Optional[ProcessOutputCapture] = None
@ -199,8 +199,8 @@ class ProcessContainer:
self.process.start() self.process.start()
def start( def start(
self, params_config: Dict[str, Any], environ_config: Dict[str, Any], self, params_config: Dict[str, Any], environ_config: Dict[str, Any],
all_msgs: Union[LogReader, List[capnp._DynamicStructReader]], all_msgs: Union[LogReader, List[capnp._DynamicStructReader]],
fingerprint: Optional[str], capture_output: bool fingerprint: Optional[str], capture_output: bool
): ):
with self.prefix as p: with self.prefix as p:
@ -335,7 +335,7 @@ def get_car_params_callback(rc, pm, msgs, fingerprint):
def controlsd_rcv_callback(msg, cfg, frame): def controlsd_rcv_callback(msg, cfg, frame):
# no sendcan until controlsd is initialized # no sendcan until controlsd is initialized
if msg.which() != "can": if msg.which() != "can":
return False return False
socks = [ socks = [
s for s in cfg.subs if s for s in cfg.subs if
@ -406,7 +406,7 @@ class FrequencyBasedRcvCallback:
if frame % max(1, int(service_list[msg.which()].frequency / service_list[s].frequency)) == 0 if frame % max(1, int(service_list[msg.which()].frequency / service_list[s].frequency)) == 0
] ]
return bool(len(resp_sockets)) return bool(len(resp_sockets))
def controlsd_config_callback(params, cfg, lr): def controlsd_config_callback(params, cfg, lr):
controlsState = None controlsState = None
@ -436,7 +436,7 @@ def laikad_config_pubsub_callback(params, cfg, lr):
def locationd_config_pubsub_callback(params, cfg, lr): def locationd_config_pubsub_callback(params, cfg, lr):
ublox = params.get_bool("UbloxAvailable") ublox = params.get_bool("UbloxAvailable")
sub_keys = ({"gpsLocation", } if ublox else {"gpsLocationExternal", }) sub_keys = ({"gpsLocation", } if ublox else {"gpsLocationExternal", })
cfg.pubs = set(cfg.pubs) - sub_keys cfg.pubs = set(cfg.pubs) - sub_keys
@ -494,7 +494,7 @@ CONFIGS = [
ProcessConfig( ProcessConfig(
proc_name="locationd", proc_name="locationd",
pubs=[ pubs=[
"cameraOdometry", "accelerometer", "gyroscope", "gpsLocationExternal", "cameraOdometry", "accelerometer", "gyroscope", "gpsLocationExternal",
"liveCalibration", "carState", "carParams", "gpsLocation" "liveCalibration", "carState", "carParams", "gpsLocation"
], ],
subs=["liveLocationKalman"], subs=["liveLocationKalman"],
@ -576,7 +576,7 @@ def get_process_config(name: str) -> ProcessConfig:
def get_custom_params_from_lr(lr: Union[LogReader, List[capnp._DynamicStructReader]], initial_state: str = "first") -> Dict[str, Any]: def get_custom_params_from_lr(lr: Union[LogReader, List[capnp._DynamicStructReader]], initial_state: str = "first") -> Dict[str, Any]:
""" """
Use this to get custom params dict based on provided logs. Use this to get custom params dict based on provided logs.
Useful when replaying following processes: calibrationd, paramsd, torqued Useful when replaying following processes: calibrationd, paramsd, torqued
The params may be based on first or last message of given type (carParams, liveCalibration, liveParameters, liveTorqueParameters) in the logs. The params may be based on first or last message of given type (carParams, liveCalibration, liveParameters, liveTorqueParameters) in the logs.
""" """
@ -618,7 +618,7 @@ def replay_process_with_name(name: Union[str, Iterable[str]], lr: Union[LogReade
def replay_process( def replay_process(
cfg: Union[ProcessConfig, Iterable[ProcessConfig]], lr: Union[LogReader, List[capnp._DynamicStructReader]], frs: Optional[Dict[str, Any]] = None, cfg: Union[ProcessConfig, Iterable[ProcessConfig]], lr: Union[LogReader, List[capnp._DynamicStructReader]], frs: Optional[Dict[str, Any]] = None,
fingerprint: Optional[str] = None, return_all_logs: bool = False, custom_params: Optional[Dict[str, Any]] = None, fingerprint: Optional[str] = None, return_all_logs: bool = False, custom_params: Optional[Dict[str, Any]] = None,
captured_output_store: Optional[Dict[str, Dict[str, str]]] = None, disable_progress: bool = False captured_output_store: Optional[Dict[str, Dict[str, str]]] = None, disable_progress: bool = False
) -> List[capnp._DynamicStructReader]: ) -> List[capnp._DynamicStructReader]:
@ -658,7 +658,7 @@ def _replay_multi_process(
for cfg in cfgs: for cfg in cfgs:
if len(cfg.vision_pubs) == 0: if len(cfg.vision_pubs) == 0:
continue continue
assert frs is not None, "frs must be provided when replaying process using vision streams" assert frs is not None, "frs must be provided when replaying process using vision streams"
assert all(meta_from_camera_state(st) is not None for st in cfg.vision_pubs),f"undefined vision stream spotted, probably misconfigured process: {cfg.vision_pubs}" assert all(meta_from_camera_state(st) is not None for st in cfg.vision_pubs),f"undefined vision stream spotted, probably misconfigured process: {cfg.vision_pubs}"
assert all(st in frs for st in cfg.vision_pubs), f"frs for this process must contain following vision streams: {cfg.vision_pubs}" assert all(st in frs for st in cfg.vision_pubs), f"frs for this process must contain following vision streams: {cfg.vision_pubs}"
@ -719,7 +719,7 @@ def generate_params_config(lr=None, CP=None, fingerprint=None, custom_params=Non
"DisengageOnAccelerator": True, "DisengageOnAccelerator": True,
"DisableLogging": False, "DisableLogging": False,
} }
if custom_params is not None: if custom_params is not None:
params_dict.update(custom_params) params_dict.update(custom_params)
if lr is not None: if lr is not None:
@ -766,7 +766,7 @@ def generate_environ_config(CP=None, fingerprint=None, log_dir=None) -> Dict[str
else: else:
environ_dict["SKIP_FW_QUERY"] = "" environ_dict["SKIP_FW_QUERY"] = ""
environ_dict["FINGERPRINT"] = "" environ_dict["FINGERPRINT"] = ""
return environ_dict return environ_dict

@ -15,7 +15,7 @@ from tools.lib.helpers import save_log
def regen_segment( def regen_segment(
lr: Union[LogReader, List[capnp._DynamicStructReader]], frs: Optional[Dict[str, Any]] = None, lr: Union[LogReader, List[capnp._DynamicStructReader]], frs: Optional[Dict[str, Any]] = None,
daemons: Union[str, Iterable[str]] = "all", disable_tqdm: bool = False daemons: Union[str, Iterable[str]] = "all", disable_tqdm: bool = False
) -> List[capnp._DynamicStructReader]: ) -> List[capnp._DynamicStructReader]:
if not isinstance(daemons, str) and not hasattr(daemons, "__iter__"): if not isinstance(daemons, str) and not hasattr(daemons, "__iter__"):

@ -41,23 +41,23 @@ source_segments = [
] ]
segments = [ segments = [
("BODY", "aregenECF15D9E559|2023-05-10--14-26-40--0"), ("BODY", "aregenECF15D9E559|2023-05-10--14-26-40--0"),
("HYUNDAI", "aregenAB9F543F70A|2023-05-10--14-28-25--0"), ("HYUNDAI", "aregenAB9F543F70A|2023-05-10--14-28-25--0"),
("HYUNDAI2", "aregen39F5A028F96|2023-05-10--14-31-00--0"), ("HYUNDAI2", "aregen39F5A028F96|2023-05-10--14-31-00--0"),
("TOYOTA", "aregen8D6A8B36E8D|2023-05-10--14-32-38--0"), ("TOYOTA", "aregen8D6A8B36E8D|2023-05-10--14-32-38--0"),
("TOYOTA2", "aregenB1933C49809|2023-05-10--14-34-14--0"), ("TOYOTA2", "aregenB1933C49809|2023-05-10--14-34-14--0"),
("TOYOTA3", "aregen5D9915223DC|2023-05-10--14-36-43--0"), ("TOYOTA3", "aregen5D9915223DC|2023-05-10--14-36-43--0"),
("HONDA", "aregen484B732B675|2023-05-10--14-38-23--0"), ("HONDA", "aregen484B732B675|2023-05-10--14-38-23--0"),
("HONDA2", "aregenAF6ACED4713|2023-05-10--14-40-01--0"), ("HONDA2", "aregenAF6ACED4713|2023-05-10--14-40-01--0"),
("CHRYSLER", "aregen99B094E1E2E|2023-05-10--14-41-40--0"), ("CHRYSLER", "aregen99B094E1E2E|2023-05-10--14-41-40--0"),
("RAM", "aregen5C2487E1EEB|2023-05-10--14-44-09--0"), ("RAM", "aregen5C2487E1EEB|2023-05-10--14-44-09--0"),
("SUBARU", "aregen98D277B792E|2023-05-10--14-46-46--0"), ("SUBARU", "aregen98D277B792E|2023-05-10--14-46-46--0"),
("GM", "aregen377BA28D848|2023-05-10--14-48-28--0"), ("GM", "aregen377BA28D848|2023-05-10--14-48-28--0"),
("GM2", "aregen7CA0CC0F0C2|2023-05-10--14-51-00--0"), ("GM2", "aregen7CA0CC0F0C2|2023-05-10--14-51-00--0"),
("NISSAN", "aregen7097BF01563|2023-05-10--14-52-43--0"), ("NISSAN", "aregen7097BF01563|2023-05-10--14-52-43--0"),
("VOLKSWAGEN", "aregen765AF3D2CB5|2023-05-10--14-54-23--0"), ("VOLKSWAGEN", "aregen765AF3D2CB5|2023-05-10--14-54-23--0"),
("MAZDA", "aregen3053762FF2E|2023-05-10--14-56-53--0"), ("MAZDA", "aregen3053762FF2E|2023-05-10--14-56-53--0"),
("FORD", "aregenDDE0F89FA1E|2023-05-10--14-59-26--0"), ("FORD", "aregenDDE0F89FA1E|2023-05-10--14-59-26--0"),
] ]
# dashcamOnly makes don't need to be tested until a full port is done # dashcamOnly makes don't need to be tested until a full port is done

@ -177,23 +177,23 @@ class TestPowerMonitoring(unittest.TestCase):
if i % 10 == 0: if i % 10 == 0:
self.assertFalse(pm.should_shutdown(ignition, False, ssb, False)) self.assertFalse(pm.should_shutdown(ignition, False, ssb, False))
self.assertFalse(pm.should_shutdown(ignition, False, ssb, False)) self.assertFalse(pm.should_shutdown(ignition, False, ssb, False))
def test_delay_shutdown_time(self): def test_delay_shutdown_time(self):
pm = PowerMonitoring() pm = PowerMonitoring()
pm.car_battery_capacity_uWh = 0 pm.car_battery_capacity_uWh = 0
ignition = False ignition = False
in_car = True in_car = True
offroad_timestamp = ssb offroad_timestamp = ssb
started_seen = True started_seen = True
pm.calculate(VOLTAGE_BELOW_PAUSE_CHARGING, ignition) pm.calculate(VOLTAGE_BELOW_PAUSE_CHARGING, ignition)
while ssb < offroad_timestamp + DELAY_SHUTDOWN_TIME_S: while ssb < offroad_timestamp + DELAY_SHUTDOWN_TIME_S:
self.assertFalse(pm.should_shutdown(ignition, in_car, self.assertFalse(pm.should_shutdown(ignition, in_car,
offroad_timestamp, offroad_timestamp,
started_seen), started_seen),
f"Should not shutdown before {DELAY_SHUTDOWN_TIME_S} seconds offroad time") f"Should not shutdown before {DELAY_SHUTDOWN_TIME_S} seconds offroad time")
self.assertTrue(pm.should_shutdown(ignition, in_car, self.assertTrue(pm.should_shutdown(ignition, in_car,
offroad_timestamp, offroad_timestamp,
started_seen), started_seen),
f"Should shutdown after {DELAY_SHUTDOWN_TIME_S} seconds offroad time") f"Should shutdown after {DELAY_SHUTDOWN_TIME_S} seconds offroad time")

@ -444,7 +444,7 @@ def main() -> None:
if not system_time_valid(): if not system_time_valid():
wait_helper.sleep(60) wait_helper.sleep(60)
continue continue
update_failed_count += 1 update_failed_count += 1
# check for update # check for update

@ -255,7 +255,7 @@ position_report = """
uint32 q_FltRawAlt; /* Raw height-above-ellipsoid altitude in meters as computed by WLS */ uint32 q_FltRawAlt; /* Raw height-above-ellipsoid altitude in meters as computed by WLS */
uint32 q_FltRawAltSigma; /* Gaussian 1-sigma value for raw height-above-ellipsoid altitude in meters */ uint32 q_FltRawAltSigma; /* Gaussian 1-sigma value for raw height-above-ellipsoid altitude in meters */
uint32 align_Flt[14]; uint32 align_Flt[14];
uint32 q_FltPdop; /* 3D position dilution of precision as computed from the unweighted uint32 q_FltPdop; /* 3D position dilution of precision as computed from the unweighted
uint32 q_FltHdop; /* Horizontal position dilution of precision as computed from the unweighted least-squares covariance matrix */ uint32 q_FltHdop; /* Horizontal position dilution of precision as computed from the unweighted least-squares covariance matrix */
uint32 q_FltVdop; /* Vertical position dilution of precision as computed from the unweighted least-squares covariance matrix */ uint32 q_FltVdop; /* Vertical position dilution of precision as computed from the unweighted least-squares covariance matrix */
uint8 u_EllipseConfidence; /* Statistical measure of the confidence (percentage) associated with the uncertainty ellipse values */ uint8 u_EllipseConfidence; /* Statistical measure of the confidence (percentage) associated with the uncertainty ellipse values */

Loading…
Cancel
Save