This commit is contained in:
firestar5683
2026-04-08 21:27:33 -05:00
parent 5b3229576a
commit 30778bf908
4 changed files with 19 additions and 7 deletions
+6
View File
@@ -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 {
+1 -1
View File
@@ -81,6 +81,7 @@ static std::map<std::string, service> 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<std::string, service> services = {
{ "mapdOut", {"mapdOut", true, 20.000000, 20, 2097152}},
};
#endif
+1
View File
@@ -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.),
+11 -6
View File
@@ -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