# jinwoong-jim/capstone2026_code architecture

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

- Interactive diagram: https://gitdiagram.com/jinwoong-jim/capstone2026_code
- Repository: https://github.com/jinwoong-jim/capstone2026_code

## Overview

This repository appears to be a hardware-control application for a physical device or robot, centered around sensing, actuation, and operator feedback. The code is organized more by device function than by classic application layers.

1. Entry point and orchestration
- `main1_6.py` is likely the top-level runtime. It probably wires together sensors, motion control, voice handling, servo control, and display updates.
- `shared.py` and `config.py` likely provide process-wide state, constants, calibration values, and cross-module coordination.

2. Sensor subsystem
- `sensors.py` and `env_sensor.py` suggest a sensor abstraction layer plus a dedicated environmental sensor module.
- `thermal.py` is a separate sensing path for thermal data, likely from an infrared or temperature-related sensor.
- These modules probably feed raw measurements into the rest of the system rather than exposing them directly to the user.

3. Motion and actuation subsystem
- `motions.py` likely defines movement patterns or high-level motor commands.
- `servo_worker.py` and `st3215_servo.py` indicate a servo-specific control stack, probably including a worker loop plus a driver for a ST3215-class servo.
- This separation suggests a boundary between command generation and low-level hardware protocol handling.

4. Voice interface
- `voice.py` is likely responsible for speech input, voice command parsing, or audio feedback.
- In the architecture, voice probably acts as a control/input channel that can trigger motion, servo actions, or mode changes.

5. Display and operator feedback
- `display.py` likely handles screen output, status messages, and live telemetry presentation.
- It probably consumes summarized state from the sensor and control subsystems rather than raw device data.

6. Data flow pattern
- The likely flow is: hardware sensors and voice input produce events/data → shared state or a central loop consolidates them → motion/servo logic decides actions → display shows current status.
- This looks more like a real-time control system than a request/response application.

7. Concurrency boundary
- The presence of `servo_worker.py` strongly suggests a background worker or thread/process dedicated to servo updates.
- That implies the system may separate time-sensitive actuator control from the main orchestration loop to avoid blocking sensor reads or voice processing.

8. Hardware and platform boundary
- Files such as `st3215_servo.py`, `thermal.py`, and `env_sensor.py` imply direct interaction with physical devices.
- These modules likely hide device-specific protocols so that higher-level code can work with generic commands and readings.

9. Configuration and calibration
- `config.py` is likely where device addresses, thresholds, polling intervals, and calibration constants live.
- For an architecture diagram, this sits as a supporting layer influencing all subsystems rather than a runtime component itself.

10. Shared state and coordination
- `shared.py` probably contains global state, locks, or utility functions used to coordinate between the main loop, worker, and peripheral modules.
- This is important because it likely acts as the glue between asynchronous inputs and hardware outputs.

11. Overall architecture shape
- The repository most likely implements a single-device embedded control application with three primary boundaries:
  - input acquisition: sensors and voice
  - decision/control: main loop, motions, shared logic
  - output/action: servos and display
- External dependencies are probably local hardware interfaces rather than network services or web APIs.

12. Confidence note
- The repository README is minimal, so this is an architecture inference from filenames only.
- The module names are consistent enough to infer a real-time robotics or mechatronics control system, but the exact device behavior should be confirmed by reading `main1_6.py` and the hardware-specific modules.

