FrogPilot setup - FrogPilot branding

This commit is contained in:
FrogAi 2024-05-29 03:22:15 -07:00
parent e8743bb8c9
commit 1cfa307f80
10 changed files with 58 additions and 6 deletions

View File

@ -564,3 +564,5 @@ tinygrad_repo/tinygrad/runtime/ops_disk.py
tinygrad_repo/tinygrad/runtime/ops_gpu.py tinygrad_repo/tinygrad/runtime/ops_gpu.py
tinygrad_repo/tinygrad/shape/* tinygrad_repo/tinygrad/shape/*
tinygrad_repo/tinygrad/*.py tinygrad_repo/tinygrad/*.py
selfdrive/frogpilot/controls/lib/frogpilot_functions.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -228,7 +228,7 @@ def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
if "REPLAY" in os.environ: if "REPLAY" in os.environ:
branch = "replay" branch = "replay"
return StartupAlert("WARNING: This branch is not tested", branch, alert_status=AlertStatus.userPrompt) return StartupAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot)
def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage") return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage")

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

View File

@ -0,0 +1,45 @@
import filecmp
import os
import shutil
import subprocess
from openpilot.common.basedir import BASEDIR
from openpilot.system.hardware import HARDWARE
class FrogPilotFunctions:
@classmethod
def run_cmd(cls, cmd, success_msg, fail_msg):
try:
subprocess.check_call(cmd)
print(success_msg)
except subprocess.CalledProcessError as e:
print(f"{fail_msg}: {e}")
except Exception as e:
print(f"Unexpected error occurred: {e}")
@classmethod
def setup_frogpilot(cls):
frogpilot_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/frogpilot_boot_logo.png'
boot_logo_location = '/usr/comma/bg.jpg'
boot_logo_save_location = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
remount_root = ['sudo', 'mount', '-o', 'remount,rw', '/']
cls.run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system.")
if not os.path.exists(boot_logo_save_location):
shutil.copy(boot_logo_location, boot_logo_save_location)
print("Successfully backed up the original boot logo.")
if not filecmp.cmp(frogpilot_boot_logo, boot_logo_location, shallow=False):
copy_cmd = ['sudo', 'cp', frogpilot_boot_logo, boot_logo_location]
cls.run_cmd(copy_cmd, "Successfully replaced bg.jpg with frogpilot_boot_logo.png.", "Failed to replace boot logo.")
@classmethod
def uninstall_frogpilot(cls):
original_boot_logo = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
boot_logo_location = '/usr/comma/bg.jpg'
copy_cmd = ['sudo', 'cp', original_boot_logo, boot_logo_location]
cls.run_cmd(copy_cmd, "Successfully restored the original boot logo.", "Failed to restore the original boot logo.")
HARDWARE.uninstall()

View File

@ -2,6 +2,7 @@
import datetime import datetime
import os import os
import signal import signal
import subprocess
import sys import sys
import traceback import traceback
@ -20,6 +21,7 @@ from openpilot.system.version import is_dirty, get_commit, get_version, get_orig
get_normalized_origin, terms_version, training_version, \ get_normalized_origin, terms_version, training_version, \
is_tested_branch, is_release_branch, get_commit_date is_tested_branch, is_release_branch, get_commit_date
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import FrogPilotFunctions
def manager_init() -> None: def manager_init() -> None:
@ -175,7 +177,9 @@ def manager_thread() -> None:
break break
def main() -> None: def main(frogpilot_functions) -> None:
frogpilot_functions.setup_frogpilot()
manager_init() manager_init()
if os.getenv("PREPAREONLY") is not None: if os.getenv("PREPAREONLY") is not None:
return return
@ -194,7 +198,7 @@ def main() -> None:
params = Params() params = Params()
if params.get_bool("DoUninstall"): if params.get_bool("DoUninstall"):
cloudlog.warning("uninstalling") cloudlog.warning("uninstalling")
HARDWARE.uninstall() frogpilot_functions.uninstall_frogpilot()
elif params.get_bool("DoReboot"): elif params.get_bool("DoReboot"):
cloudlog.warning("reboot") cloudlog.warning("reboot")
HARDWARE.reboot() HARDWARE.reboot()
@ -207,7 +211,7 @@ if __name__ == "__main__":
unblock_stdout() unblock_stdout()
try: try:
main() main(FrogPilotFunctions())
except KeyboardInterrupt: except KeyboardInterrupt:
print("got CTRL-C, exiting") print("got CTRL-C, exiting")
except Exception: except Exception:

View File

@ -88,7 +88,7 @@ Spinner::Spinner(QWidget *parent) : QWidget(parent) {
} }
QProgressBar::chunk { QProgressBar::chunk {
border-radius: 10px; border-radius: 10px;
background-color: white; background-color: rgba(23, 134, 68, 255);
} }
)"); )");

View File

@ -26,7 +26,7 @@ QString getVersion() {
} }
QString getBrand() { QString getBrand() {
return QObject::tr("openpilot"); return QObject::tr("FrogPilot");
} }
QString getUserAgent() { QString getUserAgent() {

View File

@ -127,6 +127,7 @@ static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
{cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)}, {cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(0xDA, 0x6F, 0x25, 0xf1)}, {cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(0xDA, 0x6F, 0x25, 0xf1)},
{cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)}, {cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)},
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(0x17, 0x86, 0x44, 0xf1)},
}; };
typedef struct UIScene { typedef struct UIScene {