# robotology/idyntree architecture

> Architecture diagram of the GitHub repository robotology/idyntree, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robotology/idyntree
- Repository: https://github.com/robotology/idyntree

## Overview

##### Main components
a. Core Library (src/core): This is the foundation where the low-level algorithms (e.g., kinematics, dynamics, common numerical utilities, and data structures such as the undirected graph Model) are implemented.
b. Modules and Extensions:
– Estimation (src/estimation): Implements algorithms for sensor fusion, torque estimation, and filters (e.g., Extended Kalman Filter, Mahony filter).
– Model Representation (src/model & src/model_io): Handles robot models, URDF file parsing/writing, and tools for model calibration.
– Inverse Kinematics (src/inverse-kinematics): Contains solvers and related modules.
– High-Level Computations (src/high-level): Provides higher-level abstractions (e.g., KinDynComputations) that build on core functionalities.
– Optimal Control (src/optimalcontrol): Implements controllers, cost functions, dynamics integration, and optimal control solvers.
– Visualization (src/visualization): Includes components for visualizing robot models (using tools like Meshcat) and other graphical tools.
– YARP Integration (src/yarp): Contains interfaces/adapters for YARP configurations.
c. Bindings and Language Interfaces:
– MATLAB Bindings (bindings/matlab): Wraps C++ functions into MATLAB (including autogenerated bindings and high-level wrappers).
– Python Bindings (bindings/python and bindings/pybind11): Uses pybind11 to create Python-accessible interfaces along with examples and tests.
e. Examples and Tests:
– Examples (examples): Demonstrates usage in C++, MATLAB, and Python.
– Tests (src/tests, various module-specific tests): Ensure correctness and serve as integration/demonstration points.
f. Documentation and Developer Support:
– Docs (doc and docs) and Developer Documentation (doc/dev): Provide guidelines, Doxygen files, and build instructions.
g. External Dependencies/Integration:
– “extern” folder: Third-party or related libraries (e.g., MOxUnit for MATLAB, mesh2tri, and fpconv).
– CI/CD workflow files, CMake build scripts, and configuration files for continuous integration.

##### Relationships and interactions
– Show that higher-level modules (estimation, inverse kinematics, optimal control, model, and visualization) rely on the core components.
– Indicate that language-specific bindings wrap around the C++ library modules, exposing key functions to MATLAB and Python users.
– Represent command-line utilities as external client applications that call into the core and helper modules.

##### Architectural patterns and design principles
– Modularity: Each module (core, estimation, model, inverse kinematics, optimal control, etc.) is separated into its own directory and built as an independent library component.
– Layering: Core functionalities form the foundation, with layers of abstraction built on top.
– Multi-language binding: There is a clear separation between the native C++ implementation and the binding layers (Python, MATLAB) that re-use the same logic.
– Build System Integration: Extensive CMake configuration indicates a design built around a robust, multi-target compilation with cross-platform support.
– Testing and Continuous Integration: The presence of multiple test folders and CI workflows indicates that the system emphasizes correctness and maintainability.

##### Relevant technologies, frameworks, and libraries
– Programming languages: C++ for core computations; Python and MATLAB for bindings.
– Build system: CMake (with scripts under cmake/), and configuration files like setup.py and pyproject.toml.
– Documentation generation: Doxygen (see Doxyfile) and Sphinx (docs/).
– External libraries: YARP (for integration), Eigen (for numerical computing, as seen in examples), and possibly MOxUnit for MATLAB testing.

