# loongopen/openloong-dyn-control architecture

> Architecture diagram of the GitHub repository loongopen/openloong-dyn-control, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/loongopen/openloong-dyn-control
- Repository: https://github.com/loongopen/openloong-dyn-control

## Overview

OpenLoong Dynamics Control is a humanoid motion-control framework for MuJoCo, combining model predictive control (MPC), whole-body control (WBC), gait and foot-placement planning, state estimation, and joint actuation. Demo programs coordinate the control loop: simulator measurements enter through the MuJoCo interface and shared data bus; planning and controllers compute desired motion and joint commands; the actuator interface applies torques back to the simulation. Separate demos cover jumping, joystick-guided walking, and obstacle stepping. Wiring beyond the sampled demo excerpts is shown only where documented capabilities support the subsystem.

Main entry points: [`common/data_bus.h`](https://github.com/loongopen/openloong-dyn-control/blob/main/common/data_bus.h) (Robot data bus), [`demo/walk_mpc_wbc_joystick.cpp`](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc_joystick.cpp) (Joystick walking), [`sim_interface/MJ_interface.cpp`](https://github.com/loongopen/openloong-dyn-control/blob/main/sim_interface/MJ_interface.cpp) (MuJoCo interface), [`demo/walk_mpc_wbc.cpp`](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc.cpp) (Walking loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demos["Motion demos"]
  node_walk_demo["Walking loop<br/>[walk_mpc_wbc.cpp]"]
  node_joy_walk_demo["Joystick walking"]
  node_jump_demo["Jumping demo<br/>[jump_mpc.cpp]"]
  node_obstacle_demo["Obstacle stepping<br/>[walk_mpc_wbc.cpp]"]
end

subgraph group_planning["Motion planning"]
  node_joy_interpreter["Joystick interpreter"]
  node_gait["Gait scheduler<br/>[gait_scheduler.cpp]"]
  node_foot_planner["Foot placement<br/>[foot_placement.cpp]"]
end

subgraph group_control["Control algorithms"]
  node_mpc["MPC planner<br/>[mpc.cpp]"]
  node_wbc["Whole-body control<br/>[wbc_priority.cpp]"]
  node_priority_tasks["Priority tasks<br/>[priority_tasks.cpp]"]
  node_pvt["Joint PVT control<br/>[PVT_ctrl.cpp]"]
end

subgraph group_state["Robot state"]
  node_state_estimator["State estimator<br/>[StateEst.cpp]"]
  node_kin_dyn["Kinematics and dynamics<br/>[pino_kin_dyn.cpp]"]
  node_data_bus[("Robot data bus<br/>[data_bus.h]")]
end

subgraph group_runtime["Simulation runtime"]
  node_mujoco_interface["MuJoCo interface<br/>[MJ_interface.cpp]"]
  node_glfw_ui["GLFW controls<br/>[GLFW_callbacks.cpp]"]
  node_logger["Data logger<br/>[data_logger.cpp]"]
end

node_operator(("Operator"))
node_mujoco(("MuJoCo simulator"))

node_operator -->|"controls"| node_glfw_ui
node_operator -->|"movement input"| node_joy_interpreter
node_walk_demo -->|"reads sensors"| node_mujoco_interface
node_mujoco_interface -->|"writes measurements"| node_data_bus
node_walk_demo -->|"computes dynamics"| node_kin_dyn
node_kin_dyn -->|"writes kinematics"| node_data_bus
node_joy_walk_demo -->|"updates estimate"| node_state_estimator
node_state_estimator -->|"reads and writes state"| node_data_bus
node_joy_walk_demo -->|"computes dynamics"| node_kin_dyn
node_joy_interpreter -->|"sets desired motion"| node_data_bus
node_gait -->|"updates gait state"| node_data_bus
node_foot_planner -->|"updates foot targets"| node_data_bus
node_mpc -->|"writes motion commands"| node_data_bus
node_wbc -->|"computes task priorities"| node_priority_tasks
node_wbc -->|"reads state and writes commands"| node_data_bus
node_pvt -->|"reads commands and writes torques"| node_data_bus
node_walk_demo -->|"applies torques"| node_mujoco_interface
node_mujoco_interface -->|"reads and actuates"| node_mujoco
node_mujoco -->|"sensor data"| node_mujoco_interface
node_glfw_ui -->|"renders and steps"| node_mujoco
node_walk_demo -->|"records telemetry"| node_logger
node_jump_demo -->|"plans jump motion"| node_mpc
node_obstacle_demo -->|"plans stepping motion"| node_mpc
node_joy_walk_demo -->|"schedules gait"| node_gait
node_joy_walk_demo -->|"plans foot placement"| node_foot_planner
node_joy_walk_demo -->|"computes joint motion"| node_wbc
node_joy_walk_demo -->|"computes joint torques"| node_pvt

click node_walk_demo "https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc.cpp"
click node_joy_walk_demo "https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc_joystick.cpp"
click node_jump_demo "https://github.com/loongopen/openloong-dyn-control/blob/main/demo/jump_mpc.cpp"
click node_obstacle_demo "https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc.cpp"
click node_joy_interpreter "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/joystick_interpreter.cpp"
click node_gait "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/gait_scheduler.cpp"
click node_foot_planner "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/foot_placement.cpp"
click node_mpc "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/mpc.cpp"
click node_wbc "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/wbc_priority.cpp"
click node_priority_tasks "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/priority_tasks.cpp"
click node_pvt "https://github.com/loongopen/openloong-dyn-control/blob/main/common/PVT_ctrl.cpp"
click node_state_estimator "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/StateEst.cpp"
click node_kin_dyn "https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/pino_kin_dyn.cpp"
click node_data_bus "https://github.com/loongopen/openloong-dyn-control/blob/main/common/data_bus.h"
click node_mujoco_interface "https://github.com/loongopen/openloong-dyn-control/blob/main/sim_interface/MJ_interface.cpp"
click node_glfw_ui "https://github.com/loongopen/openloong-dyn-control/blob/main/sim_interface/GLFW_callbacks.cpp"
click node_logger "https://github.com/loongopen/openloong-dyn-control/blob/main/common/data_logger.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_walk_demo,node_joy_walk_demo,node_jump_demo,node_obstacle_demo toneBlue
class node_joy_interpreter,node_gait,node_foot_planner toneAmber
class node_mpc,node_wbc,node_priority_tasks,node_pvt toneMint
class node_state_estimator,node_kin_dyn,node_data_bus toneRose
class node_mujoco_interface,node_glfw_ui,node_logger,node_operator,node_mujoco toneIndigo
```

## Components

### Motion demos

- [Walking loop](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc.cpp): `demo/walk_mpc_wbc.cpp`
- [Joystick walking](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc_joystick.cpp): `demo/walk_mpc_wbc_joystick.cpp`
- [Jumping demo](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/jump_mpc.cpp): `demo/jump_mpc.cpp`
- [Obstacle stepping](https://github.com/loongopen/openloong-dyn-control/blob/main/demo/walk_mpc_wbc.cpp): `demo/walk_mpc_wbc.cpp`

### Motion planning

- [Joystick interpreter](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/joystick_interpreter.cpp): `algorithm/joystick_interpreter.cpp`
- [Gait scheduler](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/gait_scheduler.cpp): `algorithm/gait_scheduler.cpp`
- [Foot placement](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/foot_placement.cpp): `algorithm/foot_placement.cpp`

### Control algorithms

- [MPC planner](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/mpc.cpp): `algorithm/mpc.cpp`
- [Whole-body control](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/wbc_priority.cpp): `algorithm/wbc_priority.cpp`
- [Priority tasks](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/priority_tasks.cpp): `algorithm/priority_tasks.cpp`
- [Joint PVT control](https://github.com/loongopen/openloong-dyn-control/blob/main/common/PVT_ctrl.cpp): `common/PVT_ctrl.cpp`

### Robot state

- [State estimator](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/StateEst.cpp): `algorithm/StateEst.cpp`
- [Kinematics and dynamics](https://github.com/loongopen/openloong-dyn-control/blob/main/algorithm/pino_kin_dyn.cpp): `algorithm/pino_kin_dyn.cpp`
- [Robot data bus](https://github.com/loongopen/openloong-dyn-control/blob/main/common/data_bus.h): `common/data_bus.h`

### Simulation runtime

- [MuJoCo interface](https://github.com/loongopen/openloong-dyn-control/blob/main/sim_interface/MJ_interface.cpp): `sim_interface/MJ_interface.cpp`
- [GLFW controls](https://github.com/loongopen/openloong-dyn-control/blob/main/sim_interface/GLFW_callbacks.cpp): `sim_interface/GLFW_callbacks.cpp`
- [Data logger](https://github.com/loongopen/openloong-dyn-control/blob/main/common/data_logger.cpp): `common/data_logger.cpp`

### Other components

- **Operator**
- **MuJoCo simulator**

## Connections

- Operator → GLFW controls: controls
- Operator → Joystick interpreter: movement input
- Walking loop → MuJoCo interface: reads sensors
- MuJoCo interface → Robot data bus: writes measurements
- Walking loop → Kinematics and dynamics: computes dynamics
- Kinematics and dynamics → Robot data bus: writes kinematics
- Joystick walking → State estimator: updates estimate
- State estimator → Robot data bus: reads and writes state
- Joystick walking → Kinematics and dynamics: computes dynamics
- Joystick interpreter → Robot data bus: sets desired motion
- Gait scheduler → Robot data bus: updates gait state
- Foot placement → Robot data bus: updates foot targets
- MPC planner → Robot data bus: writes motion commands
- Whole-body control → Priority tasks: computes task priorities
- Whole-body control → Robot data bus: reads state and writes commands
- Joint PVT control → Robot data bus: reads commands and writes torques
- Walking loop → MuJoCo interface: applies torques
- MuJoCo interface → MuJoCo simulator: reads and actuates
- MuJoCo simulator → MuJoCo interface: sensor data
- GLFW controls → MuJoCo simulator: renders and steps
- Walking loop → Data logger: records telemetry
- Jumping demo → MPC planner: plans jump motion
- Obstacle stepping → MPC planner: plans stepping motion
- Joystick walking → Gait scheduler: schedules gait
- Joystick walking → Foot placement: plans foot placement
- Joystick walking → Whole-body control: computes joint motion
- Joystick walking → Joint PVT control: computes joint torques
