How continuumroboticslab/opencr-mujoco works
1. Repository shape
This is a Python/MuJoCo robotics repository centered on tendon-driven continuum robots (TDCRs). The core package is opencr_mujoco, and the top-level scripts (generate.py, teleop.py, viewer.py, sysid_pipeline.py, examples/trace_tip_demo.py, and paper_results/*) are thin application entry points that assemble the package into different workflows.
2. Core simulation model
The main architecture is a discretized continuum backbone: each TDCR is represented as a serial chain of rigid links with elastic hinge joints, while tendons are routed through MuJoCo tendon elements. This is the fundamental simulation boundary: geometry, stiffness, and tendon routing are encoded in MuJoCo XML scenes and executed by MuJoCo at runtime.
3. Model generation pipeline
opencr_mujoco/generators plus configs/generation/* define how robot scenes are synthesized from configuration. Generated TDCR scene XMLs are written under assets/tdcr/ on demand, and the generator supports multiple segment counts, modular heterogeneous segments, tendon routing variants, pretension keyframes, and collision exclusions.
4. Shared configuration layer
Most user-facing tools use the same config convention: CLI arguments override named config files, which override built-in defaults. The config namespaces under configs/generation, configs/teleop, configs/viewer, configs/evaluation, and configs/sysid are the control plane that keeps the scripts consistent across generation, simulation, teleoperation, and analysis.
5. Control and teleoperation subsystem
teleop.py is the runtime control front-end. It connects input devices from opencr_mujoco/utils and opencr_mujoco/controllers to robot commands, supporting keyboard and DualSense inputs, TDCR joint/task-space control, IK-based control, multi-point task-space control, homing, and combined Franka + TDCR operation.
6. Kinematics boundary
opencr_mujoco/tdcr_kinematics provides the continuum-robot math used by controllers and some generation logic. It contains multi-segment formulations, tension-aware variants, and wrappers for common robot layouts, bridging high-level target commands to tendon/joint commands that MuJoCo can apply.
7. Scene composition and assets
The repository ships reusable MuJoCo assets for the Franka Panda arm and several TDCR scene definitions in assets/. These XML and mesh assets are the static simulation boundary; higher-level tools select or generate scenes from them, while viewer.py and teleop/demo scripts load them directly.
8. Evaluation and validation against reference physics
opencr_mujoco/evaluation and paper_results/ form the validation layer. They compare MuJoCo simulations against bundled SoRoSim reference data in data/reference/sorosim, covering statics and tip-release dynamics, computing shape/trajectory metrics, and generating publication-style plots and reports.
9. System identification pipeline
opencr_mujoco/sysid and sysid_pipeline.py implement a multi-stage calibration flow for hardware-backed models. The pipeline ingests motion-capture CSVs from data/sysid, estimates geometry and tendon-related parameters, runs trajectory simulation and optimization, and produces refined parameter sets plus analysis artifacts.
10. Hardware bridge
opencr_mujoco/dynamixel_bridge is an optional boundary to real actuators. It mirrors teleoperation outputs to a physical TDCR through the Dynamixel SDK, keeping the simulation/control stack separate from the hardware actuation layer.
11. Interactive viewing and browser deployment
viewer.py is the passive MuJoCo scene viewer for inspecting any model, while docs/ packages a browser-based version of the same simulator. The docs site uses bundled Python extras, Pyodide/WASM glue, and tracked scene copies under docs/scenes/ so GitHub Pages can serve a runnable demo without the full desktop environment.
12. Validation and developer harness
The tests/ directory exercises generation, scene creation, evaluation, teleop, sysid CLI behavior, and viewer correctness. CI and local test scripts are part of the repo’s architectural boundary: they protect the generator, control, and analysis layers from diverging as the MuJoCo models evolve.
Main entry points: tests Tests · sysid SysID · generators Generators · controllers Controllers
Components 19
Entry Points
Thin scripts that assemble the package into workflows
- generate.py · Top-level scene generation entry point
generate.py - teleop.py · Interactive control entry point
teleop.py - viewer.py · Passive MuJoCo scene viewer
viewer.py - sysid_pipeline.py · System identification pipeline entry point
sysid_pipeline.py - trace_tip_demo.py · Example runtime demo
examples/trace_tip_demo.py
Core Package
Primary library code for modeling, control, and analysis
- Generators · Builds TDCR MuJoCo scenes from configuration
opencr_mujoco/generators - Kinematics · Continuum-robot kinematics used by controllers and generation
opencr_mujoco/tdcr_kinematics - Controllers · Joint, task-space, IK, and combined control logic
opencr_mujoco/controllers - Utilities · Shared config loading and input-device adapters
opencr_mujoco/utils - Dynamixel bridge · Optional bridge from teleop commands to physical actuators
opencr_mujoco/dynamixel_bridge - SysID · Parameter estimation, optimization, and model validation
opencr_mujoco/sysid
Assets & Data
Static MuJoCo assets, configs, and reference datasets
- Assets · Static Franka and TDCR scene assets plus meshes
assets - Configs · Named configuration sets for generation, teleop, viewer, evaluation, and sysid
configs - Reference data · Bundled SoRoSim reference statics and dynamics datasets
data/reference/sorosim - SysID data · Motion-capture and derived analysis CSVs for calibration
data/sysid
Validation
Tests and paper-result workflows that exercise the stack
- Evaluation · Reference-data loading, metrics, and visualization
opencr_mujoco/evaluation - Paper results · Batch workflows for statics, dynamics, and sysid figures
paper_results - Tests · CLI, generator, teleop, viewer, evaluation, and sysid checks
tests
Web Demo
Browser deployment and supporting runtime files
- Docs site · Browser-based MuJoCo deployment and served scenes
docs
Connections 27
- generate.py → Generators: invokes · CLI drives scene synthesis
- generate.py → Configs: reads · Uses generation configs and overrides
- Generators → Assets: writes scenes · Emits generated XML under robot assets
- Generators → Kinematics: uses math · Shares continuum formulations for layout and routing
- teleop.py → Controllers: drives · Interactive runtime control
- teleop.py → Utilities: uses inputs · Keyboard and DualSense adapters
- teleop.py → Configs: reads · Teleop modes and bindings
- Controllers → Kinematics: commands · Maps targets to tendon/joint commands
- Controllers → Dynamixel bridge: can bridge · Optional hardware actuation path
- viewer.py → Assets: loads · Opens static or generated MuJoCo scenes
- viewer.py → Configs: reads · Viewer presets
- trace_tip_demo.py → Generators: assembles · Demo uses generated TDCR scenes
- trace_tip_demo.py → Controllers: runs · Demo control loop
- sysid_pipeline.py → SysID: orchestrates · Multi-stage calibration flow
- SysID → SysID data: ingests · Consumes recorded motion-capture CSVs
- SysID → Configs: reads · Pipeline and parameter configs
- SysID → Evaluation: evaluates · Compares simulated and observed trajectories
- Evaluation → Reference data: loads · Benchmarks against SoRoSim data
- Paper results → Evaluation: reuses · Publication-style analysis and plots
- Paper results → Reference data: compares · Static and dynamic reference comparisons
- Docs site → Assets: bundles · Tracks scene copies and meshes for browser demo
- Docs site → Utilities: reuses · Browser input/runtime glue mirrors desktop tooling
- Tests → Generators: covers · Scene generation behavior
- Tests → Controllers: covers · Teleop and controller behavior
- Tests → Evaluation: covers · Metrics and validation correctness
- Tests → SysID: covers · Pipeline and CLI behavior
- Tests → viewer.py: covers · Viewer correctness checks