Ball-beam via composable-model-graph (transfer function + PD/fuzzy control) - #1
Open
bigboateng wants to merge 1 commit into
Open
Ball-beam via composable-model-graph (transfer function + PD/fuzzy control)#1bigboateng wants to merge 1 commit into
bigboateng wants to merge 1 commit into
Conversation
…D/fuzzy control) Headless ballbeam_cmg.py (original physics + cmg TransferFunction plant + PD control, self-checking) and three browser visualizations (live PD sim, PD-vs-fuzzy comparison, trajectory chart). Old files untouched; additive only. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
Adds a headless, runnable take on the ball-beam from this repo, expressed through
composable-model-graph,
plus three browser visualizations (no VPython needed).
ballbeam_cmg.py— the same physics asinclinedplane.py/main.py, runheadless, then two cmg variations: (1) the plant is a transfer function — the
forward-Euler ball-beam is exactly a discrete double integrator
G(q)withb=[0,0,dt²], a=[-2,1], and running the tilt input through a cmgTransferFunctionreproduces the hand-written loop to ~1e-11; (2) a PD controller closes the loop and
balances the ball at a setpoint. Deterministic and self-checking (
PASS/FAIL).ballbeam_sim.html— live animated ball-beam: a PD controller tilts the beam tokeep the ball on the center mark; click/nudge to disturb it.
ballbeam_compare.html— the same beam under PD vs a Sugeno fuzzy controller(error + rate-of-error inputs), getting the same disturbances, so the difference in
behaviour is visible side by side.
ballbeam_cmg.html— a chart of the trajectories (Euler vs transfer functionoverlay; the controller settling curve).
Why
It makes the implicit structure explicit: the integration loop in the original sim is a
transfer function, and the fuzzy controller is mathematically the same blend (local
linear consequents weighted by membership). Old files are untouched; these are additive.
Run
🤖 Generated with Claude Code