# rtc-research-group/edip_library architecture

> Architecture diagram of the GitHub repository rtc-research-group/edip_library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rtc-research-group/edip_library
- Repository: https://github.com/rtc-research-group/edip_library

## Overview

##### Main Components

- Preprocessing Modules:
– Background Activity Filter: Implements noise reduction by removing uncorrelated events.
– MaskFilter: Eliminates events from certain pixels based on configuration (e.g., observation period).

- Object Motion Detection and Tracking:
– ObjectMotionDetection and ObjectMotionCell(s): These modules, including the cluster object tracker under folders such as “ClusterObjectTracker” and “Example Project Object Trackers and OMC”, cascade several tracker cells and include velocity estimation and pattern matching.

- Interface / Translation:
– WordSerialDAVIS_to_PAERCAVIAR_translator: Contains the logic to convert the AER format from DAVIS sensors to a different AER format used by another board (PAER-CAVIAR). This serves as a key interfacing block between different hardware standards.

- Motor Control:
– Spike-based PID Motor Controller: Implements a PID controller in the spike-domain using pulse frequency modulation to control DC motors with low latency and power savings.

- ED-BioRob Modules (and related subprojects):
– Contains a wealth of VHDL (and some microcontroller and Java) files targeting different FPGA families (Spartan6, Spartan3) and even an 8051 microcontroller project. These are used for applications such as robot control (BioRob), sensor interfacing, and distributed monitoring.

##### Relationships and Interactions Between Components

- Data Flow:
– Preprocessing modules (Background Activity Filter and MaskFilter) handle the raw sensor signal first.
– Processed signals then feed into the object motion detection/tracking blocks where cluster object trackers, motion cells, and velocity estimators work in a cascade to detect and analyze movements.
– For scenarios requiring format conversion, the WordSerial-DAVIS to PAER-CAVIAR translator converts data formats so that subsequent modules (or off-chip systems) can understand the signal.
– Finally, the processed data (or controller signals in the case of motion detection) interface with the spike-based PID motor controller to drive actuators.

- Additional Interfaces:

##### Architectural Patterns and Design Principles

