Implement Manim 2D backend for CBFAnimator#367
Draft
Eduard-Zippenfenig wants to merge 4 commits into
Draft
Conversation
Fills the declared gap where backend='manim' raised NotImplementedError. Adds _ManimMixin + CBFAnimator2DScene rendering the full declarative element API (goals, obstacles, trajectories, agents, predictions, time overlay) on a white canvas, with quality selected via the existing manim-<quality> backend-string convention. Renders MP4 or GIF; module imports cleanly without manim installed (guarded like the 3D backend). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ender Replaces the NotImplementedError pin with quality-parsing, import-guard, and save-dispatch tests (dependency-free) plus a real-render smoke test that skips when manim is not installed (as in CI). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Demo renders the README quick-start CBF example (unicycle reach-avoid) via backend='manim-medium'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Eduard-Zippenfenig
marked this pull request as draft
July 18, 2026 15:30
…mple Repeated renders in one process crashed because Manim's global config and animation cache outlived each render's temp media dir. Scope overrides with tempconfig and disable caching; add a regression test. examples/unicycle/reach_goal/manim_2d_animation.py reproduces the showcase GIF from the README quick-start simulation (CBFKIT_TEST_MODE-gated). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the 2D Manim backend for
CBFAnimator, filling the gap wherebackend="manim"was accepted but raisedNotImplementedError("Manim 2D backend not yet implemented").CBFAnimator(states, backend="manim")(or"manim-<low|medium|high|production>") now renders the full declarative element API — goals, circular/elliptical obstacles, line/scatter trajectories, agents with bodies/safety zones/solid+dashed trails, per-frame linear and data predictions, and the time overlay — to MP4 (or GIF) via Manim.Demo
Rendered from the README quick-start CBF example (unicycle reach-avoid) with
backend="manim-medium":The existing high-level path works as a drop-in:
visualize_crowd(..., backend="manim")renders pedestrians with safety zones and fading predictions with no other changes.Design
Mirrors the existing 3D module (
manim_3d_multi_robot.py) throughout:try: import manimwithScene = objectfallback — the module imports cleanly when themanimextra is absent (as in CI), and the constructor raises the standardcbfkit[manim]ImportErrorvia_require_manim().CBFAnimator2DScenevia class attributes beforescene.render(); animation driven by aValueTracker+ updaters.manim-<quality>backend-string convention and_parse_manim_backend— no new config fields. Invalid quality strings raiseValueErrorbefore the dependency check._ManimMixinadded toCBFAnimatoralongside the matplotlib/plotly mixins; dispatch added tobuild/animate/save/show.Also adds a
[mypy-manim.*]stanza tomypy.ini.Tests
ImportError, invalid-qualityValueError, andsave()dispatch with a mocked render.ruff check srcclean; changed files formatted with black 25.11.0 (pre-commit pin).🤖 Generated with Claude Code