# isaac-art/drawbot architecture

> Architecture diagram of the GitHub repository isaac-art/drawbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/isaac-art/drawbot
- Repository: https://github.com/isaac-art/drawbot

## Overview

##### Main System Components

a) Input Processing Layer
- Image input processing pipeline
- 'portrait_2_line_art.py' and 'image_2_paths.py' as key processors
- 'images' directory as the source of input

b) Path Processing Layer
- 'path_processor.py' as the central component
- Connection to 'path_sender.py' for robot communication

c) Robot Control Layer
- Feature 'robot.py' as the main robot interface
- Dobot CR5 hardware component
- Coordinate system and movement control

d) Support Systems
- 'utils.py' for utility functions
- 'camera_test.py' for vision system integration
- '3D' directory for physical components

##### Component Relationships

**[Input Image] → [Portrait to Line Art] → [Image to Paths] → [Path Processor] → [Path Sender] → [Robot Controller] → [Dobot CR5]**

##### Technical Details

Annotations for:
- Python environment dependencies
- Robot configuration parameters (speed factor, coordinate system)
- 3D printing components (reference the STL and GCODE files)
- File storage locations (images and output directories)

##### Key Processes to Highlight

Workflows:
a) Image Processing Pipeline:
**Raw Image → Line Art Conversion → Path Generation**

b) Robot Control Flow:
**Path Data → Movement Commands → Physical Drawing**

##### Implementation Details

Technical specifications:
- Robot initialization parameters
- Coordinate system configuration (User 6)
- Speed factor settings (50%)
- Movement types (servo_p_sync, mov_l)
- Z-axis safety position (-30)

##### Physical Components

Relationship between:
- 3D printed components (Body1.stl, RobotNozzle.gcode)
- Robot end effector
- Drawing surface

This architectural representation will help developers understand both the high-level system flow and the specific implementation details necessary for maintaining and extending the system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Legend"
        direction TB
        S1[Software Component]:::software
        S2[Input/Output Data]:::data
        S3[Hardware Component]:::hardware
        S4[Support Utility]:::utility
        S5[Directory]:::directory
    end

    subgraph "Input Processing Layer"
        direction TB
        Images[Images Directory]:::directory
        LineArt[Portrait to Line Art]:::software
        PathGen[Image to Paths]:::software
        Images --> LineArt
        LineArt --> PathGen
    end

    subgraph "Path Processing Layer"
        direction TB
        PathProc[Path Processor]:::software
        PathSend[Path Sender]:::software
        PathProc --> PathSend
    end

    subgraph "Robot Control Layer"
        direction TB
        RobotInt[Robot Interface]:::software
        RobotConfig[Robot Configuration]:::data
        DobotCR5[Dobot CR5]:::hardware
        RobotInt --> DobotCR5
        RobotConfig --> RobotInt
    end

    subgraph "Support Systems"
        direction TB
        Utils[Utilities]:::utility
        CameraTest[Vision System]:::utility
        Components["3D Components"]:::directory
    end

    subgraph "Output"
        direction TB
        OutputDir[Output Directory]:::directory
    end

    PathGen --> PathProc
    PathSend --> RobotInt
    Utils --> PathProc
    Utils --> RobotInt
    CameraTest --> RobotInt

    click Images "https://github.com/isaac-art/drawbot/tree/main/images"
    click LineArt "https://github.com/isaac-art/drawbot/blob/main/portrait_2_line_art.py"
    click PathGen "https://github.com/isaac-art/drawbot/blob/main/image_2_paths.py"
    click PathProc "https://github.com/isaac-art/drawbot/blob/main/path_processor.py"
    click PathSend "https://github.com/isaac-art/drawbot/blob/main/path_sender.py"
    click RobotInt "https://github.com/isaac-art/drawbot/blob/main/robot.py"
    click RobotConfig "https://github.com/isaac-art/drawbot/blob/main/linear-api.json"
    click Utils "https://github.com/isaac-art/drawbot/blob/main/utils.py"
    click CameraTest "https://github.com/isaac-art/drawbot/blob/main/camera_test.py"
    click Components "https://github.com/isaac-art/drawbot/tree/main/3D"
    click OutputDir "https://github.com/isaac-art/drawbot/tree/main/output"

    classDef software fill:#3498db,stroke:#2980b9,color:white
    classDef data fill:#2ecc71,stroke:#27ae60,color:white
    classDef hardware fill:#e74c3c,stroke:#c0392b,color:white
    classDef utility fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef directory fill:#f1c40f,stroke:#f39c12,color:black
```