– Clear labels for each major component (e.g., Core, Estimation Module, Inverse Kinematics, Model I/O, Optimal Control, Visualization, MATLAB Bindings, Python Bindings, Tools, Examples, External Integrations).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure Layer
    subgraph "Infrastructure"
        DOC["Documentation & Developer Support"]:::infrastructure
        CI["CI/CD & Build Scripts"]:::infrastructure
        EXT["External Dependencies/Integration"]:::infrastructure
    end

    %% Client Applications
    subgraph "Client Applications"
        EX["Examples"]:::client
        TS["Tests"]:::client
        CL["Command-Line Tools"]:::client
    end

    %% Language Bindings
    subgraph "Language Bindings"
        MB["MATLAB Bindings"]:::binding
        PB["Python Bindings"]:::binding
    end

    %% Library Modules
    subgraph "Library Modules"
        EST["Estimation Module"]:::native
        MR["Model Representation & URDF I/O"]:::native
        IK["Inverse Kinematics"]:::native
        HL["High-Level Computations"]:::native
        OC["Optimal Control"]:::native
        SS["Solid Shapes"]:::native
        VIS["Visualization"]:::native
        YARP["YARP Integration"]:::native
    end

    %% Core Layer
    subgraph "Core Layer"
        CORE["Core Library"]:::native
    end

    %% Relationships: Core provides to Modules
    CORE -->|"provides"| EST
    CORE -->|"provides"| MR
    CORE -->|"provides"| IK
    CORE -->|"provides"| HL
    CORE -->|"provides"| OC
    CORE -->|"provides"| SS
    CORE -->|"provides"| VIS
    CORE -->|"provides"| YARP

    %% Bindings wrap the Core
    MB -->|"wraps"| CORE
    PB -->|"wraps"| CORE

    %% Client Applications call/use the Core
    CL -->|"calls"| CORE
    EX -->|"uses"| CORE
    TS -->|"verifies"| CORE

    %% Infrastructure interactions
    CI -->|"builds"| CORE
    CI -->|"runs"| TS
    EXT -->|"integrates"| EST
    EXT -->|"integrates"| MR
    EXT -->|"integrates"| IK
    EXT -->|"integrates"| HL
    EXT -->|"integrates"| OC
    EXT -->|"integrates"| SS
    EXT -->|"integrates"| VIS
    EXT -->|"integrates"| YARP
    DOC -->|"documents"| CORE
    DOC -->|"guides"| EX

    %% Click Events
    click CORE "https://github.com/robotology/idyntree/tree/master/src/core"
    click EST "https://github.com/robotology/idyntree/tree/master/src/estimation"
    click MR "https://github.com/robotology/idyntree/tree/master/src/model"
    click MR "https://github.com/robotology/idyntree/tree/master/src/model_io"
    click IK "https://github.com/robotology/idyntree/tree/master/src/inverse-kinematics"
    click HL "https://github.com/robotology/idyntree/tree/master/src/high-level"
    click OC "https://github.com/robotology/idyntree/tree/master/src/optimalcontrol"
    click SS "https://github.com/robotology/idyntree/tree/master/src/solid-shapes"
    click VIS "https://github.com/robotology/idyntree/tree/master/src/visualization"
    click YARP "https://github.com/robotology/idyntree/tree/master/src/yarp"
    click MB "https://github.com/robotology/idyntree/tree/master/bindings/matlab"
    click PB "https://github.com/robotology/idyntree/tree/master/bindings/python"
    click PB "https://github.com/robotology/idyntree/tree/master/bindings/pybind11"
    click CL "https://github.com/robotology/idyntree/tree/master/src/tools"
    click EX "https://github.com/robotology/idyntree/tree/master/examples"
    click TS "https://github.com/robotology/idyntree/tree/master/src/tests"
    click DOC "https://github.com/robotology/idyntree/tree/master/doc"
    click DOC "https://github.com/robotology/idyntree/tree/master/docs"
    click EXT "https://github.com/robotology/idyntree/tree/master/extern"
    click CI "https://github.com/robotology/idyntree/tree/master/.github/workflows"
    click CI "https://github.com/robotology/idyntree/tree/master/cmake"
    click CI "https://github.com/robotology/idyntree/blob/master/CMakeLists.txt"

    %% Styles
    classDef native fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef binding fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef client fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef infrastructure fill:#FFD700,stroke:#000,stroke-width:1px;
```