- Modularity and Reusability: Each folder represents a discrete functional block (filtering, tracking, translation, control), illustrating a modular design approach.
- Cascading and Data Pipelining: In the object tracking and motion detection path, several cells (e.g., ObjectMotionCell, ContinuousCounter, etc.) typically operate in cascade, leading to a pipelined processing structure.
- Hardware Interfacing: Notice in ED-BioRob and the translator module there is careful interfacing between different standards and even different device families (FPGA versus microcontroller), emphasizing the importance of clearly defined data buses and combinational/sequential logic boundaries.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Event Input
    Sensor["Event-Based Sensor Input"]:::sensor

    %% Preprocessing Modules
    subgraph "Preprocessing Modules"
        BA["Background Activity Filter"]:::preproc
        MF["MaskFilter"]:::preproc
    end

    %% Merge node for processed signals
    PS["Processed Signals"]:::preproc

    %% Object Motion Detection & Tracking
    subgraph "Object Motion Detection & Tracking"
        %% Cluster/Object Motion Tracker subgraph
        subgraph "Cluster/Object Motion Tracker"
            CM["CMCell"]:::detection
            OT["ObjectTracker"]:::detection
            PR["PRCell"]:::detection
            TC["TrackCell"]:::detection
            VC["VelocityCell"]:::detection
            RAM["single_ram"]:::detection
        end
        %% Object Motion Detection subgraph
        subgraph "Object Motion Detection"
            OMC["ObjectMotionCell"]:::detection
            OMMC["ObjectMotionMotherCell"]:::detection
            OCC["ContinuousCounter"]:::detection
            OMCRec["ObjectMotionCellConfigRecords"]:::detection
        end
        AMD["Approaching Cell"]:::detection
    end

    %% Merge node for tracking output
    TOut["Tracking Output"]:::detection

    %% AER Format Translator
    subgraph "AER Format Translator"
        subgraph "Translator Modules"
            C2W["CAVIAR2WSAER"]:::translator
            W2C["WSAER2CAVIAR2"]:::translator
        end
    end

    %% Spike-based PID Motor Controller
    subgraph "Spike-based PID Motor Controller"
        AD["AER_DIF"]:::control
        AHF["AER_HOLDER_AND_FIRE"]:::control
        BD["Bank_Dif_n_Gen_BW"]:::control
        BIN["Bank_Int_n_Gen_BW"]:::control
        DG["Dif_n_Gen_BW"]:::control
        EG["Event_Generator_signed_BW"]:::control
        LED["LED_DRIVER"]:::control
        PC["POS_CONTROL_PID"]:::control
        SPM["Spikes_PID_MOD"]:::control
    end

    %% ED-BioRob Modules
    subgraph "ED-BioRob Modules"
        ED["ED-BioRob Interface Modules"]:::edbiobrob
    end

    %% Data Flow Connections
    Sensor -->|"feeds"| BA
    Sensor -->|"feeds"| MF
    Sensor -->|"feeds"| ED

    BA --> PS
    MF --> PS

    PS --> CM
    PS --> OMC

    CM --> OT
    OT --> PR
    PR --> TC
    TC --> TOut

    OMC --> OMMC
    OMMC --> TOut
    OCC --> OMCRec
    OMCRec --> TOut

    AMD --> TOut

    TOut --> C2W
    C2W --> W2C
    W2C --> AD

    AD --> AHF
    AHF --> BD
    BD --> BIN
    BIN --> DG
    DG --> EG
    EG --> LED
    LED --> PC
    PC --> SPM

    %% ED-BioRob connection to motor control
    ED --> SPM

    %% Styles
    classDef sensor fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef preproc fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef detection fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef translator fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef control fill:#FF7F7F,stroke:#000,stroke-width:2px;
    classDef edbiobrob fill:#DDA0DD,stroke:#000,stroke-width:2px;

    %% Click Events
    click BA "https://github.com/rtc-research-group/edip_library/blob/master/BackgroudActivityFilter/RetinaFilter.vhd"
    click MF "https://github.com/rtc-research-group/edip_library/blob/master/MaskFilter/HotPixelsFilter.vhd"
    click CM "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/CMCell.vhd"
    click OT "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/ObjectTracker.vhd"
    click PR "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/PRCell.vhd"
    click TC "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/TrackCell.vhd"
    click VC "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/VelocityCell.vhd"
    click RAM "https://github.com/rtc-research-group/edip_library/blob/master/ClusterObjectTracker/single_ram.vhd"
    click OMC "https://github.com/rtc-research-group/edip_library/blob/master/ObjectMotionDetector/ObjectMotionCell.vhd"
    click OMMC "https://github.com/rtc-research-group/edip_library/blob/master/ObjectMotionDetector/ObjectMotionMotherCell.vhd"
    click OCC "https://github.com/rtc-research-group/edip_library/blob/master/ObjectMotionDetector/ContinuousCounter.vhd"
    click OMCRec "https://github.com/rtc-research-group/edip_library/blob/master/ObjectMotionDetector/ObjectMotionCellConfigRecords.vhd"
    click AMD "https://github.com/rtc-research-group/edip_library/tree/master/ApproachingCell"
    click C2W "https://github.com/rtc-research-group/edip_library/blob/master/WordSerialDAVIS_to_PAERCAVIAR_translator/CAVIAR2WSAER.vhd"
    click W2C "https://github.com/rtc-research-group/edip_library/blob/master/WordSerialDAVIS_to_PAERCAVIAR_translator/WSAER2CAVIAR2.vhd"
    click AD "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/AER_DIF.vhd"
    click AHF "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/AER_HOLDER_AND_FIRE.vhd"
    click BD "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/Bank_Dif_n_Gen_BW.vhd"
    click BIN "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/Bank_Int_n_Gen_BW.vhd"
    click DG "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/Dif_n_Gen_BW.vhd"
    click EG "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/Event_Generator_signed_BW.vhd"
    click LED "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/LED_DRIVER.vhd"
    click PC "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/POS_CONTROL_PID.vhd"
    click SPM "https://github.com/rtc-research-group/edip_library/blob/master/Spikebased-PID-motor-controller/Spikes_PID_MOD.vhd"
    click ED "https://github.com/rtc-research-group/edip_library/tree/master/ED-BioRob"
```
