wip
This commit is contained in:
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 257 KiB |
0
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file → Executable file
0
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
0
selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc
Normal file → Executable file
0
selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc
Normal file → Executable file
0
selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc
Normal file → Executable file
@@ -27,26 +27,42 @@ def nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str) -> None
|
|||||||
with open(log_path, 'a') as log_file:
|
with open(log_path, 'a') as log_file:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
proc = subprocess.Popen(pargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True)
|
proc = subprocess.Popen(pargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True)
|
||||||
|
log_file.write("Started "+name)
|
||||||
for line in proc.stdout:
|
for line in proc.stdout:
|
||||||
print(line, end='')
|
print(line, end='')
|
||||||
log_file.write(line)
|
log_file.write(line)
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
def launcher(proc: str, name: str, log_path: str) -> None:
|
def launcher(proc: str, name: str, log_path: str) -> None:
|
||||||
try:
|
while True:
|
||||||
mod = importlib.import_module(proc)
|
try:
|
||||||
setproctitle(proc)
|
# Initialize the module and setup the process title and logging
|
||||||
messaging.context = messaging.Context()
|
mod = importlib.import_module(proc)
|
||||||
cloudlog.bind(daemon=name)
|
setproctitle(name)
|
||||||
sentry.set_tag("daemon", name)
|
messaging.context = messaging.Context()
|
||||||
with open(log_path, 'a') as log_file, subprocess.Popen(['python', '-m', proc], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc:
|
cloudlog.bind(daemon=name)
|
||||||
for line in proc.stdout:
|
sentry.set_tag("daemon", name)
|
||||||
print(line, end='')
|
|
||||||
log_file.write(line)
|
# Command to run the process
|
||||||
proc.wait()
|
command = ['python', '-m', proc]
|
||||||
except Exception:
|
|
||||||
sentry.capture_exception()
|
# Open the log file and start the subprocess
|
||||||
raise
|
with open(log_path, 'a') as log_file, subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc_instance:
|
||||||
|
log_file.write(f"Started {name}\n")
|
||||||
|
|
||||||
|
# Process the output from the subprocess
|
||||||
|
for line in iter(proc_instance.stdout.readline, ''):
|
||||||
|
print(line, end='')
|
||||||
|
log_file.write(line)
|
||||||
|
|
||||||
|
# Wait for the subprocess to terminate
|
||||||
|
proc_instance.wait()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Log the error and restart the process after logging the exception
|
||||||
|
print(f"Fatal: {name}")
|
||||||
|
print(e)
|
||||||
|
sentry.capture_exception()
|
||||||
|
|
||||||
def join_process(process: Process, timeout: float) -> None:
|
def join_process(process: Process, timeout: float) -> None:
|
||||||
t = time.monotonic()
|
t = time.monotonic()
|
||||||
@@ -215,14 +231,13 @@ class DaemonProcess(ManagerProcess):
|
|||||||
except OSError:
|
except OSError:
|
||||||
pass # Process not running, continue to start it
|
pass # Process not running, continue to start it
|
||||||
|
|
||||||
log_file_path = os.path.join(log_path, f"{self.name}.log")
|
|
||||||
self.params.put(self.param_name, str(self.proc.pid))
|
|
||||||
cloudlog.info(f"starting daemon {self.name}")
|
cloudlog.info(f"starting daemon {self.name}")
|
||||||
self.proc = subprocess.Popen(['python', '-m', self.module],
|
self.proc = subprocess.Popen(['python', '-m', self.module],
|
||||||
stdin=open('/dev/null'),
|
stdin=open('/dev/null'),
|
||||||
stdout=open(log_file_path, 'a'),
|
stdout=open(log_path, 'a'),
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
preexec_fn=os.setpgrp)
|
preexec_fn=os.setpgrp)
|
||||||
|
self.params.put(self.param_name, str(self.proc.pid))
|
||||||
|
|
||||||
def stop(self, retry=True, block=True, sig=None) -> None:
|
def stop(self, retry=True, block=True, sig=None) -> None:
|
||||||
pass
|
pass
|
||||||
@@ -237,7 +252,7 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None
|
|||||||
running = []
|
running = []
|
||||||
for p in procs:
|
for p in procs:
|
||||||
if p.enabled and p.name not in not_run and p.should_run(started, params, CP):
|
if p.enabled and p.name not in not_run and p.should_run(started, params, CP):
|
||||||
if p.proc is None or p.proc.exitcode is not None:
|
if p.proc is None or (hasattr(p.proc, 'exitcode') and p.proc.exitcode is not None):
|
||||||
p.start()
|
p.start()
|
||||||
running.append(p)
|
running.append(p)
|
||||||
else:
|
else:
|
||||||
@@ -245,4 +260,4 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None
|
|||||||
|
|
||||||
p.check_watchdog(started)
|
p.check_watchdog(started)
|
||||||
|
|
||||||
return running
|
return running
|
||||||
|
|||||||
0
system/clearpilot/dev/on_start_brian.sh.cpt
Normal file → Executable file
0
system/clearpilot/dev/on_start_brian.sh.cpt
Normal file → Executable file
Reference in New Issue
Block a user