Spaces:
Sleeping
Sleeping
Commit History
-
Five built-in CDPR_SIMULATOR examples (3 trajectories + 2 data-driven)
Implements the directive's selectable demonstration set as built-in tutorials accessible identically from PowerShell and the Streamlit GUI. The registry in scripts/examples.py is the single source of truth. Phase 1 — physics-based motion simulation: * circle --- 3-DoF planar circular tracking on the dissertation_8cable robot. 0.05 m radius, 2 revolutions, ~12.6 s, quintic time-scaling for smooth start / stop. * spiral --- 6-DoF helical sweep (the directive's "one example with all six DoFs" requirement). 3-revolution spiral at z = 0.65 m +/- 0.04 m with bounded sinusoidal yaw (+/-17°), pitch (+/-6°) and roll (+/-3°) at distinct phase offsets. Bounded amplitudes (not monotonic rotations) are essential under pure PD: without orientation feedforward, a growing angle saturates the QP --- bounded oscillation keeps the angular error inside the cable wrench envelope…4a660db -
Phase-2 hardening sweep: parametric robots, URL CSVs, schema aliases
Implements all 14 improvements proposed in the post-mortem of the dissertation_8cable CSV failure log: #1 Register dissertation_8cable in the canonical build_robot() factory. The directive geometry moved from scripts/run_simulation.py into src/cdpr/robots/dissertation.py and is now reachable through the same public API as the catalog robots. Replay / PPO / SAC no longer crash on CSVs produced by --preset dissertation-circle. #2 Persist the full robot description (anchors, attachments, mass, inertia, tension bounds) in manifest.json under a new "robot_spec" block. A manifest-aware helper, robot_from_manifest_or_catalog, rebuilds any robot from this block --- catalog OR custom JSON OR inline override. Phase-2 workflows now work on any run_simulation.py output regardless of geometry source. #3 Cable-indexed column filter requires a numeric suffix. ``Layer`` no longer crashes the loader with int('ayer'). Same fix in train_from_csv, compare_…bdbf666 -
Unified Phase-1 + Phase-2 workflow with dual web/PowerShell parity
This commit fulfils the unified recovery directive: Phase-1 defined- trajectory simulation and Phase-2 CSV-driven training are now first- class on both the PowerShell terminal and the Streamlit web interface, with the CLI as the guaranteed scientific fallback while the deployed Streamlit Cloud worker remains intermittently flaky. Phase-1 (scripts/run_simulation.py): * 13 publication-grade figures per run (was 6) --- position, velocity, angular_velocity, acceleration, cable_tensions, cable_lengths, cable_stretch, tracking_error, rms_error_evolution, condition_number, trajectory_xy/_xz/_yz, scene_3d. Each plot wrapped in try/except so a single failure never drops the others; matplotlib figures are explicitly closed after savefig to bound worker memory. Phase-2 (scripts/train_from_csv.py + scripts/compare_models.py): * Five workflows on the CSVs Phase-1 emits: replay (analytic re-sim), mlp + pinn (supervised inverse-dynamics fit, z-scored I/O so loss curves are interpretab…310e4a9 -
gui: match SimulationRequest contract exactly
The previous rewrite invented field names that SimulationRequest / TrajectorySpec / build_robot / PlatformState do not have. The new in-page error surface caught it on first try ("got an unexpected keyword argument 'tension_min'"). Reconciled the GUI with the actual spec dataclasses: * Robot identifiers now use the canonical names from cdpr.interface.specs --- ``point_mass_3d``, ``planar_translational``, ``ipanema_class``, ``cogiro_class`` (build_robot rejects the short ``ipanema`` etc. forms). * Removed the ``tension_min`` / ``tension_max`` inputs --- they are not SimulationRequest fields. Limits live in the tension distribution solver and are exposed through the tension_objective choice instead. * ``gravity`` is a 3-tuple, not a bool. Added a single "Apply gravity" checkbox that toggles between ``(0,0,-9.81)`` and ``(0,0,0)``. * Circle params use ``axis`` + ``angle_span`` (not ``period``); Lissajous uses ``amplitudes`` / ``frequencies`` / ``phases`` plural. All match…f2c274d -
Fix CI on 3.11+3.12 and harden Streamlit against any-rerun blank
CI was failing for two unrelated reasons that the new verbose pytest log finally surfaced: * **Python 3.12 — TypeError in KelvinVoigtModel.diagnostics().** ``@dataclass(slots=True)`` replaces the original class object with a freshly constructed slotted one. The ``__class__`` cell that zero-arg ``super()`` captures at compile time still points to the pre- replacement class, but ``self`` is an instance of the post-replacement class --- so the runtime check ``isinstance(self, __class__)`` raises ``TypeError: super(type, obj): obj must be an instance or subtype of type``. Replaced with an explicit ``CableModel.diagnostics(self, ...)`` call; this is correct here because ``CableModel`` is the single base class (no diamond inheritance). * **Python 3.11 — SyntaxError in cdpr/reports/bundle.py:216.** An f-string slot contained ``r.scenario_name.replace('_', r'\_')``. PEP 701 lifted the "no backslash in f-string expression" rule only in 3.12. Hoisted the ``.replace()`` …5cc4e7f -
Streamlit lazy per-tab render + CI diagnostics
GUI (src/cdpr/interface/gui.py): - matplotlib.use("Agg", force=True) defensively in case the module is imported through a non-streamlit_app entry-point. - CDPR_GUI_FRUGAL env knob trims the default workload to 0.5 s / 5 ms so the free-tier Streamlit Cloud worker (~1 GB) does not OOM on the first Run simulation click. - Result tabs are now lazy: each tab renders its figure only after the user clicks "Render <key>", and the figure is cached in session_state for the rest of the session. Previously six matplotlib figures — including the 3D scene — were rendered on every script rerun, which silently killed the worker and left a blank page. - 3D scene is marked "heavy" with an explicit caption; its trajectory is subsampled to 200 points to bound memory. - Plot helpers import matplotlib / plots2d / scene lazily so the initial module load stays cheap. - _log() writes to stderr so the Streamlit Cloud manage-app log shows what the worker was doing right before it died. - Ever…d02aecd
-
Streamlit GUI: form-batched parameters + visible error surfacing
The previous GUI re-ran the entire script on every widget change. When the trajectory kind toggled between hold/line/circle/lissajous, the dynamically-appearing slider blocks (Ax/Ay/Az/fx/fy/fz, or radius, or the text inputs) caused widget-key collisions and intermediate runs that crashed silently on Streamlit Cloud's free tier --- leaving a blank page after any sidebar interaction. Fixes: - All parameter widgets live inside a single st.form('params_form'). Streamlit only re-runs the script when the user clicks 'Apply parameters'. Editing a slider mid-form no longer triggers a rerun. - Every widget carries an explicit key= so state persists cleanly across reruns regardless of which conditional branch is active. - All kind-specific widgets are always rendered (just read selectively based on kind). Avoids the appear/disappear race. - _parse_xyz wraps the text inputs in a try/except --- a half-typed '0.1, 0.' no longer raises ValueError. - render() wraps everything in try/exc…206bfca -
FastAPI: friendly root route at GET / (was 404)
Adds a JSON service descriptor listing the available endpoints and linking to the auto-generated OpenAPI docs at /docs and /redoc. The 404 at root was correct but unhelpful when someone visits the Render URL in a browser. All five API tests still pass.04f9f25 -
Initial commit: cdpr Phases 1-7 + deployment scaffolding
Scientific core (Phase 1): - Pose/Twist/Wrench primitives, SE(3) algebra - Robot configuration (anchors, attachments, inertia, cable limits) - Inverse + forward kinematics, structure matrix - Tension distribution (bounded QP), wrench feasibility - Three per-cable physics: massless, linear-elastic, Irvine catenary - Rigid-body Newton-Euler dynamics, RK4 + semi-implicit integrators - Workspace analysis (WCW, WFW, voxel grid) - Parametric trajectories with retiming - Reference robot catalogue (IPAnema-class, CoGiRo-class) Visualisation + ingestion + reports (Phase 2): - 2D analytics, 3D scene with tension heatmap and singularity indicator - Animation (playback, frame stepping, live streaming) with MP4/GIF export - Workspace volume rendering - Experiment recording (CSV + JSON metadata + reproducibility manifest) - Replay engine + dataset comparison - Publication-grade reports: LaTeX figures, booktabs tables, Markdown - FastAPI service + Streamlit research console - Optional external-physi…5f38e95