Skip to content

Class Diagram

sangyeop edited this page Apr 16, 2026 · 60 revisions

APP(모듈 기본구조)

classDiagram
    namespace c {
        class task{
            run()
            step()        
        }
    }

    class service{
      comm::communication* comm
      hal::hardware* hardware
      serve()
    }

    namespace comm {
        class communication{
            <<interface>>
        init()
        send()
        receive()
        }
    }

    namespace hal {
        class hardware{
            <<interface>>
        read()
        write()
        }
    }
    
    communication --* service
    hardware --* service
    service <-- task
Loading

ACT

classDiagram
    namespace c {
        class status_task{
            run()
            step()        
        }
        class inspect_task{
            run()
            step()        
        }
        class reboot_task{
            run()
            step()
        }
    }

    class status_service{
      hal::zynQ* zynQ
      serve()
    }

    class inspect_service{
        hal::servo* servo
        serve()
    }

    class reboot_service{
        comm::communication* comm
        hall::servo* servo    
        serve()
    }
    
    status_service <-- status_task
    inspect_service <-- inspect_task
    reboot_service <-- reboot_task

    namespace hal {
        class zynQ{
            <<interface>>
        read()
        write()
        reset()
        }

         class servo{
            <<interface>>
        read()
        write()
        }
    }
  

    namespace comm {
        class communication{
            <<interface>>
        init()
        send()
        receive()
        }
    }

    communication --o status_task
    communication --o inspect_task
    communication --o status_service
    communication --o inspect_service
    communication --o reboot_task
    zynQ --* status_service
    
    
Loading

GCU

classDiagram
    namespace c {
        class status_task{
            부체계 상태 수신 및 UI 전달
            run()
            step()        
        }
        class inspect_task{
            기능 점검 시퀀스 관리
            run()
            step()        
        }
        class reboot_task{
            재부팅 명령 처리
            run()
            step()        
        }
    }

    class status_service{
      comm::communication* comm
      serve()
      collect_status()
      send_to_ui()
    }

    class inspect_service{
      comm::communication* comm
      serve()
      send_ready_command()
      request_data()
      collect_result()
      send_result_to_ui()
      send_finish_command()
    }

    class reboot_service{
      comm::communication* comm
      serve()
      reboot_gcu()
      reboot_subsystem()
    }

    namespace comm {
        class communication{
            <<interface>>
        init()
        send()
        receive()
        }
    }

    communication --* status_service
    communication --* inspect_service
    communication --* reboot_service
    status_service <-- status_task
    inspect_service <-- inspect_task
    reboot_service <-- reboot_task
Loading

INS

classDiagram
    namespace Task {
        class status_task{
            xQueueReceive()        
        }
    }


    namespace Application{
        class status_task_service{
        comm::communication* comm
        send_status_report()
        }
    }

    namespace Hal {
        class mcu{
            <<interface>>
        get_temperature()
        get_voltage()
        get_cpu_usage()
        get_heap_usage()
        }
    }
    
    communication --* status_task_service
    status_task_service <-- status_task

    namespace Task {
        class imu_task{
            xQueueReceive()    
        }
    }

    namespace Application{
        class imu_task_service{
        hal::imu* imu
        get_data()
        }
    }

    namespace Hal {
        class imu{
            <<interface>>
        read_imu()
        }
    }


    imu --* imu_task_service
    imu_task_service <-- imu_task


    namespace Task {
        class mcu_task{
            xQueueReceive()      
        }
    }

    namespace Application{
        class mcu_task_service{
        hal::mcu* mcu
        get_params()
        }
    }

    namespace comm {
        class communication{
            <<interface>>
        init()
        send()
        receive()
        }
    }

    mcu_task_service <-- mcu_task
    mcu --* mcu_task_service
Loading

SKR

classDiagram
    namespace c {
        class status_task {
            +serve_status()
        }
        class check_task {
            +serve_check()
        }
        class reboot_task {
            +serve_reboot()
        }
    }

    namespace services {
        class skr_status_service {
            -comm::i_comm* comm
            -hal::i_hardware* hardware
            +serve_status()
            %% HAL의 read() 결과를 가공하는 서비스 내부 메서드
            -get_mcu_voltage()
            -get_cpu_temp()
            -get_cpu_usage()
            -get_ram_usage()
            -get_heap_usage()
        }

        class skr_check_service {
            -comm::i_comm* comm
            -hal::i_hardware* hardware
            +serve_check()
            %% HAL에서 받은 Raw 데이터를 직접 계산
            -get_ir_data()
            -calculate_dist()
        }

        class skr_reboot_service {
            -comm::i_comm* comm
            -hal::i_hardware* hardware
            +serve_reboot()
            %% HAL의 write()를 이용한 리셋 제어
            -system_reset()
        }
    }

    namespace comm {
        class i_comm {
            <<interface>>
            +send()
            +receive()
        }
    }

    namespace hal {
        class i_hardware {
            <<interface>>
            %% 하드웨어는 오직 읽고 쓰기만 수행
            +read()
            +write()
        }
    }

    %% 관계 설정 (합성)
    i_comm --* skr_status_service
    i_hardware --* skr_status_service
    
    i_comm --* skr_check_service
    i_hardware --* skr_check_service

    i_comm --* skr_reboot_service
    i_hardware --* skr_reboot_service
    
    %% 관계 설정 (의존)
    skr_status_service <-- status_task
    skr_check_service <-- check_task
    skr_reboot_service <-- reboot_task
Loading

COMM

classDiagram
    namespace c {
        class all_othe_task{
            run()
            stop()   
            init()     
        }

        class comm_core_task{
            run()
            stop()
            init()        
        }

    }

    class all_other_service{
      comm::communication* comm
      hal::hardware* hardware
      serve()
    }

    namespace comm {
        class communication{
            <<interface>>
            setup()
            send()
            receive()
        }
    }

    namespace hal {
        class all_other_hardware{
            <<interface>>
            read()
            write()
        }
        class comm_hardware{
            <<interface>>
                read()
            write()
        }
    }
    
    communication --* all_other_service
    all_other_hardware --* all_other_service
    all_other_service <-- all_othe_task

    class comm_core_service{
      hal::hardware* hardware
      serve()
    }
    comm_hardware --* comm_core_service
    comm_core_service <-- comm_core_task
Loading

Clone this wiki locally