From a1b2c49006d7c4b75292336534c8a56f60296bbc Mon Sep 17 00:00:00 2001 From: jianglongye <34152111+jianglongye@users.noreply.github.com> Date: Tue, 17 Nov 2026 16:10:43 +0000 Subject: [PATCH] Link each kit's own repo from the nav's GitHub icon The GitHub icon in the nav always opened robokit. It now opens the page's own kit (project, showcase and docs pages), and the openrobokit organization on the landing page. Maintainer-only media scripts that need footage outside the repo are no longer published. --- README.md | 7 - assets/js/site.js | 7 +- scripts/assemble_landing_teaser.py | 187 ------------------------ scripts/encode_graspkit_optimization.py | 93 ------------ scripts/encode_graspkit_real_world.py | 61 -------- scripts/encode_showcase.py | 120 --------------- 6 files changed, 5 insertions(+), 470 deletions(-) delete mode 100644 scripts/assemble_landing_teaser.py delete mode 100644 scripts/encode_graspkit_optimization.py delete mode 100644 scripts/encode_graspkit_real_world.py delete mode 100755 scripts/encode_showcase.py diff --git a/README.md b/README.md index 972e2b8..84f3e3e 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,6 @@ only for the project being imported. `scripts/serve.py` serves the built tree with HTTP Range support so the video scrubbers can seek locally. -The landing hero and its three kit previews live under -`assets/{videos,images}/landing/`. After updating the hero, regenerate the -matching card clips and posters with -`uv run --python 3.12 python scripts/assemble_landing_teaser.py --previews-only`. -The same script can assemble the hero from existing Blender frames using -`--renders `. - ## Layout ``` diff --git a/assets/js/site.js b/assets/js/site.js index 34a74d6..da2065a 100644 --- a/assets/js/site.js +++ b/assets/js/site.js @@ -28,11 +28,14 @@ { key: 'docs', label: 'Docs', href: '/docs/robokit/overview/' }, ]; - const GITHUB_URL = 'https://github.com/openrobokit/robokit'; // `active` is a NAV key, or anything absent from it (the landing page passes // nothing) to leave every entry unmarked. window.rkRenderNav = function (active) { + // The GitHub icon opens the page's own kit: a project page names it, a docs + // page has it as /docs//, and the landing page gets the organization. + const kit = [active, ...location.pathname.split('/')].find((k) => k in window.RK_NAMES); + const github = kit ? `https://github.com/openrobokit/${kit}` : 'https://github.com/openrobokit'; const link = (n, dot) => `` + `${dot && n.key === active ? '' : ''}${n.label}`; @@ -48,7 +51,7 @@
- ${ICONS.github} + ${ICONS.github}
diff --git a/scripts/assemble_landing_teaser.py b/scripts/assemble_landing_teaser.py deleted file mode 100644 index 2250c7e..0000000 --- a/scripts/assemble_landing_teaser.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python3 -"""Encode fresh Blender frames and hero cuts into the landing page's video and poster assets. - -uv run --no-project python scripts/assemble_landing_teaser.py - -Inputs: --renders //frame_XXXX.png from Blender, and -the RetargetingKit, GraspKit and RoboSkills clips, which supply their shots. -Outputs: the teaser and four matching kit previews under assets/{videos,images}/landing/. -Use --previews-only to refresh the cards from an existing teaser. -Use --kit graspkit to replace that shot and card while preserving the other kits. -Intermediate clips and render provenance stay in ignored output/landing-teaser/. -""" - -import argparse -import hashlib -import json -import struct -import subprocess -from pathlib import Path - -ROOT = Path(__file__).resolve().parent.parent -OUT = ROOT / "output/landing-teaser" -MOVIE = ROOT / "assets/videos/landing/teaser.mp4" -POSTER = ROOT / "assets/images/landing/teaser.webp" -SIZE = 1600 # every shot matches, so the concat can copy streams -CLIPS = ( - ("RoboKit", "Motion planning", "motion_planning"), - ("RetargetingKit", "Scene interaction", "full-body-cutting"), - ("GraspKit", "Pick and place", "hero-place"), - ("RoboSkills", "Paper folding", "paper-folding"), -) -# Three shots are cut from their kit's hero clip rather than rendered: 4 s squared -# up around the action (a short crop is padded square), and the clip's ground -# lifted to the teaser's, so the page band shows through the multiply as it does -# for the renders. -HERO_CUTS = { - # The kitchen scene's broad floor shadow would still darken that ground out - # to the frame edge, so, like the renders' haze cut, faint shading fades to - # the ground: a pixel's darkest channel 16 levels under it goes, 40 under it - # stays whole. The shadow is smeared into the padding. - "full-body-cutting": dict(clip=ROOT / "assets/videos/retargetingkit/hero/full-body-cutting.mp4", - start=5, crop=(1200, 1080, 320, 0), ground=(233, 242, 247), flatten=True), - # Keep Ability -> Sharpa and Panda -> xArm -> Vega at the original speed. - # Start after Inspire has vanished and finish before Vega's return wipe. - # Fade the cropped torso into the ground instead of smearing it into padding. - "hero-place": dict(clip=ROOT / "assets/videos/graspkit/hero-place.mp4", - start=77 / 30, crop=(1440, 1080, 380, 0), ground=(231, 235, 228), - flatten=False, fade_bottom=80), - # The paper-folding teaser already sits on a near-white studio; its first - # 4 s keep both hands in a 1560px-wide crop, and flattening drops the floor - # line and contact shadow so only the hands and paper remain. The padding is - # plain ground: smearing would drag the faint shadow into vertical streaks. - "paper-folding": dict(clip=ROOT / "assets/videos/roboskills/teaser/paper-folding.mp4", - start=0, crop=(1560, 1080, 240, 0), ground=(248, 248, 246), flatten=True, - smear=False), -} - - -def ffmpeg(args: list[str]) -> None: - subprocess.run(["ffmpeg", "-y", "-hide_banner", "-loglevel", "error", "-xerror", *args], check=True) - - -def encode_hero_cut(cut: dict, output: Path) -> None: - w, h, x, y = cut["crop"] - r, g, b = cut["ground"] - pad = (w - h) // 2 - chain = ["scale=in_color_matrix=bt709:in_range=tv", "fps=30", "format=rgb24", f"crop={w}:{h}:{x}:{y}"] - if cut.get("fade_bottom"): - fade = f"clip((H-1-Y)/{cut['fade_bottom']},0,1)" - chain.append("geq=" + ":".join(f"{channel}='{channel}(X,Y)*{fade}+{ground}*(1-{fade})'" - for channel, ground in zip("rgb", (r, g, b)))) - if pad: - chain.append(f"pad={w}:{w}:0:{pad}:color=0x{r:02x}{g:02x}{b:02x}") - if not cut.get("fade_bottom") and cut.get("smear", True): - chain.append(f"fillborders=top={pad}:bottom={pad}:mode=smear") - chain.append(f"colorchannelmixer=rr={250 / r:.5f}:gg={250 / g:.5f}:bb={248 / b:.5f}") - if cut["flatten"]: - keep = ("st(0,max(max(250-r(X,Y),250-g(X,Y)),248-b(X,Y)));" - "st(1,clip((ld(0)-16)/24,0,1));st(1,ld(1)*ld(1)*(3-2*ld(1)))") - chain.append(f"geq=r='{keep};250-(250-r(X,Y))*ld(1)':g='{keep};250-(250-g(X,Y))*ld(1)'" - f":b='{keep};248-(248-b(X,Y))*ld(1)'") - chain.append(f"scale={SIZE}:{SIZE}:flags=lanczos:out_color_matrix=bt709:out_range=tv,format=yuv420p") - graph = f"[0:v]{','.join(chain)}[v]" - ffmpeg(["-threads", "2", "-ss", str(cut["start"]), "-i", str(cut["clip"]), - "-filter_complex_threads", "2", "-filter_complex", graph, "-map", "[v]", - "-frames:v", "120", "-an", "-c:v", "libx264", "-threads", "6", "-crf", "14", - "-preset", "medium", "-pix_fmt", "yuv420p", "-colorspace", "bt709", - "-color_primaries", "bt709", "-color_trc", "bt709", "-color_range", "tv", - "-movflags", "+faststart", str(output)]) - - -def export_previews(kit: str | None = None) -> None: - for i, (name, _, _) in enumerate(CLIPS): - if kit and name.lower() != kit: - continue - clip = MOVIE.with_name(f"{name.lower()}.mp4") - poster = POSTER.with_name(f"{name.lower()}.webp") - ffmpeg(["-threads", "2", "-ss", str(i * 4), "-i", str(MOVIE), "-t", "4", - "-vf", "scale=640:640", "-an", "-c:v", "libx264", "-threads", "2", - "-crf", "19", "-preset", "medium", "-movflags", "+faststart", str(clip)]) - ffmpeg(["-threads", "2", "-ss", "1", "-i", str(clip), "-frames:v", "1", - "-c:v", "libwebp", "-quality", "90", "-threads", "2", str(poster)]) - print(f"{name}: matching 4s preview and poster", flush=True) - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--renders", type=Path, help="Blender frames, one folder per shot; required unless --previews-only") - parser.add_argument("--previews-only", action="store_true") - parser.add_argument("--kit", choices=[name.lower() for name, _, _ in CLIPS]) - args = parser.parse_args() - if args.previews_only: - export_previews(args.kit) - return - OUT.mkdir(parents=True, exist_ok=True) - MOVIE.parent.mkdir(parents=True, exist_ok=True) - POSTER.parent.mkdir(parents=True, exist_ok=True) - shots = [] - provenance = [] - previous_version = hashlib.sha256(MOVIE.read_bytes()).hexdigest()[:10] if args.kit else None - for i, (name, task, stem) in enumerate(CLIPS): - output = OUT / f"{stem}.mp4" - if args.kit and name.lower() != args.kit: - ffmpeg(["-ss", str(i * 4), "-i", str(MOVIE), "-frames:v", "120", - "-map", "0:v", "-an", "-c", "copy", "-movflags", "+faststart", str(output)]) - shots.append(output) - provenance.append(dict(name=name, task=task, retained_from=previous_version, start=i * 4)) - print(f"{name}: retained original 4s shot without re-encoding", flush=True) - continue - if cut := HERO_CUTS.get(stem): - encode_hero_cut(cut, output) - shots.append(output) - provenance.append(dict(name=name, task=task, clip=str(cut["clip"].relative_to(ROOT)), start=cut["start"])) - print(f"{name}: {cut['start']}-{cut['start'] + 4}s of {cut['clip'].name}, squared to {SIZE}px", flush=True) - continue - if args.renders is None: - parser.error(f"--renders is required to encode {name}'s Blender shot") - frames = args.renders / stem - assert len(list(frames.glob("frame_*.png"))) == 120, f"Expected 120 rendered frames in {frames}" - meta = json.loads((frames / "render-meta.json").read_text()) - size = meta["size"] - assert size == SIZE, f"{SIZE}px renders required: {size}px" - for frame in range(120): - path = frames / f"frame_{frame:04d}.png" - with path.open("rb") as image: - header = image.read(24) - image.seek(-12, 2) - footer = image.read(12) - assert header[:8] == b"\x89PNG\r\n\x1a\n", f"Invalid PNG: {path}" - assert struct.unpack(">II", header[16:24]) == (size, size), f"Wrong frame size: {path}" - assert footer == b"\x00\x00\x00\x00IEND\xaeB`\x82", f"Incomplete frame: {path}" - # Remove low-opacity floor haze while retaining opaque meshes and stronger shadows. - graph = ( - f"color=c=0xFAFAF8:s={size}x{size}:r=30:d=4[bg];" - "[0:v]format=rgba,lut=a='max(0,(val-24)*255/231)'[fg];" - "[bg][fg]overlay=shortest=1:format=rgb," - "scale=out_color_matrix=bt709:out_range=tv,format=yuv420p[v]" - ) - ffmpeg(["-threads", "2", "-framerate", "30", "-i", str(frames / "frame_%04d.png"), - "-filter_complex_threads", "2", "-filter_complex", graph, "-map", "[v]", - "-frames:v", "120", "-an", "-c:v", "libx264", "-threads", "6", "-crf", "14", - "-preset", "medium", "-pix_fmt", "yuv420p", "-colorspace", "bt709", - "-color_primaries", "bt709", "-color_trc", "bt709", "-color_range", "tv", - "-movflags", "+faststart", str(output)]) - shots.append(output) - provenance.append(dict(name=name, task=task, render=meta)) - print(f"{name}: {size}×{size}, 120 frames, native render, CRF 14", flush=True) - concat = OUT / "shots.txt" - concat.write_text("".join(f"file '{shot.name}'\n" for shot in shots)) - movie = MOVIE - ffmpeg(["-f", "concat", "-safe", "0", "-i", str(concat), "-c", "copy", - "-movflags", "+faststart", str(movie)]) - if args.kit is None or args.kit == "robokit": - ffmpeg(["-threads", "2", "-ss", "1", "-i", str(movie), "-frames:v", "1", - "-c:v", "libwebp", "-quality", "95", "-threads", "2", str(POSTER)]) - export_previews(args.kit) - version = hashlib.sha256(movie.read_bytes()).hexdigest()[:10] - (OUT / "sources.json").write_text(json.dumps({ - "duration": 4 * len(CLIPS), "fps": 30, "shot_duration": 4, "clips": provenance, - "assembly": "Native-resolution render and squared hero cuts; direct cuts; one kit at a time; labels are HTML.", - }, indent=2) + "\n") - print(f"{movie.relative_to(ROOT)}: {4 * len(CLIPS)}s, {120 * len(CLIPS)} frames, {movie.stat().st_size / 1048576:.2f} MB", flush=True) - print(f"Poster: {POSTER.relative_to(ROOT)}; asset version: {version}", flush=True) - - -if __name__ == "__main__": - main() diff --git a/scripts/encode_graspkit_optimization.py b/scripts/encode_graspkit_optimization.py deleted file mode 100644 index d955d9f..0000000 --- a/scripts/encode_graspkit_optimization.py +++ /dev/null @@ -1,93 +0,0 @@ -"""Encode the original 400-grasp timeline with the hero's matte studio rendering.""" - -import argparse -import hashlib -import json -import subprocess -from pathlib import Path - -from PIL import Image, ImageChops, ImageFilter - - -def compose(path: Path) -> Image.Image: - foreground = Image.open(path).convert("RGBA") - width, height = foreground.size - alpha = foreground.getchannel("A") - # Match the hero: keep opaque geometry and nearby physical contact shadows. - core = alpha.point(lambda value: 255 if value >= 250 else 0).filter(ImageFilter.MaxFilter(5)) - contact = core.filter(ImageFilter.GaussianBlur(36 * height / 1080)) - weight = ImageChops.lighter(core, contact.point(lambda value: min(255, 2 * value))) - foreground.putalpha(ImageChops.multiply(alpha, weight)) - image = Image.new("RGBA", (width, height), "#E7EBE4") - image.alpha_composite(foreground) - return image.convert("RGB") - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--data", type=Path, required=True) - parser.add_argument("--frames", type=Path, required=True) - parser.add_argument("--out", type=Path, required=True) - parser.add_argument("--preview-only", action="store_true") - parser.add_argument("--still", type=Path, help="Composite one close-up before rendering the full video") - parser.add_argument("--camera-stop-seconds", type=float, default=4.0, help="Hold the settled scene after this time") - args = parser.parse_args() - args.out.mkdir(parents=True, exist_ok=True) - manifest = json.loads((args.data / "manifest.json").read_text()) - times = manifest["frame_seconds"][:75] - assert manifest["batch_size"] == 400 and round(times[-1], 2) == 3.09 - assert round(times[48], 2) == 2.00 - stop_frame = round(args.camera_stop_seconds * 24) + 1 - assert 87 <= stop_frame <= 255 - if args.still is not None: - compose(args.still).save(args.out / "close-up.png") - print("PREVIEW: featured grasp; website supplies the RoboKit timing badge", flush=True) - return - for index in (0, 86, 122, 158, 206, 254): - compose(args.frames / "tour" / f"frame_{min(index + 1, stop_frame):04d}.png").save(args.out / f"preview-{index:03d}.png") - if args.preview_only: - print("PREVIEW: six camera-tour frames; timer 0.00–3.09 s; 400 scenes", flush=True) - return - timeline = [ - args.frames / "tour" / f"frame_{min(index + 1, stop_frame):04d}.png" - for index in range(255) - ] - assert len(timeline) == 255 - video = args.out / "grasp-optim.mp4" - first = compose(timeline[0]) - command = [ - "ffmpeg", "-y", "-hide_banner", "-loglevel", "error", "-xerror", "-f", "rawvideo", "-pix_fmt", "rgb24", - "-s", f"{first.width}x{first.height}", "-r", "24", "-i", "-", "-an", "-c:v", "libx264", "-threads", "4", - "-crf", "16", "-preset", "medium", "-vf", "scale=out_color_matrix=bt709:out_range=tv,format=yuv420p", - "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709", "-color_range", "tv", - "-movflags", "+faststart", str(video), - ] - with (args.out / "encode.log").open("w") as log: - process = subprocess.Popen(command, stdin=subprocess.PIPE, stderr=log) - last, image = None, None - for path in timeline: - if path != last: - image = compose(path).tobytes() - last = path - process.stdin.write(image) - process.stdin.close() - assert process.wait() == 0 - first.save(args.out / "grasp-optim.webp", quality=95) - result = { - "frames": 255, "fps": 24, "duration_seconds": 10.625, "cells": 400, "source_pose_frames": list(range(75)), - "source_frame_seconds": times, "lead_frames": 12, "settled_frames": 168, - "camera": "front view; zoom stops and holds after four seconds", "background": "#E7EBE4", - "camera_stop_seconds": args.camera_stop_seconds, - "camera_stop_source_frame": stop_frame, - "render_source_frames": [min(index + 1, stop_frame) for index in range(255)], - "featured_cell": json.loads((args.frames / "tour/render-meta-0.json").read_text())["featured_cell"], - "width": first.width, "height": first.height, "timer": "RoboKit badge on the website", - "version": hashlib.sha256(video.read_bytes()).hexdigest()[:10], "encoder": command, - } - (args.out / "validation.json").write_text(json.dumps(result, indent=2) + "\n") - print("ENCODED: 255 frames, 24 fps, 10.625 s; 400 original trajectories; timer ends at 3.09 s", flush=True) - print(f"VERSION {result['version']}", flush=True) - - -if __name__ == "__main__": - main() diff --git a/scripts/encode_graspkit_real_world.py b/scripts/encode_graspkit_real_world.py deleted file mode 100644 index 229aa6b..0000000 --- a/scripts/encode_graspkit_real_world.py +++ /dev/null @@ -1,61 +0,0 @@ -"""Encode the original 1080p HDR robustness footage for browser playback. - -Run with uv run --no-project --with imageio-ffmpeg python