Align Nav2 with physics time and preserve complete simulation scenes

This commit is contained in:
DCCONSTRUCTIONS
2026-10-09 22:15:20 +03:00
parent 3376b1a9e6
commit 16865574d0
15 changed files with 262 additions and 65 deletions
+8 -30
View File
@@ -1,4 +1,4 @@
"""Prepare a bounded mission region from an existing Gaussian Pipeline package.
"""Prepare the complete visual scene from an existing Gaussian Pipeline package.
Uses the installed SplatTransform, preserves LOD0 and SH, and reuses verified
Worker artifacts. The local editor and Isaac share the same collider bytes and
@@ -83,23 +83,11 @@ def prepare_project(client, run, state, episode, job, pulse, isaac):
collider = root / package["collision_path"]
if not visual.is_file() or not collider.is_file():
raise ValueError("Incomplete project scene")
# Keep 12 m of surrounding visual context in every direction. A saved route
# bounds the adaptation. Retain LOD0 and all SH bands without a count ceiling.
points = run["plan"]["points"]
prior = run["plan"].get("prepared_route")
if prior:
# A curved A/B route needs its entire preview, not just its endpoints.
# Unselected graph branches must not force the whole city into RTX.
# Long detours outside this visual region require spatial streaming;
# the graph never substitutes for live support in such an area.
points = points + [{"position": p} for p in prior["preview_xyz"]]
xyz = [[p["position"][0], p["position"][2], -p["position"][1]] for p in points]
bounds = [min(p[i] for p in xyz) - 12 for i in range(3)] + [
max(p[i] for p in xyz) + 12 for i in range(3)
]
# The route is guidance, not permission to remove the rest of the world.
# Adapt the complete selected source LOD and preserve every SH coefficient.
key = hashlib.sha256(
json.dumps(
{"world": world["sha256"], "bounds": bounds, "adapter": digest(Path(__file__)), "region_adapter": digest(Path(__file__).with_name("route_region.py"))},
{"world": world["sha256"], "coverage": "complete-source-lod0", "adapter": digest(Path(__file__))},
sort_keys=True,
).encode()
).hexdigest()
@@ -119,7 +107,7 @@ def prepare_project(client, run, state, episode, job, pulse, isaac):
raise RuntimeError("Installed SOG converter is unavailable")
temporary = root / (key + ".part.ply")
# SplatTransform uses Rz(180) for PLY/SOG input/output conventions.
# Work and crop in the calibrated PlayCanvas Y-up frame, then retain
# Work in the calibrated PlayCanvas Y-up frame, then retain
# that frame in the output PLY. Isaac applies the declared Rx(90).
command = [
node,
@@ -137,20 +125,11 @@ def prepare_project(client, run, state, episode, job, pulse, isaac):
"0,0,180",
"-r",
",".join(map(str, scene["visual_rotation"])),
"-B",
",".join(map(str, bounds)),
"-r",
"0,0,180",
str(temporary),
]
commands = [command]
filtered = temporary.with_suffix(".region.ply")
if prior:
region = episode / "visual-region.json"
write_json(region, {"route_xz": [[p[0],-p[1]] for p in prior["preview_xyz"]],
"radius_m": 12, "authority": "visual-context-only"})
commands.append([str(isaac / "python.bat"), str(Path(__file__).with_name("route_region.py")),
"--source",str(temporary),"--output",str(filtered),"--region",str(region)])
with (episode / "project-preparation.log").open("wb") as log:
for command in commands:
process = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT)
@@ -168,13 +147,11 @@ def prepare_project(client, run, state, episode, job, pulse, isaac):
if process.poll() is None:
from worker import terminate_episode
terminate_episode(process)
if prior:
filtered.replace(temporary)
with temporary.open("rb") as f:
header = f.read(65536).split(b"end_header", 1)[0].decode("ascii")
count = int(re.search(r"element vertex (\d+)", header)[1])
if count <= 0:
raise ValueError("Prepared mission region is empty")
raise ValueError("Prepared visual scene is empty")
temporary.replace(output)
write_json(
receipt,
@@ -182,7 +159,8 @@ def prepare_project(client, run, state, episode, job, pulse, isaac):
"sha256": digest(output),
"gaussian_count": count,
"lod": 0,
"bounds_y_up": bounds,
"coverage": "complete-source-lod0",
"spatially_cropped": False,
"source_sha256": world["sha256"],
"converter": "splat-transform-3.4.0",
"decimated": False,