# gritrini/ssg_tomato_poc architecture

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

- Interactive diagram: https://gitdiagram.com/gritrini/ssg_tomato_poc
- Repository: https://github.com/gritrini/ssg_tomato_poc

## Overview

This repository is a robot-control proof of concept: its main workflow runs an apple-handling cycle on an M1013 robot, requests a vision target, executes pick/place and handling motions, and records telemetry for later plotting. The Python controller delegates hardware commands to a wrapper over the external rt_bind backend. Separate from that real-robot path, the repository exposes a simulation trajectory API. The README names only the PoC; workflow details come from the sampled controller. Vision-session setup and some state transitions are in omitted code, so only visible calls and documented capabilities are linked.

Main entry points: [`ssg_tomato_poc/main.py`](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/main.py) (Cycle controller), [`rt_py/robot.py`](https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/robot.py) (Robot wrapper), [`ssg_tomato_poc/apple_rt_log.csv`](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/apple_rt_log.csv) (CSV log), [`ssg_tomato_poc/log_graph.py`](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/log_graph.py) (Log plotter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Apple handling"]
  node_controller["Cycle controller<br/>[main.py]"]
  node_vision["Vision service"]
end

subgraph group_robot_api["Robot control API"]
  node_robot_wrapper["Robot wrapper<br/>[robot.py]"]
  node_robot_backend["rt_bind backend"]
end

subgraph group_simulation["Trajectory simulation"]
  node_robot_model["Robot model<br/>[trajectory.py]"]
  node_traj_generator["Trajectory generator<br/>[trajectory.py]"]
end

subgraph group_telemetry["Telemetry and analysis"]
  node_runtime_log["Runtime log<br/>[main.py]"]
  node_csv_log["CSV log<br/>[apple_rt_log.csv]"]
  node_log_plotter["Log plotter<br/>[log_graph.py]"]
  node_plot_output["Analysis image"]
end

node_operator(("Operator"))

node_operator -->|"starts cycle"| node_controller
node_controller -->|"creates and commands"| node_robot_wrapper
node_robot_wrapper -->|"delegates API"| node_robot_backend
node_controller -->|"requests target"| node_vision
node_vision -.->|"returns target"| node_controller
node_controller -->|"records telemetry"| node_runtime_log
node_runtime_log -->|"writes CSV"| node_csv_log
node_csv_log -->|"loads data"| node_log_plotter
node_log_plotter -->|"saves plot"| node_plot_output
node_robot_model -->|"initializes with model"| node_traj_generator

click node_controller "https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/main.py"
click node_robot_wrapper "https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/robot.py"
click node_robot_model "https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/trajectory.py"
click node_traj_generator "https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/trajectory.py"
click node_runtime_log "https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/main.py"
click node_csv_log "https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/apple_rt_log.csv"
click node_log_plotter "https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/log_graph.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_controller,node_vision toneBlue
class node_robot_wrapper,node_robot_backend toneAmber
class node_robot_model,node_traj_generator toneMint
class node_runtime_log,node_csv_log,node_log_plotter,node_plot_output toneRose
class node_operator toneIndigo
```

## Components

### Apple handling

- [Cycle controller](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/main.py): `ssg_tomato_poc/main.py`
- **Vision service**

### Robot control API

- [Robot wrapper](https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/robot.py): `rt_py/robot.py`
- **rt_bind backend**

### Trajectory simulation

- [Robot model](https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/trajectory.py): `rt_py/trajectory.py`
- [Trajectory generator](https://github.com/gritrini/ssg_tomato_poc/blob/main/rt_py/trajectory.py): `rt_py/trajectory.py`

### Telemetry and analysis

- [Runtime log](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/main.py): `ssg_tomato_poc/main.py`
- [CSV log](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/apple_rt_log.csv): `ssg_tomato_poc/apple_rt_log.csv`
- [Log plotter](https://github.com/gritrini/ssg_tomato_poc/blob/main/ssg_tomato_poc/log_graph.py): `ssg_tomato_poc/log_graph.py`
- **Analysis image**

### Other components

- **Operator**

## Connections

- Operator → Cycle controller: starts cycle (evidence: `ssg_tomato_poc/main.py`)
- Cycle controller → Robot wrapper: creates and commands (evidence: `ssg_tomato_poc/main.py`)
- Robot wrapper → rt_bind backend: delegates API (evidence: `rt_py/robot.py`)
- Cycle controller → Vision service: requests target (evidence: `ssg_tomato_poc/main.py`)
- Vision service → Cycle controller: returns target
- Cycle controller → Runtime log: records telemetry (evidence: `ssg_tomato_poc/main.py`)
- Runtime log → CSV log: writes CSV (evidence: `ssg_tomato_poc/main.py`)
- CSV log → Log plotter: loads data (evidence: `ssg_tomato_poc/log_graph.py`)
- Log plotter → Analysis image: saves plot (evidence: `ssg_tomato_poc/log_graph.py`)
- Robot model → Trajectory generator: initializes with model (evidence: `rt_py/trajectory.py`)
