Skip to content

Class Diagram

Bugeon Kim edited this page Apr 7, 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 get_status_task{
            run()
            step()        
        }
        class get_servo_task{
            run()
            step()        
        }
        class send_servo_task{
            run()
            step()
        }
    }

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

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

    class send_servo_task_service{
        comm::communication* comm
        hall::servo* servo    
        serve()
    }
    
    get_status_task_service <-- get_status_task
    get_servo_task_service <-- get_servo_task
    send_servo_task_service <-- send_servo_task

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

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

    namespace comm {
        class communication{
            <<interface>>
        init()
        send()
        receive()
        }
    }
    communication --* send_servo_task_service
    zynQ --* get_status_task_service
    
    servo --* get_servo_task_service
    servo --* send_servo_task_service    

Loading

GCU

classDiagram
    namespace c {
        class status_task{
            부체계 괜찮은지 확인
            run()
            step()        
        }
        class command_task{
            명령 처리
            run()
            step()        
        }
        class telemetry_task{
            ui에 보고
            run()
            step()        
        }
    }

    class status_service{
      comm::communication* subsystem_comm
      serve()
      function_check()
    }

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

    class telemetry_service{
      comm::communication* ui_comm
      serve()
      send_status()
    }

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

    communication --* status_service
    communication --* command_service
    communication --* telemetry_service
    status_service <-- status_task
    command_service <-- command_task
    telemetry_service <-- telemetry_task
Loading

INS

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

    class status_task_service{
      comm::communication* comm
      hal::zynQ* zynQ
      serve()
    }



    namespace hal {
        class zynQ{
            <<interface>>
        read()
        write()
        }
    }
    
    communication --* status_task_service
    zynQ --* status_task_service
    status_task_service <-- status_task





    namespace c {
        class get_imu_task{
            run()
            step()        
        }
    }

    class get_imu_task_service{
      hal::imu* imu
      serve()
    }



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


    imu --* get_imu_task_service
    get_imu_task_service <-- get_imu_task

    




    namespace c {
        class send_imu_task{
            run()
            step()        
        }
    }

    class send_imu_task_service{
      comm::communication* comm
      serve()
    }

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

    communication --* send_imu_task_service
    send_imu_task_service <-- send_imu_task
    

   
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

FSM(상태모델)

ACT

classDiagram
    class act_status{
        INIT:초기화
        READY:대기
        CHECK:점검
        CONTROL:제어
        ERROR:오류
    }
Loading

GCU

classDiagram
    class gcu_status{
        INIT:초기화
        READY:대기
        CHECK:점검
        LAUNCH:발사
        INERTIAL_GUIDANCE:관성유도
        TERMINAL_GUIDANCE:종말유도
        AIRBURST:비상폭발
    }

Loading

INS

classDiagram

    class ins_status{
      INIT:초기화
      READY:대기
      CHECK:점검
      MEASUREMENT:측정
      ERROR:오류
    }
Loading

SKR

classDiagram
    class skr_status {
    
        INIT          : 초기화
        STANDBY       : 대기
        CHECK         : 점검
        SEARCH_READY  : 탐색대기
        SEARCH        : 탐색
        TRACK         : 추적
        FAULT         : 고장
    }
Loading

ICD(전송 데이터 형식)

common

classDiagram
    class common_parameter{
      uint16_t message_id
      uint8_t mcu_voltage
      uint8_t cpu_temperature
      uint8_t cpu_usage
      uint8_t ram_usage
      uint8_t heap_usage
    }

    class feature_inspect_finish_res {
        uint16_t message_id
    }

    class feature_inspect_finish_command{
        uint16_t message_id
    }
    class reboot_command {
        uint16_t message_id
        subsystem target
    }
Loading

ACT

classDiagram
   class act_info{
    uint16_t message_id
    uint8_t act_status
    int32_t a_motor_theta
    int32_t a_motor_omega
    int32_t b_motor_theta
    int32_t b_motor_omega
    
   }

   class pin_control_res{
    uint16_t message_id
   }

   class pin_control_req{
    uint16_t message_id
    int32_t a_motor_theta
    int32_t b_motor_theta
   }
Loading

GCU

classDiagram
    class full_system_info{
      uint16_t message_id
      gcu_status gcu_status
      common_parameter common_parameter
      act_info act_info
      imu_info imu_info
      skr_info skr_info
    }
    class target_distance_req{
        uint16_t message_id
    }
    class position_req{
        uint16_t message_id
    }
    class one_test_result{
        uint16_t message_id
   	target_distance_req target_distance_req
	position_res position_res
	pin_control_req pin_control_req
	uint32_t algorithm_time
	uint32_t act_comm_time
	uint32_t imu_comm_time
	uint32_t skr_comm_time
    }
Loading

INS

classDiagram
    class ins_data {
        int16_t message_id
        int32_t latitude
        int32_t longitude
        int32_t altitude
        int16_t yaw
        int16_t pitch
        int16_t roll
    }
    class ins_info {
        uint16_t message_id  
        ins_status status    
        ins_data data        
    }
    class position_req {
        uint16_t message_id 
    }
    class position_res {
        uint16_t message_id 
        imu_data data        
    }
Loading

SKR

classDiagram
    skr_info          
    skr_info : uint16_t message_id
    skr_info : skr_status status
    skr_info : common-parameter com_param    
    
    skr_dist
    skr_dist : uint16_t message_id
    skr_dist : int16_t skr_dist
Loading

UI

classDiagram
    class feature_inspect_command {
        uint16_t message_id
        uint32_t loop_count
    }
Loading

Clone this wiki locally