Prompt file imported from vinhbui720/fabric_optimize (
.github/prompts/plan-fabricsOptimizeToCustomRobot.prompt.md). Copyright stays with the author.
Plan: Build Your Own Fabrics Pipeline
Create a staged route from mathematical intuition (NumPy/CasADi plots) to a custom robot simulation using the existing Fabrics architecture. The plan is structured so each phase has a clear acceptance gate before moving on.
Steps
- Phase 1 - Foundations and Equation Validation.
- Run and inspect
tutorial/definition_5_1.py,tutorial/proposition_4_22.py, andtutorial/section_10_3.pyto lock in the three core equations: geometryxddot + h = 0, Euler-Lagrange specM xddot + f = 0, and speed-control terms (alpha,beta,eta). - Reproduce one minimal 2D script from scratch (outside framework internals) with CasADi to validate each term independently: geometry only, geometry+attractor, geometry+attractor+damper.
- Acceptance gate: behavior matches theory (convergence, obstacle bending, damping reduces oscillation).
- Phase 2 - Pullback and Composition Mechanics.
- Trace
phi, J, Jdot, M, f, h, alphathroughfabrics/diffGeometry/diffMap.py,fabrics/diffGeometry/spec.py,fabrics/diffGeometry/geometry.py,fabrics/diffGeometry/energy.py, andfabrics/diffGeometry/energized_geometry.py. - Build your own symbol-to-runtime map for
compute_actionarguments, including dynamic reference terms:x_ref,xdot_ref,xddot_ref. - Acceptance gate: you can explain one full path from task leaf definition to final acceleration action.
- Phase 3 - Baseline Planner on Simple Robot.
- Use
examples/point_robot_urdf.pyas the baseline template with one static goal + one obstacle. - Tune key parameters:
collision_geometry,collision_finsler,attractor_potential,attractor_metric,damper_beta,damper_eta. - Add moving obstacles only after static behavior is stable, using
examples/point_robot_dynamic.py. - Acceptance gate: stable horizon rollout, no NaNs/explosions, consistent obstacle clearance.
- Phase 4 - Path Following (Dynamic Goal).
- Switch from
staticSubGoaltoanalyticSubGoalfirst (then optionalsplineSubGoal) usingexamples/panda_trajectory_following.pypattern. - Update sensor goal mask to include velocity and pass
x_ref_goal_0_leaf,xdot_ref_goal_0_leaf,xddot_ref_goal_0_leaf,weight_goal_0. - Validate tracking before adding extra complexity.
- Acceptance gate: bounded tracking lag on curved paths.
- Phase 5 - Non-Holonomic Mobile Base.
- Start from
examples/boxer.pyorexamples/albert.pywithNonHolonomicParameterizedFabricPlanner. - Merge dynamic goal/path-following pattern and keep non-holonomic inputs (
qudot,m_rot,m_base_x,m_base_y). - Tune
l_offset, damping, and mass terms for smooth steering and heading stability. - Acceptance gate: path following + obstacle avoidance without sustained heading oscillations.
- Phase 6 - Build Your Own Scenario.
- Define final robot scope: URDF, collision links, goal/path format, action/state mode.
- Create a custom example in
examples/by cloning the closest template and replacing robot/FK/leaf arguments incrementally. - Add instrumentation: tracking error, minimum obstacle distance, action norm, convergence time.
- Acceptance gate: repeatable runs meeting your target metrics.
- Phase 7 - Verification and Hardening.
- Add short-horizon tests in
examples/test_examples.py(and planner unit tests if needed). - Stress test with sharper curvature, tighter obstacle corridors, perturbed initial states.
- Validate serialization/export if needed.
- Final gate: short automated test pass + visual validation + reproducible parameter set.
Relevant files
/home/vinbui/HCMUT/fabric/fabrics/tutorial/definition_5_1.py/home/vinbui/HCMUT/fabric/fabrics/tutorial/proposition_4_22.py/home/vinbui/HCMUT/fabric/fabrics/tutorial/section_10_3.py/home/vinbui/HCMUT/fabric/fabrics/tutorial/casadi_class.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/diffGeometry/diffMap.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/diffGeometry/spec.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/diffGeometry/geometry.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/diffGeometry/energy.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/diffGeometry/energized_geometry.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/planner/parameterized_planner.py/home/vinbui/HCMUT/fabric/fabrics/fabrics/planner/non_holonomic_parameterized_planner.py/home/vinbui/HCMUT/fabric/fabrics/examples/point_robot_urdf.py/home/vinbui/HCMUT/fabric/fabrics/examples/point_robot_dynamic.py/home/vinbui/HCMUT/fabric/fabrics/examples/panda_trajectory_following.py/home/vinbui/HCMUT/fabric/fabrics/examples/boxer.py/home/vinbui/HCMUT/fabric/fabrics/examples/albert.py/home/vinbui/HCMUT/fabric/fabrics/examples/test_examples.py
Verification
- Enforce each phase acceptance gate before advancing.
- Do non-render short rollouts first, then render checks.
- Track 3 metrics every run: path error, minimum obstacle distance, action norm.
- Confirm no planner guardrail clipping due to tiny/huge action magnitudes.
- Add at least one automated short test for your custom scenario.
Decisions
- Included: full concept-to-custom-sim path inside this repo.
- Excluded: ROS/hardware deployment for now.
- Recommended progression: point robot first, then non-holonomic, then your final custom robot.
- Recommended dynamic goal mode:
analyticSubGoalfirst,splineSubGoalafter stable baseline.