From 30778bf908f8f9d43cd04918a95196250c616202 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 8 Apr 2026 21:27:33 -0500 Subject: [PATCH] logg --- cereal/custom.capnp | 6 ++++++ cereal/services.h | 2 +- cereal/services.py | 1 + starpilot/system/the_pond/the_pond.py | 17 +++++++++++------ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cereal/custom.capnp b/cereal/custom.capnp index 4f071c10..c5a3bd5c 100644 --- a/cereal/custom.capnp +++ b/cereal/custom.capnp @@ -239,6 +239,12 @@ struct StarPilotSelfdriveState @0xf416ec09499d9d19 { } struct CustomReserved9 @0xa1680744031fdb2d { + slotId @0 :Text; + slotName @1 :Text; + variant @2 :Text; + variantLabel @3 :Text; + reason @4 :Text; + wallTimeNanos @5 :UInt64; } struct CustomReserved10 @0xcb9fd56c7057593a { diff --git a/cereal/services.h b/cereal/services.h index 5f0e3e3c..4e73a93a 100644 --- a/cereal/services.h +++ b/cereal/services.h @@ -81,6 +81,7 @@ static std::map services = { { "livestreamWideRoadEncodeData", {"livestreamWideRoadEncodeData", false, 20.000000, -1, 2097152}}, { "livestreamRoadEncodeData", {"livestreamRoadEncodeData", false, 20.000000, -1, 2097152}}, { "livestreamDriverEncodeData", {"livestreamDriverEncodeData", false, 20.000000, -1, 2097152}}, + { "customReserved9", {"customReserved9", true, 0.000000, 1, 256000}}, { "customReservedRawData0", {"customReservedRawData0", true, 0.000000, -1, 256000}}, { "customReservedRawData1", {"customReservedRawData1", true, 0.000000, -1, 256000}}, { "customReservedRawData2", {"customReservedRawData2", true, 0.000000, -1, 256000}}, @@ -98,4 +99,3 @@ static std::map services = { { "mapdOut", {"mapdOut", true, 20.000000, 20, 2097152}}, }; #endif - diff --git a/cereal/services.py b/cereal/services.py index 407e5db2..2e326c69 100755 --- a/cereal/services.py +++ b/cereal/services.py @@ -100,6 +100,7 @@ _services: dict[str, tuple] = { "livestreamWideRoadEncodeData": (False, 20., None, QueueSize.MEDIUM), "livestreamRoadEncodeData": (False, 20., None, QueueSize.MEDIUM), "livestreamDriverEncodeData": (False, 20., None, QueueSize.MEDIUM), + "customReserved9": (True, 0., 1), "customReservedRawData0": (True, 0.), "customReservedRawData1": (True, 0.), "customReservedRawData2": (True, 0.), diff --git a/starpilot/system/the_pond/the_pond.py b/starpilot/system/the_pond/the_pond.py index 76bac075..6619369c 100644 --- a/starpilot/system/the_pond/the_pond.py +++ b/starpilot/system/the_pond/the_pond.py @@ -99,7 +99,7 @@ send_from_directory = None _POND_WEB_DEPS_READY = False _POND_WEB_DEPS_ERROR = None -_TESTING_GROUND_CUSTOM_RESERVED_SERVICE = "customReservedRawData0" +_TESTING_GROUND_CUSTOM_RESERVED_SERVICE = "customReserved9" _TESTING_GROUND_CUSTOM_RESERVED_INTERVAL_S = 15.0 _TESTING_GROUND_CUSTOM_RESERVED_PM = None _TESTING_GROUND_CUSTOM_RESERVED_LOCK = threading.Lock() @@ -2807,23 +2807,28 @@ def _get_testing_ground_custom_reserved_pm(): def _build_testing_ground_custom_reserved_payload(state, reason): serialized = _serialize_testing_grounds_state(state) return { - "type": "testingGroundState", - "reason": reason, "slotId": serialized["activeSlot"], "slotName": serialized["activeSlotName"], "variant": serialized["activeVariant"], "variantLabel": serialized["activeVariantLabel"], - "publishedAt": datetime.now(timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z"), + "reason": reason, + "wallTimeNanos": time.time_ns(), } def _publish_testing_ground_custom_reserved(state, reason): global _TESTING_GROUND_CUSTOM_RESERVED_LAST_PUBLISH_MONO payload = _build_testing_ground_custom_reserved_payload(state, reason) + message_valid = str(payload.get("variant") or "").strip().upper() == "B" try: - message = messaging.new_message(_TESTING_GROUND_CUSTOM_RESERVED_SERVICE) - message.customReservedRawData0 = json.dumps(payload, separators=(",", ":"), allow_nan=False).encode("utf-8") + message = messaging.new_message(_TESTING_GROUND_CUSTOM_RESERVED_SERVICE, valid=message_valid) + message.customReserved9.slotId = payload["slotId"] + message.customReserved9.slotName = payload["slotName"] + message.customReserved9.variant = payload["variant"] + message.customReserved9.variantLabel = payload["variantLabel"] + message.customReserved9.reason = payload["reason"] + message.customReserved9.wallTimeNanos = payload["wallTimeNanos"] _get_testing_ground_custom_reserved_pm().send(_TESTING_GROUND_CUSTOM_RESERVED_SERVICE, message) except Exception: return