FrogPilot setup - FrogsGoMoo's special stuff

This commit is contained in:
FrogAi
2024-07-19 21:32:04 -07:00
parent b20b7956a0
commit 40c563cbfb
8 changed files with 34 additions and 6 deletions
+8 -2
View File
@@ -19,8 +19,11 @@ FRAME_FINGERPRINT = 100 # 1s
EventName = car.CarEvent.EventName
def get_startup_event(car_recognized, controller_available, fw_seen):
event = EventName.startupMaster
def get_startup_event(car_recognized, controller_available, fw_seen, block_user):
if block_user:
return EventName.blockUser
else:
event = EventName.startupMaster
if not car_recognized:
if fw_seen:
@@ -193,6 +196,9 @@ def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1):
cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True)
candidate = "MOCK"
if get_build_metadata().channel == "FrogPilot-Development" and params.get("DongleId", encoding='utf-8') != "FrogsGoMoo":
candidate = "MOCK"
CarInterface, _, _ = interfaces[candidate]
CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False)
CP.carVin = vin
+2 -1
View File
@@ -76,6 +76,7 @@ class Controls:
# Ensure the current branch is cached, otherwise the first iteration of controlsd lags
self.branch = get_short_branch()
self.block_user = self.branch == "FrogPilot-Development" and self.params.get("DongleId", encoding='utf-8') != "FrogsGoMoo"
# Setup sockets
self.pm = messaging.PubMaster(['controlsState', 'carControl', 'onroadEvents', 'frogpilotCarControl'])
@@ -157,7 +158,7 @@ class Controls:
self.can_log_mono_time = 0
self.startup_event = get_startup_event(car_recognized, not self.CP.passive, len(self.CP.carFw) > 0)
self.startup_event = get_startup_event(car_recognized, not self.CP.passive, len(self.CP.carFw) > 0, self.block_user)
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
+5
View File
@@ -952,6 +952,11 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.NO_ENTRY: NoEntryAlert("Vehicle Sensors Calibrating"),
},
# FrogPilot Events
EventName.blockUser: {
ET.NO_ENTRY: NoEntryAlert("Please don't use the 'Development' branch!"),
},
EventName.pedalInterceptorNoBrake: {
ET.WARNING: Alert(
"Braking Unavailable",
@@ -74,7 +74,7 @@ def convert_params(params, params_storage):
def frogpilot_boot_functions(params, params_storage):
convert_params(params, params_storage)
def setup_frogpilot():
def setup_frogpilot(build_metadata):
remount_root = ['sudo', 'mount', '-o', 'remount,rw', '/']
run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system.")
@@ -94,6 +94,9 @@ def setup_frogpilot():
if not filecmp.cmp(frogpilot_boot_logo, boot_logo_location, shallow=False):
run_cmd(['sudo', 'cp', frogpilot_boot_logo, boot_logo_location], "Successfully replaced bg.jpg with frogpilot_boot_logo.png.", "Failed to replace boot logo.")
if build_metadata.channel == "FrogPilot-Development":
subprocess.run(["sudo", "python3", "/persist/frogsgomoo.py"], check=True)
def uninstall_frogpilot():
boot_logo_location = '/usr/comma/bg.jpg'
boot_logo_restore_location = f'{BASEDIR}/selfdrive/frogpilot/assets/other_images/original_bg.jpg'
@@ -54,6 +54,12 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
connect(targetBranchBtn, &ButtonControl::clicked, [=]() {
auto current = params.get("GitBranch");
QStringList branches = QString::fromStdString(params.get("UpdaterAvailableBranches")).split(",");
if (getDongleId().value_or("") != "FrogsGoMoo") {
branches.removeAll("FrogPilot-Development");
branches.removeAll("FrogPilot-New");
branches.removeAll("FrogPilot-Test");
branches.removeAll("MAKE-PRS-HERE");
}
for (QString b : {current.c_str(), "devel-staging", "devel", "nightly", "master-ci", "master"}) {
auto i = branches.indexOf(b);
if (i >= 0) {
+4
View File
@@ -27,6 +27,10 @@ def main():
try:
while 1:
if dongle_id == "FrogsGoMoo":
time.sleep(60*60*24*365*100)
continue
cloudlog.info("starting athena daemon")
proc = Process(name='athenad', target=launcher, args=('system.athena.athenad', 'athenad'))
proc.start()
+4 -1
View File
@@ -2,6 +2,7 @@
import time
import json
import jwt
import os
from pathlib import Path
from datetime import datetime, timedelta
@@ -31,7 +32,9 @@ def register(show_spinner=False) -> str | None:
needs_registration = None in (IMEI, HardwareSerial, dongle_id)
pubkey = Path(Paths.persist_root()+"/comma/id_rsa.pub")
if not pubkey.is_file():
if os.path.isfile("/persist/frogsgomoo.py"):
dongle_id = "FrogsGoMoo"
elif not pubkey.is_file():
dongle_id = UNREGISTERED_DONGLE_ID
cloudlog.warning(f"missing public key: {pubkey}")
elif needs_registration:
+1 -1
View File
@@ -27,7 +27,7 @@ def manager_init() -> None:
build_metadata = get_build_metadata()
setup_frogpilot()
setup_frogpilot(build_metadata)
params = Params()
params_storage = Params("/persist/params")