# luxonis/factory-calibration-depthai architecture

> Architecture diagram of the GitHub repository luxonis/factory-calibration-depthai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luxonis/factory-calibration-depthai
- Repository: https://github.com/luxonis/factory-calibration-depthai

## Overview

##### Project Type and Purpose
- This is an open-source robotics calibration tool built on ROS Melodic. It combines two CATKIN workspaces:
- python3_ws for DepthAI camera capture and automatic Charuco-board calibration nodes (Python-3)
- interbotix_ws for controlling the Interbotix ViperX-300 6DOF arm via MoveIt (Python-2/C++)
- The primary use case is to automate stereo calibration of a DepthAI camera mounted on a 6DOF robot arm, running on Ubuntu 18.04.

##### File Structure Analysis
- Top level: two ROS workspaces (interbotix_ws and python3_ws), plus utility scripts (server.py, enable_cm4_oak.py).
- interbotix_ws splits into:
- interbotix_descriptions (URDF/XACRO, meshes, RViz configs)
- interbotix_gazebo (Gazebo launch, textures, controller YAMLs)
- interbotix_moveit (MoveIt SRDF, planners, launch files)
- interbotix_moveit_interface (C++/Python wrapper, ROS services, Python scripts for capture and planning)
- interbotix_sdk (low-level SDK: message definitions, C++ nodes, Python API, PID configs)
- python3_ws contains the calibration package: ROS node (depthai_calibrator), launch files, Python helpers, Charuco resources, custom ROS services.

##### README Insights
- One ROS Master orchestrates both workspaces.
- DepthAI node publishes image streams and exposes services (/capture_checkerboard, /calibrate_stereo).
- MoveIt interface node offers a /MoveItPlan service, subscribes to planning result, and publishes JointCommands.
- SDK node subscribes to JointCommands, communicates over USB to robot hardware.
- There is optional Gazebo simulation in interbotix_gazebo for offline testing.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Central orchestration
    ROSMaster["ROS Master"]:::core

    %% Perception Layer
    subgraph "Workspace: python3_ws"
        subgraph "Calibration Package"
            DepthAINode["DepthAI Calibration Node"]:::perception
        end
    end

    %% Planning Layer
    subgraph "Workspace: interbotix_ws"
        subgraph "Description & MoveIt"
            Descriptions["Robot Description\n(URDF & XACRO)"]:::planning
            MoveItCore["MoveIt Core"]:::planning
        end
        subgraph "Interface"
            MoveItInterface["Interbotix MoveIt Interface Node"]:::planning
        end
        subgraph "Execution Layer"
            SDKNode["SDK Node"]:::execution
        end
        subgraph "Gazebo Simulator\n(Optional)" 
            Gazebo["Gazebo Simulator"]:::hardware
        end
    end

    %% Hardware Layer
    DepthAICam["DepthAI Camera Hardware"]:::hardware
    RobotArm["Robot Arm Hardware"]:::hardware

    %% Connections: services (dashed) and data flows (solid)
    DepthAINode -->|"DepthAI API"| DepthAICam
    DepthAINode -.->|"capture/calibrate\nservices"| ROSMaster
    ROSMaster -.->|"services/topics"| MoveItInterface
    MoveItInterface -->|"plan request\n(/MoveItPlan)"| ROSMaster
    MoveItInterface -->|"calls planning"| MoveItCore
    MoveItCore -->|"JointTrajectory"| MoveItInterface
    MoveItInterface -->|"JointCommands"| SDKNode
    SDKNode -->|"USB Comm"| RobotArm
    Gazebo -.->|"simulated topics"| ROSMaster

    %% Click events
    click DepthAINode "https://github.com/luxonis/factory-calibration-depthai/tree/main/python3_ws/src/calibration"
    click MoveItInterface "https://github.com/luxonis/factory-calibration-depthai/tree/main/interbotix_ws/src/interbotix_moveit_interface"
    click MoveItCore "https://github.com/luxonis/factory-calibration-depthai/tree/main/interbotix_ws/src/interbotix_moveit"
    click Descriptions "https://github.com/luxonis/factory-calibration-depthai/tree/main/interbotix_ws/src/interbotix_descriptions"
    click SDKNode "https://github.com/luxonis/factory-calibration-depthai/tree/main/interbotix_ws/src/interbotix_sdk"
    click Gazebo "https://github.com/luxonis/factory-calibration-depthai/tree/main/interbotix_ws/src/interbotix_gazebo"

    %% Styling
    classDef perception fill:#BBDEFB,stroke:#1E88E5,color:#0D47A1;
    classDef planning fill:#C8E6C9,stroke:#388E3C,color:#1B5E20;
    classDef execution fill:#FFE0B2,stroke:#F57C00,color:#E65100;
    classDef hardware fill:#EEEEEE,stroke:#757575,color:#424242;
    classDef core fill:#F5F5F5,stroke:#9E9E9E,color:#616161,stroke-width:2px;
    class ROSMaster core
```
