Skip to content

Class Diagram

sangyeop edited this page Apr 6, 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 send_status_task{
            get_enum()
            run()
            step()
        }
        class check_function_task{
            get_enum()
            run()
            step()
        }
    }

    class service{
      comm::communication* comm
      hal::hardware* hardware
      check_act_info()
      send_act_info()
      

            
    }

      class service2{
      comm::communication* comm
      hal::hardware* hardware
      
      check_act_info()
      send_theta()
      reboot()
      
    }

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

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

GCU

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

    class service{
      comm::communication* ui_comm
      comm::communication* subsystem_comm
      hal::hardware* hardware
      reboot_gcu()
      reboot_subsystem()
      function_check()
      send_status()
    }

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

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

IMU

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



    class get_status_task_service{
      hal::zynQ* zynQ
      serve()
    }
    namespace hal {
        class zynQ{
            <<interface>>
        read()
        write()
        reset()
        }
    }
    zynQ *-- get_status_task_service
    get_status_task_service <-- get_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
      hal::imu* imu
      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

GCU

IMU

SKR

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 feature_inspect_result{
        uint16_t message_id
        uint32_t count
    }

    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 feature_inspect_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

IMU

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

SKR

classDiagram
    SKR_info          
    SRK_info : uint16_t message_id
    SRK_info : skr_status status
    SRK_info : common-parameter com_param    
    
    SRK_dist
    SRK_dist : uint16_t message_id
    SRK_dist : int16_t srk_dist
Loading

UI

classDiagram
    class feature_inspect_command {
        uint16_t message_id
        uint32_t loop_count
    }
Loading

Clone this wiki locally