Main entry points: [`main1_6.py`](https://github.com/jinwoong-jim/capstone2026_code/blob/main/main1_6.py) (Main loop), [`shared.py`](https://github.com/jinwoong-jim/capstone2026_code/blob/main/shared.py) (Shared state), [`sensors.py`](https://github.com/jinwoong-jim/capstone2026_code/blob/main/sensors.py) (Sensor layer), [`config.py`](https://github.com/jinwoong-jim/capstone2026_code/blob/main/config.py) (Config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Orchestration"]
  node_main1_6_py["Main loop<br/>runtime<br/>[main1_6.py]"]
end

subgraph group_sense["Sensing"]
  node_sensors_py["Sensor layer<br/>abstraction<br/>[sensors.py]"]
  node_env_sensor_py["Env sensor<br/>hardware input<br/>[env_sensor.py]"]
  node_thermal_py["Thermal sensor<br/>hardware input<br/>[thermal.py]"]
end

subgraph group_act["Actuation"]
  node_motions_py["Motions<br/>motion control<br/>[motions.py]"]
  node_servo_worker_py["Servo worker<br/>[servo_worker.py]"]
  node_st3215_servo_py["Servo driver<br/>hardware driver<br/>[st3215_servo.py]"]
end

subgraph group_ui["Operator I/O"]
  node_voice_py["Voice I/O<br/>input/output<br/>[voice.py]"]
  node_display_py["Display<br/>feedback<br/>[display.py]"]
end

subgraph group_support["Support"]
  node_shared_py["Shared state<br/>coordination<br/>[shared.py]"]
  node_config_py["Config<br/>settings<br/>[config.py]"]
end

node_main1_6_py -->|"reads/writes"| node_shared_py
node_main1_6_py -->|"loads"| node_config_py
node_main1_6_py -->|"polls"| node_sensors_py
node_main1_6_py -->|"handles"| node_voice_py
node_main1_6_py -->|"decides"| node_motions_py
node_main1_6_py -->|"updates"| node_display_py
node_sensors_py -->|"wraps"| node_env_sensor_py
node_sensors_py -->|"wraps"| node_thermal_py
node_sensors_py -->|"publishes"| node_shared_py
node_voice_py -->|"signals"| node_shared_py
node_motions_py -->|"consumes"| node_shared_py
node_motions_py -->|"queues"| node_servo_worker_py
node_servo_worker_py -->|"drives"| node_st3215_servo_py
node_servo_worker_py -->|"syncs"| node_shared_py
node_display_py -->|"renders"| node_shared_py
node_config_py -->|"tunes"| node_sensors_py
node_config_py -->|"tunes"| node_motions_py
node_config_py -->|"configures"| node_st3215_servo_py

click node_main1_6_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/main1_6.py"
click node_shared_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/shared.py"
click node_config_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/config.py"
click node_sensors_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/sensors.py"
click node_env_sensor_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/env_sensor.py"
click node_thermal_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/thermal.py"
click node_voice_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/voice.py"
click node_display_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/display.py"
click node_motions_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/motions.py"
click node_servo_worker_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/servo_worker.py"
click node_st3215_servo_py "https://github.com/jinwoong-jim/capstone2026_code/blob/main/st3215_servo.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_main1_6_py toneBlue
class node_sensors_py,node_env_sensor_py,node_thermal_py toneAmber
class node_motions_py,node_servo_worker_py,node_st3215_servo_py toneMint
class node_voice_py,node_display_py toneRose
class node_shared_py,node_config_py toneIndigo
```

## Components

### Orchestration

Top-level runtime and shared coordination.

- [Main loop](https://github.com/jinwoong-jim/capstone2026_code/blob/main/main1_6.py): runtime · Top-level application entry point that wires subsystems together. · `main1_6.py`

### Sensing

Hardware inputs and measurement paths.

- [Sensor layer](https://github.com/jinwoong-jim/capstone2026_code/blob/main/sensors.py): abstraction · Unified sensor access and aggregation layer. · `sensors.py`
- [Env sensor](https://github.com/jinwoong-jim/capstone2026_code/blob/main/env_sensor.py): hardware input · Environmental sensing path for ambient measurements. · `env_sensor.py`
- [Thermal sensor](https://github.com/jinwoong-jim/capstone2026_code/blob/main/thermal.py): hardware input · Thermal or infrared measurement path. · `thermal.py`

### Actuation

Motion and servo control stack.

- [Motions](https://github.com/jinwoong-jim/capstone2026_code/blob/main/motions.py): motion control · High-level movement patterns and action commands. · `motions.py`
- [Servo worker](https://github.com/jinwoong-jim/capstone2026_code/blob/main/servo_worker.py): worker · Background execution loop for time-sensitive servo updates. · `servo_worker.py`
- [Servo driver](https://github.com/jinwoong-jim/capstone2026_code/blob/main/st3215_servo.py): hardware driver · Low-level ST3215 servo protocol and device control. · `st3215_servo.py`

### Operator I/O

Voice and display feedback paths.

- [Voice I/O](https://github.com/jinwoong-jim/capstone2026_code/blob/main/voice.py): input/output · Speech input or audio feedback channel. · `voice.py`
- [Display](https://github.com/jinwoong-jim/capstone2026_code/blob/main/display.py): feedback · Status and telemetry presentation for the operator. · `display.py`

### Support

Process-wide configuration and state.

- [Shared state](https://github.com/jinwoong-jim/capstone2026_code/blob/main/shared.py): coordination · Global coordination, locks, or state shared across modules. · `shared.py`
- [Config](https://github.com/jinwoong-jim/capstone2026_code/blob/main/config.py): settings · Device constants, calibration values, thresholds, and runtime settings. · `config.py`

## Connections

- Main loop → Shared state: reads/writes · Main runtime uses shared coordination state.
- Main loop → Config: loads · Main runtime applies device settings and calibration.
- Main loop → Sensor layer: polls · Main runtime gathers sensor data through the sensor layer.
- Main loop → Voice I/O: handles · Main runtime receives voice commands or audio events.
- Main loop → Motions: decides · Main runtime translates events into motion commands.
- Main loop → Display: updates · Main runtime refreshes operator-facing status.
- Sensor layer → Env sensor: wraps · Unified sensor layer includes environmental sensing.
- Sensor layer → Thermal sensor: wraps · Unified sensor layer includes thermal sensing.
- Sensor layer → Shared state: publishes · Sensor readings are likely written into shared state.
- Voice I/O → Shared state: signals · Voice events may affect shared command state.
- Motions → Shared state: consumes · Motion logic likely uses shared state and flags.
- Motions → Servo worker: queues · High-level motion commands are handed to the servo worker.
- Servo worker → Servo driver: drives · Worker performs device-level servo updates through the driver.
- Servo worker → Shared state: syncs · Worker likely coordinates timing and current actuator state.
- Display → Shared state: renders · Display consumes consolidated state for operator feedback.
- Config → Sensor layer: tunes · Configuration influences sensor thresholds and polling.
- Config → Motions: tunes · Configuration influences motion parameters and limits.
- Config → Servo driver: configures · Servo driver likely uses device IDs and protocol settings.
