# bkairat/robotics architecture

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

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

## Overview

This is a command-line application for sorting ArUco-marked cubes into marked boxes with a CRS97 robot. Its main workflow selects a mode, moves the robot to a camera position, detects cubes and boxes, runs a sorting task, and commands the robot to pick and place cubes. The README also documents setup, initialization, motor reset, shutdown preparation, and image display modes. The graph follows the sampled entry point and source; the sorting classes shown in task.py differ from the names imported by main.py, so that mismatch is not resolved here.

Main entry points: [`main.py`](https://github.com/bkairat/robotics/blob/main/main.py) (Mode dispatcher), [`robot.py`](https://github.com/bkairat/robotics/blob/main/robot.py) (Motion and gripper control), [`camera.py`](https://github.com/bkairat/robotics/blob/main/camera.py) (Image and marker vision), [`task.py`](https://github.com/bkairat/robotics/blob/main/task.py) (Sorting task)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Mode workflow"]
  node_main["Mode dispatcher<br/>[main.py]"]
  node_sorting["Sorting task<br/>[task.py]"]
end

subgraph group_vision["Camera vision"]
  node_camera["Image and marker vision<br/>[camera.py]"]
end

subgraph group_manipulation["Robot manipulation"]
  node_robot["Motion and gripper control<br/>[robot.py]"]
end

node_user(("Operator"))
node_camera_device["Chameleon camera"]
node_pyrocon["Pyrocon control library"]
node_crs97["CRS97 robot"]

node_user -->|"selects mode"| node_main
node_main -->|"creates camera"| node_camera
node_main -->|"creates controller"| node_robot
node_main -->|"requests detections"| node_camera
node_main -->|"constructs task"| node_sorting
node_main -->|"prepares position"| node_robot
node_camera -->|"captures frames"| node_camera_device
node_sorting -->|"commands pick and place"| node_robot
node_robot -->|"issues motion commands"| node_pyrocon
node_pyrocon -.->|"controls robot"| node_crs97

click node_main "https://github.com/bkairat/robotics/blob/main/main.py"
click node_sorting "https://github.com/bkairat/robotics/blob/main/task.py"
click node_camera "https://github.com/bkairat/robotics/blob/main/camera.py"
click node_robot "https://github.com/bkairat/robotics/blob/main/robot.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_main,node_sorting toneBlue
class node_camera toneAmber
class node_robot toneMint
class node_user,node_camera_device,node_pyrocon,node_crs97 toneIndigo
```

## Components

### Mode workflow

- [Mode dispatcher](https://github.com/bkairat/robotics/blob/main/main.py): `main.py`
- [Sorting task](https://github.com/bkairat/robotics/blob/main/task.py): `task.py`

### Camera vision

- [Image and marker vision](https://github.com/bkairat/robotics/blob/main/camera.py): `camera.py`

### Robot manipulation

- [Motion and gripper control](https://github.com/bkairat/robotics/blob/main/robot.py): `robot.py`

### Other components

- **Operator**
- **Chameleon camera**
- **Pyrocon control library**
- **CRS97 robot**

## Connections

- Operator → Mode dispatcher: selects mode (evidence: `README.md`)
- Mode dispatcher → Image and marker vision: creates camera (evidence: `main.py`)
- Mode dispatcher → Motion and gripper control: creates controller (evidence: `main.py`)
- Mode dispatcher → Image and marker vision: requests detections (evidence: `main.py`)
- Mode dispatcher → Sorting task: constructs task (evidence: `main.py`)
- Mode dispatcher → Motion and gripper control: prepares position (evidence: `main.py`)
- Image and marker vision → Chameleon camera: captures frames (evidence: `camera.py`)
- Sorting task → Motion and gripper control: commands pick and place (evidence: `task.py`)
- Motion and gripper control → Pyrocon control library: issues motion commands (evidence: `robot.py`)
- Pyrocon control library → CRS97 robot: controls robot
