radard: remove sleep for cars without radar (#31467)

* radard: remove sleep for cars without radar

* fix

* update refs
This commit is contained in:
Adeeb Shihadeh
2024-02-14 13:12:54 -08:00
committed by GitHub
parent 194bd85905
commit 6f905ed979
5 changed files with 6 additions and 13 deletions
+5 -5
View File
@@ -1,6 +1,5 @@
import json
import os
import time
import numpy as np
import tomllib
from abc import abstractmethod, ABC
@@ -322,13 +321,14 @@ class RadarInterfaceBase(ABC):
self.pts = {}
self.delay = 0
self.radar_ts = CP.radarTimeStep
self.frame = 0
self.no_radar_sleep = 'NO_RADAR_SLEEP' in os.environ
def update(self, can_strings):
ret = car.RadarData.new_message()
if not self.no_radar_sleep:
time.sleep(self.radar_ts) # radard runs on RI updates
return ret
self.frame += 1
if (self.frame % int(100 * self.radar_ts)) == 0:
return car.RadarData.new_message()
return None
class CarStateBase(ABC):
@@ -46,11 +46,6 @@ def get_fuzzy_car_interface_args(draw: DrawType) -> dict:
class TestCarInterfaces(unittest.TestCase):
@classmethod
def setUpClass(cls):
os.environ['NO_RADAR_SLEEP'] = '1'
# FIXME: Due to the lists used in carParams, Phase.target is very slow and will cause
# many generated examples to overrun when max_examples > ~20, don't use it
@parameterized.expand([(car,) for car in sorted(all_known_cars())])
-1
View File
@@ -234,7 +234,6 @@ class TestCarModelBase(unittest.TestCase):
self.assertEqual(can_invalid_cnt, 0)
def test_radar_interface(self):
os.environ['NO_RADAR_SLEEP'] = "1"
RadarInterface = importlib.import_module(f'selfdrive.car.{self.CP.carName}.radar_interface').RadarInterface
RI = RadarInterface(self.CP)
assert RI
@@ -762,7 +762,6 @@ def generate_environ_config(CP=None, fingerprint=None, log_dir=None) -> Dict[str
if log_dir is not None:
environ_dict["LOG_ROOT"] = log_dir
environ_dict["NO_RADAR_SLEEP"] = "1"
environ_dict["REPLAY"] = "1"
# Regen or python process
+1 -1
View File
@@ -1 +1 @@
bd44a98bdb248f3c7b988f81ee130c2542b18ae7
7d25b1f7d0bd3b506fa4e72ff893728894eb1a45