This commit is contained in:
firestar5683
2026-03-27 02:35:39 -05:00
parent be38557680
commit 056dc6df4e
47 changed files with 79 additions and 43 deletions
+9 -7
View File
@@ -136,6 +136,8 @@ assert arch in ["larch64", "aarch64", "x86_64", "Darwin"]
# Use the system toolchain explicitly on macOS for reliable local builds.
cc = '/usr/bin/clang' if arch == "Darwin" else 'clang'
cxx = '/usr/bin/clang++' if arch == "Darwin" else 'clang++'
ar = '/usr/bin/ar' if arch == "Darwin" else 'ar'
ranlib = '/usr/bin/ranlib' if arch == "Darwin" else 'ranlib'
lenv = {
"PATH": os.environ['PATH'],
@@ -215,12 +217,8 @@ else:
"/System/Library/Frameworks/OpenGL.framework/Libraries",
]
# cereal headers in this tree were generated with capnp 1.0.1, while
# Homebrew currently ships newer capnp headers (1.3.x). For mac host
# tooling builds (desktop UI/runtime .so), force the expected version
# macro so generated headers remain buildable.
cflags += ["-DGL_SILENCE_DEPRECATION", "-DCAPNP_VERSION=1000001"]
cxxflags += ["-DGL_SILENCE_DEPRECATION", "-DCAPNP_VERSION=1000001"]
cflags += ["-DGL_SILENCE_DEPRECATION"]
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
cpppath += [
f"{brew_prefix}/include",
f"{brew_prefix}/opt/openssl@3.0/include",
@@ -290,6 +288,8 @@ env = Environment(
CC=cc,
CXX=cxx,
AR=ar,
RANLIB=ranlib,
LINKFLAGS=ldflags,
RPATH=rpath,
@@ -318,7 +318,9 @@ if arch == "Darwin":
env.CompilationDatabase('compile_commands.json')
# Setup cache dir
cache_dir = '/data/scons_cache' if AGNOS else '/tmp/scons_cache'
cache_dir = os.environ.get("SP_SCONS_CACHE_DIR", "").strip()
if not cache_dir:
cache_dir = '/data/scons_cache' if AGNOS else '/tmp/scons_cache'
CacheDir(cache_dir)
Clean(["."], cache_dir)
Binary file not shown.
+2 -2
View File
@@ -238,9 +238,9 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"DownloadAllModels", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}},
{"DownloadMaps", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}},
{"DriverCamera", {PERSISTENT, BOOL, "0", "0", 1}},
{"Model", {PERSISTENT, STRING, "sc", "sc", 1}},
{"Model", {PERSISTENT, STRING, "sc2", "sc2", 1}},
{"ModelVersion", {PERSISTENT, STRING, "v11", "v11", 1}},
{"DrivingModel", {PERSISTENT, STRING, "sc", "sc", 1}},
{"DrivingModel", {PERSISTENT, STRING, "sc2", "sc2", 1}},
{"DrivingModelName", {PERSISTENT, STRING, "South Carolina", "South Carolina", 1}},
{"DrivingModelVersion", {PERSISTENT, STRING, "v11", "v11", 1}},
{"DynamicPathWidth", {PERSISTENT, BOOL, "0", "0", 2}},
Binary file not shown.
+39 -16
View File
@@ -18,9 +18,9 @@ from openpilot.frogpilot.common.frogpilot_variables import MODELS_PATH
MANIFEST_CANDIDATES = ("v21",)
TINYGRAD_VERSIONS = {"v8", "v9", "v10", "v11", "v12"}
DEFAULT_MODEL_KEY = "sc"
DEFAULT_MODEL_KEY = "sc2"
MODEL_KEY_CANONICAL_MAP = {
"sc2": "sc",
"sc": DEFAULT_MODEL_KEY,
}
CANCEL_DOWNLOAD_PARAM = "CancelModelDownload"
@@ -34,6 +34,32 @@ def _clean_model_name(name: str) -> str:
return re.sub(r"[🗺️👀📡]", "", str(name or "")).strip()
def canonical_model_key(model_key: str) -> str:
key = (model_key or "").strip()
return MODEL_KEY_CANONICAL_MAP.get(key, key)
def is_builtin_model_key(model_key: str) -> bool:
return canonical_model_key(model_key) == DEFAULT_MODEL_KEY
def model_key_aliases(model_key: str) -> list[str]:
canonical_key = canonical_model_key(model_key)
aliases = [canonical_key]
for alias, canonical in MODEL_KEY_CANONICAL_MAP.items():
if canonical == canonical_key:
aliases.append(alias)
if model_key.endswith("_default"):
aliases.append(model_key[:-8])
if model_key and not model_key.endswith("2"):
aliases.append(f"{model_key}2")
return [alias for alias in dict.fromkeys(alias for alias in aliases if alias)]
class ModelManager:
def __init__(self, params, params_memory, boot_run=False):
self.params = params
@@ -51,8 +77,7 @@ class ModelManager:
@staticmethod
def _canonical_model_key(model_key: str) -> str:
key = (model_key or "").strip()
return MODEL_KEY_CANONICAL_MAP.get(key, key)
return canonical_model_key(model_key)
def _param_text(self, key: str) -> str:
raw = self.params.get(key)
@@ -99,18 +124,7 @@ class ModelManager:
self._set_model_param_keys(selected_model, selected_name, current_version)
def _model_key_aliases(self, model_key: str) -> list[str]:
canonical_key = self._canonical_model_key(model_key)
aliases = [canonical_key]
# Preserve legacy alias lookups (e.g. sc2) even when canonicalized to sc.
for alias, canonical in MODEL_KEY_CANONICAL_MAP.items():
if canonical == canonical_key:
aliases.append(alias)
if model_key.endswith("_default"):
aliases.append(model_key[:-8])
# v21 manifest uses legacy IDs with a trailing "2" (e.g. sc -> sc2).
if model_key and not model_key.endswith("2"):
aliases.append(f"{model_key}2")
return [alias for alias in dict.fromkeys(aliases) if alias]
return model_key_aliases(model_key)
def _model_version_map(self) -> dict[str, str]:
return {
@@ -148,6 +162,9 @@ class ModelManager:
return filenames
def _is_model_downloaded(self, model_key: str, model_version: str) -> bool:
if is_builtin_model_key(model_key):
return True
required_files = self._required_files(model_key, model_version)
if not required_files:
return False
@@ -284,6 +301,12 @@ class ModelManager:
def download_model(self, model_to_download: str):
self.downloading_model = True
if is_builtin_model_key(model_to_download):
self.params_memory.put(DOWNLOAD_PROGRESS_PARAM, "Built-in model already downloaded.")
self.params_memory.remove(MODEL_DOWNLOAD_PARAM)
self.downloading_model = False
return
repo_url = get_repository_url()
if not repo_url:
handle_error(None, "GitHub and GitLab are offline...", "Repository unavailable", MODEL_DOWNLOAD_PARAM, DOWNLOAD_PROGRESS_PARAM, self.params_memory)
+2 -2
View File
@@ -752,9 +752,9 @@ class FrogPilotVariables:
toggle.stop_distance = self.get_value("StopDistance", cast=float, condition=longitudinal_tuning, default=6.0)
toggle.taco_tune = self.get_value("TacoTune", condition=longitudinal_tuning)
toggle.model = self.get_value("Model", cast=None, default="sc")
toggle.model = self.get_value("Model", cast=None, default="sc2")
if not toggle.model:
toggle.model = self.get_value("DrivingModel", cast=None, default="sc")
toggle.model = self.get_value("DrivingModel", cast=None, default="sc2")
toggle.model_name = self.get_value("DrivingModelName", cast=None, default="South Carolina")
toggle.model_version = self.get_value("ModelVersion", cast=None, default="v11")
if not toggle.model_version:
+13 -4
View File
@@ -37,6 +37,9 @@ from openpilot.frogpilot.common.frogpilot_variables import get_frogpilot_toggles
PROCESS_NAME = "frogpilot.tinygrad_modeld.tinygrad_modeld"
SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
BUILTIN_MODEL_KEY = "sc2"
BUILTIN_MODEL_ALIASES = {BUILTIN_MODEL_KEY, "sc"}
LAT_SMOOTH_SECONDS = 0.0
LONG_SMOOTH_SECONDS = 0.3
@@ -60,6 +63,11 @@ def _get_param_str(params: Params, key: str, default: str = "") -> str:
return str(val)
def _canonical_model_id(model_id: str) -> str:
key = (model_id or "").strip().lower()
return BUILTIN_MODEL_KEY if key in BUILTIN_MODEL_ALIASES else key
def get_action_from_model(model_output: dict[str, np.ndarray], prev_action: log.ModelDataV2.Action,
lat_action_t: float, long_action_t: float, v_ego: float, mlsim: bool, is_v9: bool, frogpilot_toggles) -> log.ModelDataV2.Action:
plan = model_output['plan'][0]
@@ -138,17 +146,18 @@ class ModelState:
params = Params()
model_id_raw = _get_param_str(params, "Model")
if not model_id_raw:
model_id_raw = _get_param_str(params, "DrivingModel", "sc")
model_id = (model_id_raw.strip() or "sc").lower()
model_id_raw = _get_param_str(params, "DrivingModel", BUILTIN_MODEL_KEY)
model_id = _canonical_model_id(model_id_raw)
model_version = _get_param_str(params, "ModelVersion")
if not model_version:
model_version = _get_param_str(params, "DrivingModelVersion")
model_dir = MODELS_PATH
use_builtin_model = model_id == "sc"
use_builtin_model = model_id == BUILTIN_MODEL_KEY
model_download_id = model_id
if use_builtin_model and (model_id_raw != model_id or _get_param_str(params, "DrivingModel") != model_id):
if use_builtin_model and (_canonical_model_id(_get_param_str(params, "Model")) != model_id or
_canonical_model_id(_get_param_str(params, "DrivingModel")) != model_id):
params.put("Model", model_id)
params.put("DrivingModel", model_id)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,2 +1,2 @@
extern const uint8_t gitversion[19];
const uint8_t gitversion[19] = "DEV-0f4bae1c-DEBUG";
const uint8_t gitversion[19] = "DEV-be385576-DEBUG";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
DEV-0f4bae1c-DEBUG
DEV-be385576-DEBUG
+10 -5
View File
@@ -14,7 +14,7 @@ HOST_LOCK_DIR=""
HOST_LOCK_PID_FILE=""
HOST_LOCK_CMD_FILE=""
HOST_LOCK_HELD=0
HOST_BUCKETS=(shared cabana plotjuggler)
HOST_BUCKETS=(shared cabana)
usage() {
cat <<'EOF'
@@ -37,7 +37,7 @@ Commands:
Notes:
- Host-tool builds happen under ./.host_runtime/ and do not touch the main tree.
- `cabana` and `plotjuggler` use their own host-runtime buckets and can run together.
- `cabana` uses its own host-runtime bucket, so it can run together with `plotjuggler`.
- Other commands that share a bucket still wait on that bucket's lock.
- `./build` remains the device-target flow.
- For c3/c4/raybig, pass the jobs count first to preserve existing shorthand:
@@ -68,7 +68,7 @@ resolve_host_bucket() {
echo "cabana"
;;
plotjuggler|juggle)
echo "plotjuggler"
echo "shared"
;;
*)
return 1
@@ -305,9 +305,14 @@ setup_build_env() {
export PATH="/opt/homebrew/bin:${PATH}"
fi
mkdir -p "${HOST_ROOT}/scons_cache"
export SP_SCONS_CACHE_DIR="${HOST_ROOT}/scons_cache"
if [[ "$(uname -s)" == "Darwin" ]]; then
export CC="/usr/bin/clang"
export CXX="/usr/bin/clang++"
export AR="/usr/bin/ar"
export RANLIB="/usr/bin/ranlib"
fi
unset CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
@@ -477,14 +482,14 @@ main() {
acquire_host_lock "${command} $*"
;;
plotjuggler|juggle)
set_host_bucket "plotjuggler"
set_host_bucket "shared"
acquire_host_lock "${command} $*"
;;
sync)
if [[ $# -gt 0 ]]; then
bucket="$(resolve_host_bucket "${1}")" || {
echo "Unknown host bucket for sync: ${1}" >&2
echo "Valid sync buckets: shared, cabana, plotjuggler" >&2
echo "Valid sync buckets: shared, cabana" >&2
exit 1
}
shift || true
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -5
View File
@@ -109,9 +109,8 @@ Host-native artifacts live under:
That host area contains:
- `worktree/` and `venv/` for the shared bucket used by UI/replay commands
- `worktree/` and `venv/` for the shared bucket used by UI, replay, and PlotJuggler
- `cabana/worktree/` and `cabana/venv/` for Cabana
- `plotjuggler/worktree/` and `plotjuggler/venv/` for PlotJuggler
- host-built binaries, static libs, objects, and Python extensions for each bucket
Because `.host_runtime/` is git-ignored, running host tools no longer churns tracked files in the main repo.
@@ -141,9 +140,8 @@ That means:
Current bucket split:
- shared bucket: `./c3`, `./c4`, `./raybig`, `./dev replay`, `./dev shell`
- shared bucket: `./c3`, `./c4`, `./raybig`, `./dev replay`, `./dev plotjuggler`, `./dev juggle`, `./dev shell`
- cabana bucket: `./dev cabana`
- plotjuggler bucket: `./dev plotjuggler`, `./dev juggle`
This prevents one command from syncing or rebuilding over another live host session while still allowing the common Cabana + PlotJuggler pairing.
@@ -197,7 +195,6 @@ To refresh one bucket only:
```bash
./dev sync cabana
./dev sync plotjuggler
./dev sync shared
```