Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Closet changes #33537

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion selfdrive/locationd/calibrationd.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
PITCH_LIMITS = np.array([-0.09074112085129739, 0.17])
YAW_LIMITS = np.array([-0.06912048084718224, 0.06912048084718235])
DEBUG = os.getenv("DEBUG") is not None
TESTING_CLOSET = os.getenv("TESTING_CLOSET") is not None


def is_calibration_valid(rpy: np.ndarray) -> bool:
Expand Down Expand Up @@ -268,7 +269,7 @@ def main() -> NoReturn:
timeout = 0 if sm.frame == -1 else 100
sm.update(timeout)

calibrator.not_car = sm['carParams'].notCar
calibrator.not_car = sm['carParams'].notCar or TESTING_CLOSET

if sm.updated['cameraOdometry']:
calibrator.handle_v_ego(sm['carState'].vEgo)
Expand Down
8 changes: 4 additions & 4 deletions selfdrive/selfdrived/selfdrived.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def update_events(self, CS):
if not self.CP.pcmCruise and CS.vCruise > 250 and resume_pressed:
self.events.add(EventName.resumeBlocked)

if not self.CP.notCar:
if not self.CP.notCar and not TESTING_CLOSET:
self.events.add_from_msg(self.sm['driverMonitoringState'].events)

# Add car events, ignore if CAN isn't valid
Expand Down Expand Up @@ -277,12 +277,12 @@ def update_events(self, CS):
else:
self.logged_comm_issue = None

if not self.CP.notCar:
if not self.CP.notCar and not TESTING_CLOSET:
if not self.sm['livePose'].posenetOK:
self.events.add(EventName.posenetInvalid)
if not self.sm['livePose'].inputsOK:
self.events.add(EventName.locationdTemporaryError)
if not self.sm['liveParameters'].valid and not TESTING_CLOSET and (not SIMULATION or REPLAY):
if not self.sm['liveParameters'].valid and (not SIMULATION or REPLAY):
self.events.add(EventName.paramsdTemporaryError)

# conservative HW alert. if the data or frequency are off, locationd will throw an error
Expand Down Expand Up @@ -370,7 +370,7 @@ def data_sample(self):
self.sm.ignore_alive.append('wideRoadCameraState')
self.sm.ignore_valid.append('wideRoadCameraState')

if REPLAY and any(ps.controlsAllowed for ps in self.sm['pandaStates']):
if (REPLAY and any(ps.controlsAllowed for ps in self.sm['pandaStates'])) or TESTING_CLOSET:
self.state_machine.state = State.enabled

self.initialized = True
Expand Down
5 changes: 4 additions & 1 deletion selfdrive/ui/soundd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import math
import numpy as np
import time
Expand All @@ -13,6 +14,8 @@

from openpilot.system import micd

TESTING_CLOSET = "TESTING_CLOSET" in os.environ

SAMPLE_RATE = 48000
SAMPLE_BUFFER = 4096 # (approx 100ms)
MAX_VOLUME = 1.0
Expand Down Expand Up @@ -123,7 +126,7 @@ def get_audible_alert(self, sm):

def calculate_volume(self, weighted_db):
volume = ((weighted_db - AMBIENT_DB) / DB_SCALE) * (MAX_VOLUME - MIN_VOLUME) + MIN_VOLUME
return math.pow(10, (np.clip(volume, MIN_VOLUME, MAX_VOLUME) - 1))
return math.pow(10, (np.clip(volume, MIN_VOLUME, MAX_VOLUME) - (1 if not TESTING_CLOSET else 2)))

@retry(attempts=7, delay=3)
def get_stream(self, sd):
Expand Down
5 changes: 3 additions & 2 deletions system/loggerd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
allow_sleep = bool(os.getenv("UPLOADER_SLEEP", "1"))
force_wifi = os.getenv("FORCEWIFI") is not None
fake_upload = os.getenv("FAKEUPLOAD") is not None
TESTING_CLOSET = os.getenv("TESTING_CLOSET") is not None


class FakeRequest:
Expand Down Expand Up @@ -83,7 +84,7 @@ def __init__(self, dongle_id: str, root: str):
self.last_filename = ""

self.immediate_folders = ["crash/", "boot/"]
self.immediate_priority = {"qlog": 0, "qlog.zst": 0, "qcamera.ts": 1}
self.immediate_priority = {"qlog": 0, "qlog.zst": 0, "qcamera.ts": 1} if not TESTING_CLOSET else {"rlog": 0, "rlog.zst": 0}

def list_upload_files(self, metered: bool) -> Iterator[tuple[str, str, str]]:
r = self.params.get("AthenadRecentlyViewedRoutes", encoding="utf8")
Expand Down Expand Up @@ -170,7 +171,7 @@ def upload(self, name: str, key: str, fn: str, network_type: int, metered: bool)
if sz == 0:
# tag files of 0 size as uploaded
success = True
elif name in self.immediate_priority and sz > UPLOAD_QLOG_QCAM_MAX_SIZE:
elif name in self.immediate_priority and sz > UPLOAD_QLOG_QCAM_MAX_SIZE and not TESTING_CLOSET:
cloudlog.event("uploader_too_large", key=key, fn=fn, sz=sz)
success = True
else:
Expand Down
Loading