# unswcomputing/runswift-2024-release architecture

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

- Interactive diagram: https://gitdiagram.com/unswcomputing/runswift-2024-release
- Repository: https://github.com/unswcomputing/runswift-2024-release

## Overview

Key Components to Include:

##### Core System Architecture
- Hardware Layer (NAO Robot)
- Perception Layer (vision, kinematics, audio)
- State Estimation Layer (localization, ball tracking)
- Behavior Layer (Python-based decision making)
- Motion Layer (walking, kicking)

##### Major Subsystems
a. Vision System:
- Camera inputs
- Image processing pipeline
- Object detection (ball, goals, field features)
- Neural network components (tiny-dnn integration)

b. Motion Control:
- Walk engine
- Action generators
- Joint control
- Sensor feedback

c. Behavior System:
- Python behavior engine
- Role-based behaviors
- Skill execution
- Team coordination

##### Communication Flows
- Inter-process communication
- Team communication
- Debug data streams
- Sensor data flow

##### External Tools
- Off-robot tools:
- OffNao debugger
- WebNao interface
- Configuration tools
- Simulation connections

Design Guidelines:

##### Layer Organization
- In hierarchical layers
- Clear data flow between layers
- Critical interfaces

##### Component Relationships
- Solid: Direct communication

##### Details
- Blackboard system for data sharing
- Thread management
- Configuration system
- Debug interfaces

Special Considerations:

##### Blackboard Architecture
- Central to system design
- Shows data sharing between components
- Highlights thread safety

##### Python-C++ Integration
- Behavior system bridge
- API interfaces
- Data marshalling

##### Real-time Aspects
- Thread priorities
- Performance-critical paths
- Timing constraints

##### Development Tools
- Build system
- Deployment tools
- Debug utilities
- Configuration management

Remember to include version information and any relevant configuration dependencies, as this system appears to support multiple NAO robot versions and configurations.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Hardware
        NAO[NAO Robot Hardware]
        HWInterface["Hardware Interface"]:::hardware
    end

    subgraph Perception
        Vision["Vision System"]:::perception
        Camera["Camera Control"]:::perception
        VisionDetect["Vision Detectors"]:::perception
        VisionProcess["Vision Processing"]:::perception
        StateEst["State Estimation"]:::perception
    end

    subgraph Behavior
        PythonEngine["Python Behavior Engine"]:::behavior
        BehaviorInt["Behavior Interface"]:::behavior
        SkillsRoles["Skills & Roles"]:::behavior
    end

    subgraph Motion
        MotionCore["Motion Core"]:::motion
        MotionGen["Motion Generator"]:::motion
        MotionEff["Motion Effector"]:::motion
        TouchSense["Touch/Sensors"]:::motion
    end

    subgraph Communication
        TeamComm["Team Communication"]:::comm
        GameCtrl["Game Controller"]:::comm
        NetReceiver["Network Receiver"]:::comm
    end

    subgraph DataManagement
        Blackboard["Blackboard System"]:::data
        Config["Configuration"]:::data
        Types["Types/Structures"]:::data
    end

    subgraph ExternalTools
        OffNao["OffNao Debugger"]:::tools
        WebNao["WebNao Interface"]:::tools
        VATNao["Vision Analysis Tool"]:::tools
        RemoteCtrl["Remote Control"]:::tools
    end

    subgraph ML
        NeuralNet["Neural Network"]:::ml
        Models["Model Files"]:::ml
    end

    %% Connections
    NAO --> HWInterface
    HWInterface --> Vision
    Vision --> |Image Data| Camera
    Camera --> VisionDetect
    VisionDetect --> VisionProcess
    VisionProcess --> StateEst
    StateEst --> Blackboard
    
    Blackboard <--> PythonEngine
    PythonEngine <--> BehaviorInt
    BehaviorInt <--> SkillsRoles
    
    Blackboard <--> MotionCore
    MotionCore --> MotionGen
    MotionGen --> MotionEff
    TouchSense --> MotionCore
    
    TeamComm <--> Blackboard
    GameCtrl <--> Blackboard
    NetReceiver --> Blackboard
    
    Blackboard --> ExternalTools
    NeuralNet --> VisionDetect
    Models --> NeuralNet
    Config --> Blackboard
    Types --> Blackboard

    %% Click Events
    click HWInterface "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/libagent"
    click Vision "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/vision"
    click Camera "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/vision/camera"
    click VisionDetect "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/vision/detector"
    click VisionProcess "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/vision/middleinfoprocessor"
    click StateEst "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/stateestimation"
    click PythonEngine "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/image/home/nao/data/behaviours"
    click BehaviorInt "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/perception/behaviour/python"
    click SkillsRoles "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/image/home/nao/data/behaviours/body"
    click MotionCore "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/motion"
    click MotionGen "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/motion/generator"
    click MotionEff "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/motion/effector"
    click TouchSense "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/motion/touch"
    click TeamComm "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/transmitter"
    click GameCtrl "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/gamecontroller"
    click NetReceiver "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/receiver"
    click Blackboard "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/blackboard"
    click Config "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/image/home/nao/data/configs"
    click Types "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/types"
    click OffNao "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/utils/offnao"
    click WebNao "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/utils/webnao"
    click VATNao "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/utils/vatnao"
    click RemoteCtrl "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/utils/remoteControl"
    click NeuralNet "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/robot/tiny-dnn"
    click Models "https://github.com/UNSWComputing/rUNSWift-2024-release/tree/main/ml_models"

    %% Styles
    classDef hardware fill:#f9f,stroke:#333,stroke-width:2px
    classDef perception fill:#9cf,stroke:#333,stroke-width:2px
    classDef behavior fill:#9f9,stroke:#333,stroke-width:2px
    classDef motion fill:#f99,stroke:#333,stroke-width:2px
    classDef comm fill:#ff9,stroke:#333,stroke-width:2px
    classDef data fill:#ccc,stroke:#333,stroke-width:2px
    classDef tools fill:#c9c,stroke:#333,stroke-width:2px
    classDef ml fill:#fc9,stroke:#333,stroke-width:2px
```
