# i2rt-robotics/i2rt architecture

> Architecture diagram of the GitHub repository i2rt-robotics/i2rt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/i2rt-robotics/i2rt
- Repository: https://github.com/i2rt-robotics/i2rt

## Overview

#### Purpose and Entry Points
I2RT is a Python hardware/control SDK for YAM robot arms, grippers, and Flow Base mobile platforms. It supports real CAN-connected deployment, teleoperation, recording/replay, and MuJoCo/Viser simulation-control workflows. Primary entry points are the arm factory at `i2rt/robots/get_robot.py`, the arm CLI in `i2rt/robots/motor_chain_robot.py`, and Flow Base controller/client paths `i2rt/flow_base/flow_base_controller.py` and `i2rt/flow_base/flow_base_client.py`.

#### Motor and CAN Boundary
The hardware boundary is Linux SocketCAN (`can0`, etc.) communicating with DM-series motors. `i2rt/motor_drivers/can_interface.py` owns CAN transport, while `i2rt/motor_drivers/dm_driver.py` implements motor protocol/control operations. Robot and configuration layers should depend on these drivers rather than directly forming CAN traffic. Provisioning/reset scripts and device rules under `devices/` support the host-side CAN/USB environment.

#### Configured Robot Assembly
Robot variants are declaratively selected from arm/gripper YAML definitions in `i2rt/robots/config/yam_v1.yml`, `i2rt/robots/config/yam_ultra_v2.yml`, and `i2rt/robots/config/linear_4310.yml`. `i2rt/robots/get_robot.py` resolves those selections into assembled robot instances. This separates product variants, motor-chain topology, and model selection from reusable runtime control code.

#### Arm Runtime and Control Contract
`i2rt/robots/robot.py` defines the high-level robot-facing interface: read joint state and issue commands. `i2rt/robots/motor_chain_robot.py` adapts that interface to a physical chained set of CAN motors, including arm/gripper control behavior and safety-sensitive real-time command flow. `i2rt/robots/kinematics.py` provides kinematic calculations used by robot control, while `i2rt/robots/sim_robot.py` provides a simulation-oriented implementation behind the same conceptual contract.

#### Simulation, Dynamics, and Operator Interfaces
MuJoCo support bridges robot state/control with physical models through `i2rt/utils/mujoco_control_interface.py` and `i2rt/utils/mujoco_utils.py`; it is used for visualization, simulation, and gravity-compensation-related workflows. Browser/operator interaction is a separate adapter in `i2rt/utils/viser_control_interface.py`. Examples such as `examples/control_with_mujoco/control_with_mujoco.py` and `examples/control_with_viser/control_with_viser.py` demonstrate these external runtime integrations without becoming core dependencies of motor control.

#### Robot Model Assets
Versioned URDF and MJCF/XML models define arm, gripper, and station geometry/dynamics and are coupled to configuration-selected variants. Key model sources include `i2rt/robot_models/arm/yam/v1/yam.urdf`, `i2rt/robot_models/arm/yam/v1/yam.xml`, and `i2rt/robot_models/station/yam_station_linear_4310_d405/yam_station_linear_4310_d405.xml`. Mesh assets live adjacent to models. Agent skills under `.agents/skills/align-urdf-mjcf/` and `.agents/skills/transform-onshape-urdf/` support maintaining alignment between imported URDFs and MJCF assets.

#### Flow Base Subsystem
Flow Base is a parallel subsystem rather than an arm extension. `i2rt/flow_base/flow_base_client.py` exposes network client control to a base host, while `i2rt/flow_base/flow_base_controller.py` is the local control/joystick runtime. `i2rt/flow_base/linear_rail_controller.py` covers rail-specific actuation, and `i2rt/flow_base/caster_steering_check.py` handles steering-state validation. Its external boundary is network/device control, distinct from arm motor-chain CAN control.

#### Data Capture and Deployment Workflows
Trajectory/state data is captured and replayed through `i2rt/utils/recording.py`, consumed by workflows such as `examples/record_replay_trajectory/record_replay_trajectory.py`. Teleoperation composes two robot instances and their command/state streams, as in `examples/minimum_gello/minimum_gello.py` and `examples/bimanual_lead_follower/bimanual_lead_follower.py`. Motor maintenance is intentionally isolated in `i2rt/motor_config_tool/`, including register access via `i2rt/motor_config_tool/dm_motor_registers.py`, because persistent controller changes are operationally and safety critical.

