Skip to content

Commit

Permalink
📄 Add Toggle to Enable Automatic Raw Log Uploading
Browse files Browse the repository at this point in the history
Brings back the raw log toggle that was used prior to version
8.12.

Upload RLogs First then Videos

This reverts in part commit 2e0c73f.
  • Loading branch information
krkeegan committed Feb 23, 2022
1 parent 80b9f02 commit c8a5e91
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions selfdrive/common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"TrainingVersion", PERSISTENT},
{"UpdateAvailable", CLEAR_ON_MANAGER_START},
{"UpdateFailedCount", CLEAR_ON_MANAGER_START},
{"UploadRaw", PERSISTENT},
{"Version", PERSISTENT},
{"VisionRadarToggle", PERSISTENT},
{"ApiCache_Device", PERSISTENT},
Expand Down
23 changes: 21 additions & 2 deletions selfdrive/loggerd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ def __init__(self, dongle_id, root):

self.immediate_folders = ["crash/", "boot/"]
self.immediate_priority = {"qlog.bz2": 0, "qcamera.ts": 1}
self.high_priority = {"rlog.bz2": 0}
self.normal_priority = {"fcamera.hevc": 1, "dcamera.hevc": 2, "ecamera.hevc": 3}

def get_upload_sort(self, name):
if name in self.immediate_priority:
return self.immediate_priority[name]
if name in self.high_priority:
return self.high_priority[name] + 100
if name in self.normal_priority:
return self.normal_priority[name] + 300
return 1000

def list_upload_files(self):
Expand Down Expand Up @@ -114,7 +120,7 @@ def list_upload_files(self):

yield (name, key, fn)

def next_file_to_upload(self):
def next_file_to_upload(self, with_raw):
upload_files = list(self.list_upload_files())

for name, key, fn in upload_files:
Expand All @@ -125,6 +131,17 @@ def next_file_to_upload(self):
if name in self.immediate_priority:
return (key, fn)

if with_raw:
# then upload the full log files, rear and front camera files
for name, key, fn in upload_files:
if name in self.high_priority:
return (key, fn)

# Could add a param here to disable full video uploads
for name, key, fn in upload_files:
if name in self.normal_priority:
return (key, fn)

return None

def do_upload(self, key, fn):
Expand Down Expand Up @@ -237,7 +254,9 @@ def uploader_fn(exit_event):
time.sleep(60 if offroad else 5)
continue

d = uploader.next_file_to_upload()
allow_raw_upload = params.get_bool("UploadRaw")

d = uploader.next_file_to_upload(with_raw=allow_raw_upload)
if d is None: # Nothing to upload
if allow_sleep:
time.sleep(60 if offroad else 5)
Expand Down
6 changes: 6 additions & 0 deletions selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
"Pressing the gas pedal will NOT disengage openpilot, while this is the default design for Toyota, this is NOT enabled by default for OpenPilot. Use at your own risk!!",
"../assets/offroad/icon_gas.png",
},
{
"UploadRaw",
"Upload Raw Logs",
"Upload full logs and full resolution video by default while on Wi-Fi. If not enabled, individual logs can be marked for upload at useradmin.comma.ai.",
"../assets/offroad/icon_network.png",
},
{
"RecordFront",
"Record and Upload Driver Camera",
Expand Down

0 comments on commit c8a5e91

Please sign in to comment.