Main entry points: [`i2rt/robots/robot.py`](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/robot.py) (Robot contract), [`i2rt/robots/get_robot.py`](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/get_robot.py) (Robot factory), [`i2rt/robots/motor_chain_robot.py`](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/motor_chain_robot.py) (Motor-chain robot), [`i2rt/flow_base/flow_base_controller.py`](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/flow_base_controller.py) (Flow Base controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arm["Arm runtime"]
  node_factory{{"Robot factory<br/>assembly<br/>[get_robot.py]"}}
  node_configs["Variant YAML<br/>robot configuration<br/>[yam_v1.yml]"]
  node_robot_contract["Robot contract<br/>interface<br/>[robot.py]"]
  node_motor_chain["Motor-chain robot<br/>hardware adapter"]
  node_kinematics["Kinematics<br/>control math<br/>[kinematics.py]"]
  node_can_transport["SocketCAN transport<br/>CAN driver<br/>[can_interface.py]"]
  node_dm_driver["DM motor driver<br/>motor protocol<br/>[dm_driver.py]"]
  node_socketcan(("Linux SocketCAN / motors<br/>hardware boundary"))
end

subgraph group_sim["Simulation &amp; workflows"]
  node_sim_robot["Sim robot<br/>robot implementation<br/>[sim_robot.py]"]
  node_mujoco_bridge["MuJoCo control bridge<br/>simulation adapter"]
  node_mujoco_utils["MuJoCo utilities<br/>dynamics support<br/>[mujoco_utils.py]"]
  node_viser["Viser control<br/>browser adapter"]
  node_recording["Recording &amp; replay<br/>trajectory data<br/>[recording.py]"]
  node_teleop_example["Teleoperation workflows<br/>example workflow<br/>[minimum_gello.py]"]
end

subgraph group_flow["Flow Base"]
  node_flow_client["Flow Base client<br/>network client"]
  node_flow_controller["Flow Base controller<br/>local runtime"]
  node_rail["Linear rail control<br/>actuation controller"]
  node_steering_check["Caster steering validation<br/>state validation"]
  node_flow_boundary(("Base network / devices<br/>external boundary"))
end

subgraph group_assets["Models &amp; deployment"]
  node_models["Robot model assets<br/>URDF / MJCF<br/>[yam.urdf]"]
  node_motor_config["Motor configuration tool<br/>maintenance tooling"]
  node_devices["Host device setup<br/>deployment support"]
end

node_configs -->|"selects variant"| node_factory
node_factory -->|"assembles implementations"| node_robot_contract
node_factory -->|"creates hardware robot"| node_motor_chain
node_factory -->|"creates simulation robot"| node_sim_robot
node_configs -->|"couples variant to model"| node_models
node_motor_chain -->|"implements"| node_robot_contract
node_sim_robot -->|"implements"| node_robot_contract
node_motor_chain -->|"uses"| node_kinematics
node_motor_chain -->|"commands motors through"| node_dm_driver
node_dm_driver -->|"uses"| node_can_transport
node_can_transport -->|"CAN traffic"| node_socketcan
node_devices -.->|"provisions host access"| node_socketcan
node_motor_config -.->|"maintains registers"| node_dm_driver
node_sim_robot -->|"simulation control"| node_mujoco_bridge
node_mujoco_bridge -->|"uses"| node_mujoco_utils
node_mujoco_bridge -->|"loads dynamics model"| node_models
node_viser -->|"operator commands and state"| node_robot_contract
node_recording -->|"captures and replays streams"| node_robot_contract
node_teleop_example -->|"coordinates robot instances"| node_robot_contract
node_flow_client -->|"network control"| node_flow_boundary
node_flow_controller -->|"local device control"| node_flow_boundary
node_flow_controller -->|"actuates"| node_rail
node_flow_controller -->|"validates steering"| node_steering_check

click node_factory "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/get_robot.py"
click node_configs "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/config/yam_v1.yml"
click node_robot_contract "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/robot.py"
click node_motor_chain "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/motor_chain_robot.py"
click node_kinematics "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/kinematics.py"
click node_can_transport "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_drivers/can_interface.py"
click node_dm_driver "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_drivers/dm_driver.py"
click node_sim_robot "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/sim_robot.py"
click node_mujoco_bridge "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/mujoco_control_interface.py"
click node_mujoco_utils "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/mujoco_utils.py"
click node_viser "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/viser_control_interface.py"
click node_recording "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/recording.py"
click node_teleop_example "https://github.com/i2rt-robotics/i2rt/blob/main/examples/minimum_gello/minimum_gello.py"
click node_flow_client "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/flow_base_client.py"
click node_flow_controller "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/flow_base_controller.py"
click node_rail "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/linear_rail_controller.py"
click node_steering_check "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/caster_steering_check.py"
click node_models "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robot_models/arm/yam/v1/yam.urdf"
click node_motor_config "https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_config_tool/dm_motor_registers.py"

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_factory,node_configs,node_robot_contract,node_motor_chain,node_kinematics,node_can_transport,node_dm_driver,node_socketcan toneBlue
class node_sim_robot,node_mujoco_bridge,node_mujoco_utils,node_viser,node_recording,node_teleop_example toneAmber
class node_flow_client,node_flow_controller,node_rail,node_steering_check,node_flow_boundary toneMint
class node_models,node_motor_config,node_devices toneRose
```

## Components

### Arm runtime

- [Robot factory](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/get_robot.py): assembly · Resolves configured arm and gripper variants. · `i2rt/robots/get_robot.py`
- [Variant YAML](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/config/yam_v1.yml): robot configuration · `i2rt/robots/config/yam_v1.yml`
- [Robot contract](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/robot.py): interface · Joint-state and command interface. · `i2rt/robots/robot.py`
- [Motor-chain robot](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/motor_chain_robot.py): hardware adapter · Safety-sensitive chained arm and gripper control. · `i2rt/robots/motor_chain_robot.py`
- [Kinematics](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/kinematics.py): control math · `i2rt/robots/kinematics.py`
- [SocketCAN transport](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_drivers/can_interface.py): CAN driver · `i2rt/motor_drivers/can_interface.py`
- [DM motor driver](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_drivers/dm_driver.py): motor protocol · `i2rt/motor_drivers/dm_driver.py`
- **Linux SocketCAN / motors**: hardware boundary · CAN interfaces connect to DM-series motors.

### Simulation & workflows

- [Sim robot](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robots/sim_robot.py): robot implementation · `i2rt/robots/sim_robot.py`
- [MuJoCo control bridge](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/mujoco_control_interface.py): simulation adapter · `i2rt/utils/mujoco_control_interface.py`
- [MuJoCo utilities](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/mujoco_utils.py): dynamics support · `i2rt/utils/mujoco_utils.py`
- [Viser control](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/viser_control_interface.py): browser adapter · `i2rt/utils/viser_control_interface.py`
- [Recording & replay](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/utils/recording.py): trajectory data · `i2rt/utils/recording.py`
- [Teleoperation workflows](https://github.com/i2rt-robotics/i2rt/blob/main/examples/minimum_gello/minimum_gello.py): example workflow · Composes robot state and command streams. · `examples/minimum_gello/minimum_gello.py`

### Flow Base

Independent mobile-platform subsystem.

- [Flow Base client](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/flow_base_client.py): network client · Remote control of a base host. · `i2rt/flow_base/flow_base_client.py`
- [Flow Base controller](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/flow_base_controller.py): local runtime · Local joystick and device-control runtime. · `i2rt/flow_base/flow_base_controller.py`
- [Linear rail control](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/linear_rail_controller.py): actuation controller · `i2rt/flow_base/linear_rail_controller.py`
- [Caster steering validation](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/flow_base/caster_steering_check.py): state validation · `i2rt/flow_base/caster_steering_check.py`
- **Base network / devices**: external boundary

### Models & deployment

- [Robot model assets](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/robot_models/arm/yam/v1/yam.urdf): URDF / MJCF · Geometry and dynamics selected by robot variants. · `i2rt/robot_models/arm/yam/v1/yam.urdf`
- [Motor configuration tool](https://github.com/i2rt-robotics/i2rt/blob/main/i2rt/motor_config_tool/dm_motor_registers.py): maintenance tooling · Isolates persistent controller register changes. · `i2rt/motor_config_tool/dm_motor_registers.py`
- **Host device setup**: deployment support · CAN/USB provisioning, reset scripts, and rules.

## Connections

- Variant YAML → Robot factory: selects variant
- Robot factory → Robot contract: assembles implementations
- Robot factory → Motor-chain robot: creates hardware robot
- Robot factory → Sim robot: creates simulation robot
- Variant YAML → Robot model assets: couples variant to model
- Motor-chain robot → Robot contract: implements
- Sim robot → Robot contract: implements
- Motor-chain robot → Kinematics: uses
- Motor-chain robot → DM motor driver: commands motors through
- DM motor driver → SocketCAN transport: uses
- SocketCAN transport → Linux SocketCAN / motors: CAN traffic
- Host device setup → Linux SocketCAN / motors: provisions host access
- Motor configuration tool → DM motor driver: maintains registers
- Sim robot → MuJoCo control bridge: simulation control
- MuJoCo control bridge → MuJoCo utilities: uses
- MuJoCo control bridge → Robot model assets: loads dynamics model
- Viser control → Robot contract: operator commands and state
- Recording & replay → Robot contract: captures and replays streams
- Teleoperation workflows → Robot contract: coordinates robot instances
- Flow Base client → Base network / devices: network control
- Flow Base controller → Base network / devices: local device control
- Flow Base controller → Linear rail control: actuates
- Flow Base controller → Caster steering validation: validates steering
