From b817620b256f70fd20f1a5469750a472819f44ee Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 26 Aug 2023 16:18:09 +0200 Subject: [PATCH 01/34] Command analyze function --- .../real/cdh/on_board_computer_with_c2a.cpp | 17 +++++++++++++++-- .../real/cdh/on_board_computer_with_c2a.hpp | 6 ++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 4085f290e..e1976910a 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -18,6 +18,8 @@ #include "src_core/System/TaskManager/task_dispatcher.h" #include "src_core/System/TimeManager/time_manager.h" #include "src_core/System/WatchdogTimer/watchdog_timer.h" +#include "src_core/TlmCmd/common_cmd_packet_util.h" +#include "src_core/Library/endian.h" #else #error "c2a-core version is not supported" #endif // c2a-core version header @@ -65,9 +67,9 @@ void ObcWithC2a::MainRoutine(const int time_count) { is_initialized = true; Initialize(); } + AnalyzeCommand(); for (int i = 0; i < timing_regulator_; i++) { - TMGR_count_up_master_clock(); // The update time oc C2A clock should be - // 1msec + TMGR_count_up_master_clock(); // The update time oc C2A clock should be 1msec TDSP_execute_pl_as_task_list(); } #else @@ -76,6 +78,17 @@ void ObcWithC2a::MainRoutine(const int time_count) { #endif } +void ObcWithC2a::AnalyzeCommand(){ + // Command test + CMD_CODE cmd_id = Cmd_CODE_APP_AOCS_MANAGER_SET_MASS; + float mass = 21.5; + uint8_t param[4]; + uint16_t len = 4; + ENDIAN_memcpy(param, &mass, (size_t)len); + CCP_register_rtc(cmd_id, param, len); +} + + // Override functions int ObcWithC2a::ConnectComPort(int port_id, int tx_buffer_size, int rx_buffer_size) { if (com_ports_c2a_[port_id] != nullptr) { diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index 492e0794c..437223b36 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -265,6 +265,12 @@ class ObcWithC2a : public OnBoardComputer { */ void Initialize() override; + /** + * @fn AnalyzeCommand + * @brief Analyze Command + */ + void AnalyzeCommand(); + static std::map com_ports_c2a_; //!< UART ports static std::map i2c_com_ports_c2a_; //!< I2C ports static std::map gpio_ports_c2a_; //!< GPIO ports From 2c6cbbd49f2d91bf319e47614e5fa28ee5fc3070 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 26 Aug 2023 16:25:00 +0200 Subject: [PATCH 02/34] Rename function --- src/components/real/cdh/on_board_computer_with_c2a.cpp | 4 ++-- src/components/real/cdh/on_board_computer_with_c2a.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index e1976910a..c331164c2 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -67,18 +67,18 @@ void ObcWithC2a::MainRoutine(const int time_count) { is_initialized = true; Initialize(); } - AnalyzeCommand(); for (int i = 0; i < timing_regulator_; i++) { TMGR_count_up_master_clock(); // The update time oc C2A clock should be 1msec TDSP_execute_pl_as_task_list(); } + RegisterCommand(); #else UNUSED(is_initialized); UNUSED(timing_regulator_); #endif } -void ObcWithC2a::AnalyzeCommand(){ +void ObcWithC2a::RegisterCommand(){ // Command test CMD_CODE cmd_id = Cmd_CODE_APP_AOCS_MANAGER_SET_MASS; float mass = 21.5; diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index 437223b36..df32bb993 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -266,10 +266,10 @@ class ObcWithC2a : public OnBoardComputer { void Initialize() override; /** - * @fn AnalyzeCommand - * @brief Analyze Command + * @fn RegisterCommand + * @brief Register Command */ - void AnalyzeCommand(); + void RegisterCommand(); static std::map com_ports_c2a_; //!< UART ports static std::map i2c_com_ports_c2a_; //!< I2C ports From 251cede7687d8bdceee6bfb141aa7b757b44af69 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 26 Aug 2023 20:53:43 +0200 Subject: [PATCH 03/34] Add magic-enum with FetchContents --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcbb6eec9..4a3b173f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,7 @@ set(S2E_DIR ${CMAKE_CURRENT_SOURCE_DIR}) ## include directories include_directories(${CSPICE_DIR}/include) include_directories(${NRLMSISE00_DIR}/src) +include_directories(${CMAKE_BINARY_DIR}/magic_enum-src/include) ## add_subdirectories add_subdirectory(src/simulation) @@ -176,6 +177,14 @@ if(NOT NRLMSISE00_LIB) endif() #target_link_libraries(${PROJECT_NAME} ${NRLMSISE00_LIB}) +## Magic Enum C++ library +include(FetchContent) +FetchContent_Populate( + MAGIC_ENUM + URL https://github.com/Neargye/magic_enum/archive/refs/tags/v0.9.3.tar.gz +) +message("MAGIC_ENUM: ${CMAKE_BINARY_DIR}") + # Initialize link target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY) target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION LIBRARY) From f6d5fbfa8b559c10d3b9404484276e8f807ba960 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 26 Aug 2023 21:45:26 +0200 Subject: [PATCH 04/34] Test magic_enum --- .../real/cdh/on_board_computer_with_c2a.cpp | 20 +++++++++++++++++-- .../real/cdh/on_board_computer_with_c2a.hpp | 6 ++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index c331164c2..6d8e18b1f 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -4,6 +4,8 @@ */ #include "on_board_computer_with_c2a.hpp" +#define MAGIC_ENUM_RANGE_MAX 512 +#include #ifdef USE_C2A #include "src_core/c2a_core_main.h" @@ -20,6 +22,7 @@ #include "src_core/System/WatchdogTimer/watchdog_timer.h" #include "src_core/TlmCmd/common_cmd_packet_util.h" #include "src_core/Library/endian.h" +#include "src_user/TlmCmd/command_definitions.h" #else #error "c2a-core version is not supported" #endif // c2a-core version header @@ -30,6 +33,12 @@ std::map ObcWithC2a::com_ports_c2a_; std::map ObcWithC2a::i2c_com_ports_c2a_; std::map ObcWithC2a::gpio_ports_c2a_; +// debug +typedef enum { + TEST_1 = 0, + TEST_2 = 0xcb +}TEST; + ObcWithC2a::ObcWithC2a(ClockGenerator* clock_generator) : OnBoardComputer(clock_generator), timing_regulator_(1) { // Initialize(); } @@ -80,14 +89,21 @@ void ObcWithC2a::MainRoutine(const int time_count) { void ObcWithC2a::RegisterCommand(){ // Command test - CMD_CODE cmd_id = Cmd_CODE_APP_AOCS_MANAGER_SET_MASS; + std::string cmd_enum_name = "Cmd_CODE_APP_AOCS_MANAGER_SET_MASS"; + auto cmd_code = magic_enum::enum_cast(cmd_enum_name); + //CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); float mass = 21.5; uint8_t param[4]; uint16_t len = 4; ENDIAN_memcpy(param, &mass, (size_t)len); - CCP_register_rtc(cmd_id, param, len); + CCP_register_rtc(cmd_code.value(), param, len); } +void ObcWithC2a::AnalyzeCommandLine() +{ + std::string cmd_line = ".AOBC_RT.Cmd_APP_AOCS_MANAGER_SET_MASS 22.8 # MPU TLM ERROR"; + +} // Override functions int ObcWithC2a::ConnectComPort(int port_id, int tx_buffer_size, int rx_buffer_size) { diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index df32bb993..2c95c5980 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -271,6 +271,12 @@ class ObcWithC2a : public OnBoardComputer { */ void RegisterCommand(); + /** + * @fn AnalyzeCommandLine + * @brief Analyze Command Line + */ + void AnalyzeCommandLine(); + static std::map com_ports_c2a_; //!< UART ports static std::map i2c_com_ports_c2a_; //!< I2C ports static std::map gpio_ports_c2a_; //!< GPIO ports From 1f93dd59a90d60b1003a67187565c1def93e42b6 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 30 Aug 2023 22:12:01 +0200 Subject: [PATCH 05/34] Add C2A command database read feature --- .../real/cdh/on_board_computer_with_c2a.cpp | 89 ++++++++++++++++--- .../real/cdh/on_board_computer_with_c2a.hpp | 5 +- src/library/CMakeLists.txt | 1 + .../initialize/c2a_command_database.cpp | 86 ++++++++++++++++++ .../initialize/c2a_command_database.hpp | 82 +++++++++++++++++ 5 files changed, 247 insertions(+), 16 deletions(-) create mode 100644 src/library/initialize/c2a_command_database.cpp create mode 100644 src/library/initialize/c2a_command_database.hpp diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 6d8e18b1f..fc9cf4465 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -5,10 +5,14 @@ #include "on_board_computer_with_c2a.hpp" #define MAGIC_ENUM_RANGE_MAX 512 +#include #include +#include +#include #ifdef USE_C2A #include "src_core/c2a_core_main.h" +#include "library/initialize/c2a_command_database.hpp" #if C2A_CORE_VER_MAJOR == 4 // c2a-core v4 @@ -17,11 +21,12 @@ #include "src_core/system/watchdog_timer/watchdog_timer.h" #elif C2A_CORE_VER_MAJOR <= 3 // c2a-core <= v3 +#include "src_core/Library/endian.h" #include "src_core/System/TaskManager/task_dispatcher.h" #include "src_core/System/TimeManager/time_manager.h" #include "src_core/System/WatchdogTimer/watchdog_timer.h" +#include "src_core/TlmCmd/command_analyze.h" #include "src_core/TlmCmd/common_cmd_packet_util.h" -#include "src_core/Library/endian.h" #include "src_user/TlmCmd/command_definitions.h" #else #error "c2a-core version is not supported" @@ -34,10 +39,7 @@ std::map ObcWithC2a::i2c_com_ports_c2a_; std::map ObcWithC2a::gpio_ports_c2a_; // debug -typedef enum { - TEST_1 = 0, - TEST_2 = 0xcb -}TEST; +typedef enum { TEST_1 = 0, TEST_2 = 0xcb } TEST; ObcWithC2a::ObcWithC2a(ClockGenerator* clock_generator) : OnBoardComputer(clock_generator), timing_regulator_(1) { // Initialize(); @@ -53,7 +55,9 @@ ObcWithC2a::ObcWithC2a(int prescaler, ClockGenerator* clock_generator, int timin // Initialize(); } -ObcWithC2a::~ObcWithC2a() {} +ObcWithC2a::~ObcWithC2a(){ + delete command_database_; +} void ObcWithC2a::Initialize() { #ifdef USE_C2A @@ -65,6 +69,7 @@ void ObcWithC2a::Initialize() { TMGR_clear(); // This called in C2A_core_init, but should be called again // just before executing the C2A main loop. + command_database_ = new C2aCommandDatabase("../../data/initialize_files/components/ISSL6U_AOBC_CMD_DB_CMD_DB.csv"); #endif } @@ -87,22 +92,78 @@ void ObcWithC2a::MainRoutine(const int time_count) { #endif } -void ObcWithC2a::RegisterCommand(){ +void ObcWithC2a::RegisterCommand() { + //AnalyzeCommandLine(".AOBC_RT.Cmd_CODE_APP_AOCS_MANAGER_SET_MASS 22.6 # MPU TLM ERROR"); + // Command test - std::string cmd_enum_name = "Cmd_CODE_APP_AOCS_MANAGER_SET_MASS"; - auto cmd_code = magic_enum::enum_cast(cmd_enum_name); - //CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); + std::string cmd_enum_name = "Cmd_APP_AOCS_MANAGER_SET_MASS"; + // auto cmd_code = magic_enum::enum_cast(cmd_enum_name); + CMD_CODE cmd_code = (CMD_CODE)command_database_->GetCommandInformation(cmd_enum_name).GetCommandId(); + // CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); float mass = 21.5; uint8_t param[4]; uint16_t len = 4; ENDIAN_memcpy(param, &mass, (size_t)len); - CCP_register_rtc(cmd_code.value(), param, len); + CCP_register_rtc(cmd_code, param, len); } -void ObcWithC2a::AnalyzeCommandLine() -{ - std::string cmd_line = ".AOBC_RT.Cmd_APP_AOCS_MANAGER_SET_MASS 22.8 # MPU TLM ERROR"; +void ObcWithC2a::AnalyzeCommandLine(const std::string input_line) { + // comment削除 + std::string cmd_line = input_line; + size_t comment_position = cmd_line.find('#'); + if (comment_position != std::string::npos) { + cmd_line = cmd_line.substr(0, comment_position); + } + + // ポーズポイント削除 + if (!cmd_line.empty() && cmd_line[0] == '.') { + cmd_line = cmd_line.substr(1); + } + + // スペース分割 + std::istringstream tokenStream(cmd_line); + std::string token; + std::vector tokens; + while (tokenStream >> token) { + tokens.push_back(token); + } + // コマンド認識 + if (tokens[0].find("AOBC_RT") == 0) { + // C2Aコマンドとして処理 + std::string cmd_enum_name = tokens[0].substr(8); + auto cmd_code = magic_enum::enum_cast(cmd_enum_name); + CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); + // 引数処理 + std::vector arguments; + for (size_t i = 1; i < tokens.size(); i++) { + arguments.push_back(tokens[i]); + } + // 引数個数確認 + if (arguments.size() != CA_get_cmd_param_num(cmd_id)) { + // エラー処理 + } + // 引数処理 + uint8_t param[CSP_MAX_LEN]; + uint16_t param_len = 0; + for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { + uint8_t len = CA_get_cmd_param_size(cmd_id, arg_num); + ENDIAN_memcpy(param + param_len, &arguments[arg_num], (size_t)len); + param_len += len; + } + // コマンド送信 + CCP_register_rtc(cmd_id, param, param_len); + + } else if (tokens[0].find("wait") == 0) { + // wait として処理 + } else { + // 処理しない + } + + // debug出力 + for (const std::string& t : tokens) { + std::cout << t << std::endl; + } } // Override functions diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index 2c95c5980..88855eaf0 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -7,7 +7,7 @@ #define S2E_COMPONENTS_REAL_CDH_OBC_C2A_HPP_ #include - +#include #include "on_board_computer.hpp" /* @@ -252,6 +252,7 @@ class ObcWithC2a : public OnBoardComputer { private: bool is_initialized = false; //!< Is initialized flag const int timing_regulator_; //!< Timing regulator to update flight software faster than the component update + C2aCommandDatabase* command_database_; // Override functions for Component /** @@ -275,7 +276,7 @@ class ObcWithC2a : public OnBoardComputer { * @fn AnalyzeCommandLine * @brief Analyze Command Line */ - void AnalyzeCommandLine(); + void AnalyzeCommandLine(const std::string input_line); static std::map com_ports_c2a_; //!< UART ports static std::map i2c_com_ports_c2a_; //!< I2C ports diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index e3298444b..e0a274495 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(${PROJECT_NAME} STATIC geodesy/geodetic_position.cpp initialize/initialize_file_access.cpp + initialize/c2a_command_database.cpp logger/logger.cpp logger/initialize_log.cpp diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp new file mode 100644 index 000000000..fcfc30fac --- /dev/null +++ b/src/library/initialize/c2a_command_database.cpp @@ -0,0 +1,86 @@ +/** + * @file c2a_command_database.cpp + * @brief + */ + +#include "c2a_command_database.hpp" + +#include +#include +#include + +C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { + if (cmd_db_line.find("*") == 0) return; + + // CSV + std::string token; + std::vector tokens; + std::istringstream token_stream(cmd_db_line); + while (std::getline(token_stream, token, ',')) { + tokens.push_back(token); + } + + // Command name + if (tokens[1].find("Cmd_") != 0) return; + command_name_ = tokens[1]; + + // Command ID + command_id_ = std::stoul(tokens[3], nullptr, 0); + + // Arguments + number_of_arguments_ = std::stoul(tokens[4], nullptr, 0); + for (size_t arg_id = 0; arg_id < number_of_arguments_; arg_id++) { + std::string argment_type_name = tokens[5 + 2 * arg_id]; + argument_type_info_.push_back(ConvertArgumentType(argment_type_name)); + } +} + +C2aArgumentType C2aCommandInformation::GetArgumentType(const size_t argument_id) { + if (argument_id >= argument_type_info_.size()) { + return C2aArgumentType::kError; + } else { + return argument_type_info_[argument_id]; + } +} + +C2aArgumentType C2aCommandInformation::ConvertArgumentType(const std::string type) { + if (type == "uint8_t") { + return C2aArgumentType::kUint8t; + } else if (type == "uint16_t") { + return C2aArgumentType::kUint16t; + } else if (type == "uint32_t") { + return C2aArgumentType::kUint32t; + } else if (type == "uint64_t") { + return C2aArgumentType::kUint64t; + } else if (type == "int8_t") { + return C2aArgumentType::kInt8t; + } else if (type == "int16_t") { + return C2aArgumentType::kInt16t; + } else if (type == "int32_t") { + return C2aArgumentType::kInt32t; + } else if (type == "int64_t") { + return C2aArgumentType::kInt64t; + } else if (type == "float") { + return C2aArgumentType::kFloat; + } else if (type == "double") { + return C2aArgumentType::kDouble; + } else if (type == "raw") { + return C2aArgumentType::kRaw; + } else { + return C2aArgumentType::kError; + } +} + +C2aCommandDatabase::C2aCommandDatabase(const std::string file_path) { + std::ifstream file(file_path); + if (!file.is_open()) { + std::cerr << "C2A Command DB open error." << std::endl; + } + std::string line; + while (std::getline(file, line)) { + // コマンド追加 + C2aCommandInformation command(line); + if (command.GetCommandName() == "Error") continue; + command_map_[command.GetCommandName()] = command; + } +} diff --git a/src/library/initialize/c2a_command_database.hpp b/src/library/initialize/c2a_command_database.hpp new file mode 100644 index 000000000..5c238fd95 --- /dev/null +++ b/src/library/initialize/c2a_command_database.hpp @@ -0,0 +1,82 @@ +/** + * @file c2a_command_database.hpp + * @brief + */ + +#ifndef S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ +#define S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ + +#include +#include +#include + +enum class C2aArgumentType{ + kUint8t, + kUint16t, + kUint32t, + kUint64t, + kInt8t, + kInt16t, + kInt32t, + kInt64t, + kFloat, + kDouble, + kRaw, + kError +}; + +/** + * @class C2aCommandDatabase + * @brief + */ +class C2aCommandInformation { + public: + C2aCommandInformation(){} + C2aCommandInformation(const std::string cmd_db_line); + + // Getter + inline std::string GetCommandName() const {return command_name_;} + inline size_t GetCommandId() const {return command_id_;} + inline size_t GetNumberOfArgument() const { return argument_type_info_.size(); } + C2aArgumentType GetArgumentType(const size_t argument_id); + + private: + std::string command_name_ = "Error"; + size_t command_id_ = 0; + size_t number_of_arguments_ = 0; + std::vector argument_type_info_; + + C2aArgumentType ConvertArgumentType(const std::string type); +}; + +/** + * @class C2aCommandDatabase + * @brief + */ +class C2aCommandDatabase { + public: + /** + * @fn C2aCommandDatabase + * @brief Constructor + * @param[in] file_path: File path of the database file + */ + C2aCommandDatabase(const std::string file_path); + + // Getter + inline C2aCommandInformation GetCommandInformation(const std::string command_name) const { + auto itr = command_map_.find(command_name); + if (itr != command_map_.end()) + { + return itr->second; + } + else + { + return C2aCommandInformation(); + } + } + + private: + std::map command_map_; +}; + +#endif // S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ From a22f4fea666757d9760c8d6a8e7cc7adb491ad51 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 30 Aug 2023 23:15:14 +0200 Subject: [PATCH 06/34] Add argument decode function --- .../real/cdh/on_board_computer_with_c2a.cpp | 34 +++++---- .../initialize/c2a_command_database.cpp | 73 +++++++++++++++++++ .../initialize/c2a_command_database.hpp | 37 ++++------ 3 files changed, 106 insertions(+), 38 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index fc9cf4465..735003dd1 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -11,8 +11,8 @@ #include #ifdef USE_C2A -#include "src_core/c2a_core_main.h" #include "library/initialize/c2a_command_database.hpp" +#include "src_core/c2a_core_main.h" #if C2A_CORE_VER_MAJOR == 4 // c2a-core v4 @@ -55,9 +55,7 @@ ObcWithC2a::ObcWithC2a(int prescaler, ClockGenerator* clock_generator, int timin // Initialize(); } -ObcWithC2a::~ObcWithC2a(){ - delete command_database_; -} +ObcWithC2a::~ObcWithC2a() { delete command_database_; } void ObcWithC2a::Initialize() { #ifdef USE_C2A @@ -93,11 +91,10 @@ void ObcWithC2a::MainRoutine(const int time_count) { } void ObcWithC2a::RegisterCommand() { - //AnalyzeCommandLine(".AOBC_RT.Cmd_CODE_APP_AOCS_MANAGER_SET_MASS 22.6 # MPU TLM ERROR"); + AnalyzeCommandLine(".AOBC_RT.Cmd_CODE_APP_AOCS_MANAGER_SET_MASS 22.6 # MPU TLM ERROR"); // Command test std::string cmd_enum_name = "Cmd_APP_AOCS_MANAGER_SET_MASS"; - // auto cmd_code = magic_enum::enum_cast(cmd_enum_name); CMD_CODE cmd_code = (CMD_CODE)command_database_->GetCommandInformation(cmd_enum_name).GetCommandId(); // CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); float mass = 21.5; @@ -129,27 +126,34 @@ void ObcWithC2a::AnalyzeCommandLine(const std::string input_line) { } // コマンド認識 - if (tokens[0].find("AOBC_RT") == 0) { + if (tokens[0].find("AOBC_RT") == 0) { // FIXME AOBC以外も対応する // C2Aコマンドとして処理 + // Command Code 取得 std::string cmd_enum_name = tokens[0].substr(8); - auto cmd_code = magic_enum::enum_cast(cmd_enum_name); - CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); - // 引数処理 + cmd_enum_name = "Cmd" + cmd_enum_name.substr(8); + C2aCommandInformation cmd_info = command_database_->GetCommandInformation(cmd_enum_name); + if (cmd_info.GetCommandName() == "Error") { + // TODO エラー処理 + } + CMD_CODE cmd_id = (CMD_CODE)cmd_info.GetCommandId(); + + // 引数取得 std::vector arguments; for (size_t i = 1; i < tokens.size(); i++) { arguments.push_back(tokens[i]); } // 引数個数確認 - if (arguments.size() != CA_get_cmd_param_num(cmd_id)) { - // エラー処理 + if (arguments.size() != cmd_info.GetNumberOfArgument()) { + // TODO エラー処理 } + // 引数処理 uint8_t param[CSP_MAX_LEN]; uint16_t param_len = 0; for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { - uint8_t len = CA_get_cmd_param_size(cmd_id, arg_num); - ENDIAN_memcpy(param + param_len, &arguments[arg_num], (size_t)len); - param_len += len; + size_t len = 0; + DecodeArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); + param_len += (uint16_t)len; } // コマンド送信 CCP_register_rtc(cmd_id, param, param_len); diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index fcfc30fac..c928f907b 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -9,6 +9,8 @@ #include #include +#include "src_core/Library/endian.h" + C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { if (cmd_db_line.find("*") == 0) return; @@ -84,3 +86,74 @@ C2aCommandDatabase::C2aCommandDatabase(const std::string file_path) { command_map_[command.GetCommandName()] = command; } } + +void DecodeArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param) { + switch (type) { + case C2aArgumentType::kUint8t: { + size_param = 1; + uint8_t argument = (uint8_t)std::stoul(argument_string); // TODO: 範囲外処理 + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kUint16t: { + size_param = 2; + uint16_t argument = (uint16_t)std::stoul(argument_string); // TODO: 範囲外処理 + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kUint32t: { + size_param = 4; + uint32_t argument = (uint32_t)std::stoul(argument_string); // TODO: 範囲外処理 + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kUint64t: { + size_param = 8; + uint64_t argument = std::stoul(argument_string); + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kInt8t: { + size_param = 1; + int8_t argument = (int8_t)std::stoi(argument_string); // TODO: 範囲外処理 + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kInt16t: { + size_param = 2; + int16_t argument = (int16_t)std::stoi(argument_string); // TODO: 範囲外処理 + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kInt32t: { + size_param = 4; + int32_t argument = std::stoi(argument_string); + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kInt64t: { + size_param = 8; + int64_t argument = std::stol(argument_string); + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kFloat: { + size_param = 4; + float argument = std::stof(argument_string); + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kDouble: { + size_param = 8; + double argument = std::stod(argument_string); + ENDIAN_memcpy(param, &argument, size_param); + break; + } + case C2aArgumentType::kRaw: { + // TODO: Rawの実装 + break; + } + default: + break; + } +} diff --git a/src/library/initialize/c2a_command_database.hpp b/src/library/initialize/c2a_command_database.hpp index 5c238fd95..eb916c6c1 100644 --- a/src/library/initialize/c2a_command_database.hpp +++ b/src/library/initialize/c2a_command_database.hpp @@ -6,24 +6,11 @@ #ifndef S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ #define S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ +#include #include #include -#include -enum class C2aArgumentType{ - kUint8t, - kUint16t, - kUint32t, - kUint64t, - kInt8t, - kInt16t, - kInt32t, - kInt64t, - kFloat, - kDouble, - kRaw, - kError -}; +enum class C2aArgumentType { kUint8t, kUint16t, kUint32t, kUint64t, kInt8t, kInt16t, kInt32t, kInt64t, kFloat, kDouble, kRaw, kError }; /** * @class C2aCommandDatabase @@ -31,12 +18,12 @@ enum class C2aArgumentType{ */ class C2aCommandInformation { public: - C2aCommandInformation(){} + C2aCommandInformation() {} C2aCommandInformation(const std::string cmd_db_line); // Getter - inline std::string GetCommandName() const {return command_name_;} - inline size_t GetCommandId() const {return command_id_;} + inline std::string GetCommandName() const { return command_name_; } + inline size_t GetCommandId() const { return command_id_; } inline size_t GetNumberOfArgument() const { return argument_type_info_.size(); } C2aArgumentType GetArgumentType(const size_t argument_id); @@ -63,14 +50,16 @@ class C2aCommandDatabase { C2aCommandDatabase(const std::string file_path); // Getter + /** + * @fn GetCommandInformation + * @brief Return C2A command information + * @param[in] command_name: Command Name + */ inline C2aCommandInformation GetCommandInformation(const std::string command_name) const { auto itr = command_map_.find(command_name); - if (itr != command_map_.end()) - { + if (itr != command_map_.end()) { return itr->second; - } - else - { + } else { return C2aCommandInformation(); } } @@ -79,4 +68,6 @@ class C2aCommandDatabase { std::map command_map_; }; +void DecodeArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param); + #endif // S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ From 9c65c07c292ec659d77ff8115f8a8f4b882fb164 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:18:58 +0200 Subject: [PATCH 07/34] Add doxygen comment --- .../real/cdh/on_board_computer_with_c2a.cpp | 2 +- .../initialize/c2a_command_database.cpp | 2 +- .../initialize/c2a_command_database.hpp | 63 ++++++++++++++++--- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 735003dd1..dc1fbbbad 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -152,7 +152,7 @@ void ObcWithC2a::AnalyzeCommandLine(const std::string input_line) { uint16_t param_len = 0; for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { size_t len = 0; - DecodeArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); + DecodeC2aCommandArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); param_len += (uint16_t)len; } // コマンド送信 diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index c928f907b..c44a4c3d2 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -87,7 +87,7 @@ C2aCommandDatabase::C2aCommandDatabase(const std::string file_path) { } } -void DecodeArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param) { +void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param) { switch (type) { case C2aArgumentType::kUint8t: { size_param = 1; diff --git a/src/library/initialize/c2a_command_database.hpp b/src/library/initialize/c2a_command_database.hpp index eb916c6c1..625e20354 100644 --- a/src/library/initialize/c2a_command_database.hpp +++ b/src/library/initialize/c2a_command_database.hpp @@ -1,6 +1,6 @@ /** * @file c2a_command_database.hpp - * @brief + * @brief Classes and functions related with C2A command database */ #ifndef S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ @@ -10,35 +10,70 @@ #include #include +/** + * @enum C2aArgumentType + * @brief Argument type used in C2A command + */ enum class C2aArgumentType { kUint8t, kUint16t, kUint32t, kUint64t, kInt8t, kInt16t, kInt32t, kInt64t, kFloat, kDouble, kRaw, kError }; /** - * @class C2aCommandDatabase - * @brief + * @class C2aCommandInformation + * @brief Information of C2A command */ class C2aCommandInformation { public: + /** + * @fn C2aCommandInformation + * @brief Constructor + */ C2aCommandInformation() {} + + /** + * @fn C2aCommandInformation + * @brief Constructor + * @param[in] cmd_db_line: A line in command database + */ C2aCommandInformation(const std::string cmd_db_line); // Getter + /** + * @fn GetCommandName + * @brief Return command name + */ inline std::string GetCommandName() const { return command_name_; } + /** + * @fn GetCommandId + * @brief Return command ID + */ inline size_t GetCommandId() const { return command_id_; } + /** + * @fn GetNumberOfArgument + * @brief Return number of argument + */ inline size_t GetNumberOfArgument() const { return argument_type_info_.size(); } + /** + * @fn GetArgumentType + * @brief Return argument type + */ C2aArgumentType GetArgumentType(const size_t argument_id); private: - std::string command_name_ = "Error"; - size_t command_id_ = 0; - size_t number_of_arguments_ = 0; - std::vector argument_type_info_; + std::string command_name_ = "Error"; //!< Command name + size_t command_id_ = 0; //!< Command ID + size_t number_of_arguments_ = 0; //!< Number of arguments + std::vector argument_type_info_; //!< List of argument type + /** + * @fn ConvertArgumentType + * @brief Convert type expressed by string to enum + * @param[in] type: type information + */ C2aArgumentType ConvertArgumentType(const std::string type); }; /** * @class C2aCommandDatabase - * @brief + * @brief A class to handle C2A command database */ class C2aCommandDatabase { public: @@ -65,9 +100,17 @@ class C2aCommandDatabase { } private: - std::map command_map_; + std::map command_map_; //!< Command database }; -void DecodeArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param); +/** + * @fn DecodeC2aCommandArgument + * @brief Decode argument value expressed by string as C2A command argument + * @param[in] type: Argument type + * @param[in] argument_string: Argument value expressed as string + * @param[out] param: Decoded value + * @param[out] size_param: Size of decoded value [byte] + */ +void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param); #endif // S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ From 69ec0007756d1c1ab8c4968c69355fb689b9cba9 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:33:36 +0200 Subject: [PATCH 08/34] Remove magic enu, --- CMakeLists.txt | 8 -------- src/components/real/cdh/on_board_computer_with_c2a.cpp | 2 -- 2 files changed, 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a3b173f4..b4db103d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,14 +177,6 @@ if(NOT NRLMSISE00_LIB) endif() #target_link_libraries(${PROJECT_NAME} ${NRLMSISE00_LIB}) -## Magic Enum C++ library -include(FetchContent) -FetchContent_Populate( - MAGIC_ENUM - URL https://github.com/Neargye/magic_enum/archive/refs/tags/v0.9.3.tar.gz -) -message("MAGIC_ENUM: ${CMAKE_BINARY_DIR}") - # Initialize link target_link_libraries(COMPONENT DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT LIBRARY) target_link_libraries(DYNAMICS GLOBAL_ENVIRONMENT LOCAL_ENVIRONMENT SIMULATION LIBRARY) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index dc1fbbbad..8fe874766 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -4,9 +4,7 @@ */ #include "on_board_computer_with_c2a.hpp" -#define MAGIC_ENUM_RANGE_MAX 512 #include -#include #include #include From 3c71763084a1a9100e952f660b87ddaef2dbe837 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:40:38 +0200 Subject: [PATCH 09/34] Remove magic enum --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4db103d5..fcbb6eec9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,6 @@ set(S2E_DIR ${CMAKE_CURRENT_SOURCE_DIR}) ## include directories include_directories(${CSPICE_DIR}/include) include_directories(${NRLMSISE00_DIR}/src) -include_directories(${CMAKE_BINARY_DIR}/magic_enum-src/include) ## add_subdirectories add_subdirectory(src/simulation) From 8c20b6961a59cd75272ffe46caf722f5714ecaac Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:47:22 +0200 Subject: [PATCH 10/34] Fix doxygen comment decription --- src/library/initialize/c2a_command_database.cpp | 11 ++++++++++- src/library/initialize/c2a_command_database.hpp | 2 +- src/library/initialize/c2a_ops_file.hpp | 0 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/library/initialize/c2a_ops_file.hpp diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index c44a4c3d2..6f457be96 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -1,6 +1,6 @@ /** * @file c2a_command_database.cpp - * @brief + * @brief Classes and functions to read and manage C2A command database */ #include "c2a_command_database.hpp" @@ -9,7 +9,16 @@ #include #include +#if C2A_CORE_VER_MAJOR == 4 +// c2a-core v4 +#include "src_core/library/endian.h" +#elif C2A_CORE_VER_MAJOR <= 3 +// c2a-core <= v3 #include "src_core/Library/endian.h" +#else +#error "c2a-core version is not supported" +#endif // c2a-core version header + C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { if (cmd_db_line.find("*") == 0) return; diff --git a/src/library/initialize/c2a_command_database.hpp b/src/library/initialize/c2a_command_database.hpp index 625e20354..1a956c539 100644 --- a/src/library/initialize/c2a_command_database.hpp +++ b/src/library/initialize/c2a_command_database.hpp @@ -1,6 +1,6 @@ /** * @file c2a_command_database.hpp - * @brief Classes and functions related with C2A command database + * @brief Classes and functions to read and manage C2A command database */ #ifndef S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ diff --git a/src/library/initialize/c2a_ops_file.hpp b/src/library/initialize/c2a_ops_file.hpp new file mode 100644 index 000000000..e69de29bb From a39e84b5b56f9fe47ea4d7723381cfd1827db23f Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:52:14 +0200 Subject: [PATCH 11/34] Remove debug codes --- .../real/cdh/on_board_computer_with_c2a.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 8fe874766..2892725e2 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -36,9 +36,6 @@ std::map ObcWithC2a::com_ports_c2a_; std::map ObcWithC2a::i2c_com_ports_c2a_; std::map ObcWithC2a::gpio_ports_c2a_; -// debug -typedef enum { TEST_1 = 0, TEST_2 = 0xcb } TEST; - ObcWithC2a::ObcWithC2a(ClockGenerator* clock_generator) : OnBoardComputer(clock_generator), timing_regulator_(1) { // Initialize(); } @@ -90,16 +87,6 @@ void ObcWithC2a::MainRoutine(const int time_count) { void ObcWithC2a::RegisterCommand() { AnalyzeCommandLine(".AOBC_RT.Cmd_CODE_APP_AOCS_MANAGER_SET_MASS 22.6 # MPU TLM ERROR"); - - // Command test - std::string cmd_enum_name = "Cmd_APP_AOCS_MANAGER_SET_MASS"; - CMD_CODE cmd_code = (CMD_CODE)command_database_->GetCommandInformation(cmd_enum_name).GetCommandId(); - // CMD_CODE cmd_id = (CMD_CODE)cmd_code.value(); - float mass = 21.5; - uint8_t param[4]; - uint16_t len = 4; - ENDIAN_memcpy(param, &mass, (size_t)len); - CCP_register_rtc(cmd_code, param, len); } void ObcWithC2a::AnalyzeCommandLine(const std::string input_line) { From 3d3aed5e2ea873ccf567d16f3a201b9c6c10eb57 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:56:17 +0200 Subject: [PATCH 12/34] Add doxygen comment --- src/library/initialize/c2a_ops_file.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/library/initialize/c2a_ops_file.hpp b/src/library/initialize/c2a_ops_file.hpp index e69de29bb..d9983fae6 100644 --- a/src/library/initialize/c2a_ops_file.hpp +++ b/src/library/initialize/c2a_ops_file.hpp @@ -0,0 +1,5 @@ +/** + * @file wings_operation_file.hpp + * @brief Classes and functions to read and manage WINGS's operation file (.ops) + */ + From d8111ef0ddbf165422b51df625ae6c82407c791b Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:57:38 +0200 Subject: [PATCH 13/34] Rename file name --- .../initialize/{c2a_ops_file.hpp => wings_operation_file.hpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/library/initialize/{c2a_ops_file.hpp => wings_operation_file.hpp} (100%) diff --git a/src/library/initialize/c2a_ops_file.hpp b/src/library/initialize/wings_operation_file.hpp similarity index 100% rename from src/library/initialize/c2a_ops_file.hpp rename to src/library/initialize/wings_operation_file.hpp From 46da5345843213e8ea1ab9a678ab6629ad68e83f Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 15:58:54 +0200 Subject: [PATCH 14/34] Fix typo --- src/library/initialize/c2a_command_database.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/library/initialize/c2a_command_database.hpp b/src/library/initialize/c2a_command_database.hpp index 1a956c539..26da381ac 100644 --- a/src/library/initialize/c2a_command_database.hpp +++ b/src/library/initialize/c2a_command_database.hpp @@ -3,8 +3,8 @@ * @brief Classes and functions to read and manage C2A command database */ -#ifndef S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ -#define S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ +#ifndef S2E_LIBRARY_INITIALIZE_C2A_COMMAND_DATABASE_HPP_ +#define S2E_LIBRARY_INITIALIZE_C2A_COMMAND_DATABASE_HPP_ #include #include @@ -113,4 +113,4 @@ class C2aCommandDatabase { */ void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param); -#endif // S2E_LIBRARY_INITIALIZE_C2_COMMAND_DATABASE_HPP_ +#endif // S2E_LIBRARY_INITIALIZE_C2A_COMMAND_DATABASE_HPP_ From aa62d002ce3f9f47b3109a91d932805aad2592d7 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 16:02:54 +0200 Subject: [PATCH 15/34] Add WingsOperationFile class --- .../initialize/wings_operation_file.cpp | 7 ++++++ .../initialize/wings_operation_file.hpp | 23 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/library/initialize/wings_operation_file.cpp diff --git a/src/library/initialize/wings_operation_file.cpp b/src/library/initialize/wings_operation_file.cpp new file mode 100644 index 000000000..2f0e1e710 --- /dev/null +++ b/src/library/initialize/wings_operation_file.cpp @@ -0,0 +1,7 @@ +/** + * @file wings_operation_file.cpp + * @brief Classes and functions to read and manage WINGS's operation file (.ops) + */ + +#include "wings_operation_file.hpp" + diff --git a/src/library/initialize/wings_operation_file.hpp b/src/library/initialize/wings_operation_file.hpp index d9983fae6..bb686a46e 100644 --- a/src/library/initialize/wings_operation_file.hpp +++ b/src/library/initialize/wings_operation_file.hpp @@ -3,3 +3,26 @@ * @brief Classes and functions to read and manage WINGS's operation file (.ops) */ +#ifndef S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ +#define S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ + +#include + +/** + * @class WingsOperationFile + * @brief A class to handle WINGS operation file + */ +class WingsOperationFile { + public: + /** + * @fn WingsOperationFile + * @brief Constructor + * @param[in] file_path: File path of the operation file + */ + WingsOperationFile(const std::string file_path); + + private: + +}; + +#endif // S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ From 5d7dc40511f5ada81d16c23ef4d38d1df7c498cc Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 22:16:15 +0200 Subject: [PATCH 16/34] Add command execution --- .../real/cdh/on_board_computer_with_c2a.cpp | 82 +----------- .../real/cdh/on_board_computer_with_c2a.hpp | 14 -- src/library/CMakeLists.txt | 1 + .../initialize/wings_operation_file.cpp | 125 ++++++++++++++++++ .../initialize/wings_operation_file.hpp | 20 ++- 5 files changed, 146 insertions(+), 96 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 2892725e2..67b4b44f3 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -4,12 +4,8 @@ */ #include "on_board_computer_with_c2a.hpp" -#include -#include -#include #ifdef USE_C2A -#include "library/initialize/c2a_command_database.hpp" #include "src_core/c2a_core_main.h" #if C2A_CORE_VER_MAJOR == 4 @@ -19,13 +15,9 @@ #include "src_core/system/watchdog_timer/watchdog_timer.h" #elif C2A_CORE_VER_MAJOR <= 3 // c2a-core <= v3 -#include "src_core/Library/endian.h" #include "src_core/System/TaskManager/task_dispatcher.h" #include "src_core/System/TimeManager/time_manager.h" #include "src_core/System/WatchdogTimer/watchdog_timer.h" -#include "src_core/TlmCmd/command_analyze.h" -#include "src_core/TlmCmd/common_cmd_packet_util.h" -#include "src_user/TlmCmd/command_definitions.h" #else #error "c2a-core version is not supported" #endif // c2a-core version header @@ -50,7 +42,7 @@ ObcWithC2a::ObcWithC2a(int prescaler, ClockGenerator* clock_generator, int timin // Initialize(); } -ObcWithC2a::~ObcWithC2a() { delete command_database_; } +ObcWithC2a::~ObcWithC2a() {} void ObcWithC2a::Initialize() { #ifdef USE_C2A @@ -62,7 +54,6 @@ void ObcWithC2a::Initialize() { TMGR_clear(); // This called in C2A_core_init, but should be called again // just before executing the C2A main loop. - command_database_ = new C2aCommandDatabase("../../data/initialize_files/components/ISSL6U_AOBC_CMD_DB_CMD_DB.csv"); #endif } @@ -78,83 +69,12 @@ void ObcWithC2a::MainRoutine(const int time_count) { TMGR_count_up_master_clock(); // The update time oc C2A clock should be 1msec TDSP_execute_pl_as_task_list(); } - RegisterCommand(); #else UNUSED(is_initialized); UNUSED(timing_regulator_); #endif } -void ObcWithC2a::RegisterCommand() { - AnalyzeCommandLine(".AOBC_RT.Cmd_CODE_APP_AOCS_MANAGER_SET_MASS 22.6 # MPU TLM ERROR"); -} - -void ObcWithC2a::AnalyzeCommandLine(const std::string input_line) { - // comment削除 - std::string cmd_line = input_line; - size_t comment_position = cmd_line.find('#'); - if (comment_position != std::string::npos) { - cmd_line = cmd_line.substr(0, comment_position); - } - - // ポーズポイント削除 - if (!cmd_line.empty() && cmd_line[0] == '.') { - cmd_line = cmd_line.substr(1); - } - - // スペース分割 - std::istringstream tokenStream(cmd_line); - std::string token; - std::vector tokens; - while (tokenStream >> token) { - tokens.push_back(token); - } - - // コマンド認識 - if (tokens[0].find("AOBC_RT") == 0) { // FIXME AOBC以外も対応する - // C2Aコマンドとして処理 - // Command Code 取得 - std::string cmd_enum_name = tokens[0].substr(8); - cmd_enum_name = "Cmd" + cmd_enum_name.substr(8); - C2aCommandInformation cmd_info = command_database_->GetCommandInformation(cmd_enum_name); - if (cmd_info.GetCommandName() == "Error") { - // TODO エラー処理 - } - CMD_CODE cmd_id = (CMD_CODE)cmd_info.GetCommandId(); - - // 引数取得 - std::vector arguments; - for (size_t i = 1; i < tokens.size(); i++) { - arguments.push_back(tokens[i]); - } - // 引数個数確認 - if (arguments.size() != cmd_info.GetNumberOfArgument()) { - // TODO エラー処理 - } - - // 引数処理 - uint8_t param[CSP_MAX_LEN]; - uint16_t param_len = 0; - for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { - size_t len = 0; - DecodeC2aCommandArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); - param_len += (uint16_t)len; - } - // コマンド送信 - CCP_register_rtc(cmd_id, param, param_len); - - } else if (tokens[0].find("wait") == 0) { - // wait として処理 - } else { - // 処理しない - } - - // debug出力 - for (const std::string& t : tokens) { - std::cout << t << std::endl; - } -} - // Override functions int ObcWithC2a::ConnectComPort(int port_id, int tx_buffer_size, int rx_buffer_size) { if (com_ports_c2a_[port_id] != nullptr) { diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index 88855eaf0..191dc42da 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -7,7 +7,6 @@ #define S2E_COMPONENTS_REAL_CDH_OBC_C2A_HPP_ #include -#include #include "on_board_computer.hpp" /* @@ -252,7 +251,6 @@ class ObcWithC2a : public OnBoardComputer { private: bool is_initialized = false; //!< Is initialized flag const int timing_regulator_; //!< Timing regulator to update flight software faster than the component update - C2aCommandDatabase* command_database_; // Override functions for Component /** @@ -266,18 +264,6 @@ class ObcWithC2a : public OnBoardComputer { */ void Initialize() override; - /** - * @fn RegisterCommand - * @brief Register Command - */ - void RegisterCommand(); - - /** - * @fn AnalyzeCommandLine - * @brief Analyze Command Line - */ - void AnalyzeCommandLine(const std::string input_line); - static std::map com_ports_c2a_; //!< UART ports static std::map i2c_com_ports_c2a_; //!< I2C ports static std::map gpio_ports_c2a_; //!< GPIO ports diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index e0a274495..b8ac55f89 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -9,6 +9,7 @@ add_library(${PROJECT_NAME} STATIC initialize/initialize_file_access.cpp initialize/c2a_command_database.cpp + initialize/wings_operation_file.cpp logger/logger.cpp logger/initialize_log.cpp diff --git a/src/library/initialize/wings_operation_file.cpp b/src/library/initialize/wings_operation_file.cpp index 2f0e1e710..fa61b7a31 100644 --- a/src/library/initialize/wings_operation_file.cpp +++ b/src/library/initialize/wings_operation_file.cpp @@ -5,3 +5,128 @@ #include "wings_operation_file.hpp" +#include +#include + +#if C2A_CORE_VER_MAJOR == 4 +// c2a-core v4 +#elif C2A_CORE_VER_MAJOR <= 3 +// c2a-core <= v3 +#include "src_core/TlmCmd/common_cmd_packet_util.h" +#else +#error "c2a-core version is not supported" +#endif // c2a-core version header + +WingsOperationFile::WingsOperationFile(const std::string file_path, const C2aCommandDatabase& command_database) + : command_database_(command_database) { + // File open + std::ifstream file(file_path); + if (!file.is_open()) { + std::cerr << "WINGS Operation file open error." << std::endl; + } + + // Read all lines + std::string line; + while (std::getline(file, line)) { + // Remove pose point + if (!line.empty() && line[0] == '.') { + line = line.substr(1); + } + // Remove space + if (!line.empty() && line[0] == ' ') { + line = line.substr(1); + } + // Remove comment + size_t comment_position = line.find('#'); + if (comment_position != std::string::npos) { + line = line.substr(0, comment_position); + } + // add line + if (line.length() > 2) { + lines_.push_back(line); + } + } +} + +size_t WingsOperationFile::ExecuteNextLine() { + std::string input_line = lines_[0]; + + // Separate with space + std::istringstream token_stream(input_line); + std::string token; + std::vector tokens; + while (token_stream >> token) { + tokens.push_back(token); + } + + if (tokens[0].find("wait_sec") == 0) { + // wait process + size_t wait_time_sec = (uint32_t)std::stoi(tokens[0]); + return wait_time_sec; + } + + if (tokens[0].find("check_value") == 0) { + // TODO + return 0; + } + + AnalyzeC2aCommand(tokens); + return 0; +} + +void WingsOperationFile::AnalyzeC2aCommand(const std::vector tokens) { + // Recognize command + size_t first_underscore_position = tokens[0].find('_'); + if (first_underscore_position == std::string::npos) return; + size_t first_dot_position = tokens[0].find('.'); + if (first_underscore_position == std::string::npos) return; + + std::string target_name = tokens[0].substr(0, first_underscore_position); + // TODO check target? + std::string command_type = tokens[0].substr(first_underscore_position + 1, first_dot_position); + std::string command_name = tokens[0].substr(first_dot_position + 1); + + // Get command code + C2aCommandInformation cmd_info = command_database_.GetCommandInformation(command_name); + if (cmd_info.GetCommandName() == "Error") { + // TODO: error handling + } + CMD_CODE cmd_id = (CMD_CODE)cmd_info.GetCommandId(); + + // Get arguments + std::vector arguments; + for (size_t i = 1; i < tokens.size(); i++) { + arguments.push_back(tokens[i]); + } + // Check number of arguments + if (arguments.size() != cmd_info.GetNumberOfArgument()) { + // TODO: error handling + } + + // Decode arguments + // Read TI + uint32_t ti = 0; + if (command_type == "TL" || command_type == "BL") { + ti = (uint32_t)std::stoi(arguments[0]); + arguments.erase(arguments.begin()); + } + // Read arguments + uint8_t param[CSP_MAX_LEN]; + uint16_t param_len = 0; + for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { + size_t len = 0; + DecodeC2aCommandArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); + param_len += (uint16_t)len; + } + + // Send command + if (command_type == "RT") { + CCP_register_rtc(cmd_id, param, param_len); + } else if (command_type == "TL") { + CCP_register_tlc(ti, TLCD_ID_FROM_GS, cmd_id, param, param_len); + } else if (command_type == "BL") { + // TODO: BL実装したいが、register_blがない? + } else { + // Not reach + } +} diff --git a/src/library/initialize/wings_operation_file.hpp b/src/library/initialize/wings_operation_file.hpp index bb686a46e..7b48d0028 100644 --- a/src/library/initialize/wings_operation_file.hpp +++ b/src/library/initialize/wings_operation_file.hpp @@ -7,6 +7,9 @@ #define S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ #include +#include + +#include "c2a_command_database.hpp" /** * @class WingsOperationFile @@ -19,10 +22,25 @@ class WingsOperationFile { * @brief Constructor * @param[in] file_path: File path of the operation file */ - WingsOperationFile(const std::string file_path); + WingsOperationFile(const std::string file_path, const C2aCommandDatabase& command_database); + + /** + * @fn ExecuteNextLine + * @brief Execute next line command + * @return Required wait time for next execution [s] + */ + size_t ExecuteNextLine(); private: + std::vector lines_; //!!< List of read operation command line + const C2aCommandDatabase& command_database_; //!< C2A command database + /** + * @fn AnalyzeC2aCommand + * @brief Analyze C2A command Line + * @param[in] tokens: command line after space separation + */ + void AnalyzeC2aCommand(const std::vector tokens); }; #endif // S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ From 638581e901eb690f4c79ca26d33bb974d3c04b9e Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 22:18:44 +0200 Subject: [PATCH 17/34] Remove unnecessary newline --- src/components/real/cdh/on_board_computer_with_c2a.cpp | 7 ++----- src/components/real/cdh/on_board_computer_with_c2a.hpp | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 67b4b44f3..5cc4c6804 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -46,14 +46,11 @@ ObcWithC2a::~ObcWithC2a() {} void ObcWithC2a::Initialize() { #ifdef USE_C2A - TMGR_init(); // Time Manager - // Initialize at the beginning in order to measure the execution - // time of C2A core initialization. + TMGR_init(); // Time Manager Initialize at the beginning in order to measure the execution time of C2A core initialization. C2A_core_init(); WDT_init(); // Watchdog timer. In SILS, it does not have meaning. - TMGR_clear(); // This called in C2A_core_init, but should be called again - // just before executing the C2A main loop. + TMGR_clear(); // This called in C2A_core_init, but should be called again just before executing the C2A main loop. #endif } diff --git a/src/components/real/cdh/on_board_computer_with_c2a.hpp b/src/components/real/cdh/on_board_computer_with_c2a.hpp index 191dc42da..492e0794c 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.hpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.hpp @@ -7,6 +7,7 @@ #define S2E_COMPONENTS_REAL_CDH_OBC_C2A_HPP_ #include + #include "on_board_computer.hpp" /* From 61ee104266dd091161caf6632da381af1732796b Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 31 Aug 2023 23:09:21 +0200 Subject: [PATCH 18/34] Fix format --- src/library/initialize/c2a_command_database.cpp | 13 +++++++------ src/library/initialize/wings_operation_file.cpp | 4 +++- src/library/initialize/wings_operation_file.hpp | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index 6f457be96..a86b7961a 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -19,7 +19,6 @@ #error "c2a-core version is not supported" #endif // c2a-core version header - C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { if (cmd_db_line.find("*") == 0) return; @@ -97,22 +96,23 @@ C2aCommandDatabase::C2aCommandDatabase(const std::string file_path) { } void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param) { +#ifdef USE_C2A switch (type) { case C2aArgumentType::kUint8t: { size_param = 1; - uint8_t argument = (uint8_t)std::stoul(argument_string); // TODO: 範囲外処理 + uint8_t argument = (uint8_t)std::stoul(argument_string); // TODO: 範囲外処理 ENDIAN_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kUint16t: { size_param = 2; - uint16_t argument = (uint16_t)std::stoul(argument_string); // TODO: 範囲外処理 + uint16_t argument = (uint16_t)std::stoul(argument_string); // TODO: 範囲外処理 ENDIAN_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kUint32t: { size_param = 4; - uint32_t argument = (uint32_t)std::stoul(argument_string); // TODO: 範囲外処理 + uint32_t argument = (uint32_t)std::stoul(argument_string); // TODO: 範囲外処理 ENDIAN_memcpy(param, &argument, size_param); break; } @@ -124,13 +124,13 @@ void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argu } case C2aArgumentType::kInt8t: { size_param = 1; - int8_t argument = (int8_t)std::stoi(argument_string); // TODO: 範囲外処理 + int8_t argument = (int8_t)std::stoi(argument_string); // TODO: 範囲外処理 ENDIAN_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kInt16t: { size_param = 2; - int16_t argument = (int16_t)std::stoi(argument_string); // TODO: 範囲外処理 + int16_t argument = (int16_t)std::stoi(argument_string); // TODO: 範囲外処理 ENDIAN_memcpy(param, &argument, size_param); break; } @@ -165,4 +165,5 @@ void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argu default: break; } +#endif } diff --git a/src/library/initialize/wings_operation_file.cpp b/src/library/initialize/wings_operation_file.cpp index fa61b7a31..f1f3612fd 100644 --- a/src/library/initialize/wings_operation_file.cpp +++ b/src/library/initialize/wings_operation_file.cpp @@ -119,7 +119,8 @@ void WingsOperationFile::AnalyzeC2aCommand(const std::vector tokens param_len += (uint16_t)len; } - // Send command +// Send command +#ifdef USE_C2A if (command_type == "RT") { CCP_register_rtc(cmd_id, param, param_len); } else if (command_type == "TL") { @@ -129,4 +130,5 @@ void WingsOperationFile::AnalyzeC2aCommand(const std::vector tokens } else { // Not reach } +#endif } diff --git a/src/library/initialize/wings_operation_file.hpp b/src/library/initialize/wings_operation_file.hpp index 7b48d0028..9549170da 100644 --- a/src/library/initialize/wings_operation_file.hpp +++ b/src/library/initialize/wings_operation_file.hpp @@ -6,8 +6,8 @@ #ifndef S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ #define S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ -#include #include +#include #include "c2a_command_database.hpp" @@ -32,8 +32,8 @@ class WingsOperationFile { size_t ExecuteNextLine(); private: - std::vector lines_; //!!< List of read operation command line - const C2aCommandDatabase& command_database_; //!< C2A command database + std::vector lines_; //!!< List of read operation command line + const C2aCommandDatabase& command_database_; //!< C2A command database /** * @fn AnalyzeC2aCommand From 97cf5310fcad507cea24dacc5d2ebc6c4e192643 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 13:24:05 +0200 Subject: [PATCH 19/34] Add component for command sender --- src/components/CMakeLists.txt | 1 + .../wings_command_sender_to_c2a.cpp | 34 ++++++++++++ .../wings_command_sender_to_c2a.hpp | 54 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/components/real/communication/wings_command_sender_to_c2a.cpp create mode 100644 src/components/real/communication/wings_command_sender_to_c2a.hpp diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt index b8963906a..91e3d96ce 100644 --- a/src/components/CMakeLists.txt +++ b/src/components/CMakeLists.txt @@ -33,6 +33,7 @@ real/communication/antenna_radiation_pattern.cpp real/communication/initialize_antenna.cpp real/communication/ground_station_calculator.cpp real/communication/initialize_ground_station_calculator.cpp +real/communication/wings_command_sender_to_c2a.cpp examples/example_change_structure.cpp examples/example_serial_communication_with_obc.cpp diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp new file mode 100644 index 000000000..deda53281 --- /dev/null +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -0,0 +1,34 @@ +/* + * @file wings_command_sender_to_c2a.cpp + * @brief A component to send command using WINGS operation file + */ + +#include "wings_command_sender_to_c2a.hpp" + +#include + +void WingsCommandSenderToC2a::MainRoutine(const int time_count) { + UNUSED(time_count); + if (wait_s_ <= 0.0) + { + wait_s_ = (double)wings_operation_file_.ExecuteNextLine(); + } + else{ + wait_s_ -= step_width_s_; + } + } + +WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const double compo_update_step, const std::string initialize_file){ + IniAccess ini_access(initialize_file); + std::string section = "WINGS_COMMAND_SENDER_TO_C2A_"; + + int prescaler = ini_access.ReadInt(section.c_str(), "prescaler"); + if (prescaler <= 1) prescaler = 1; + + double step_width_s = (double)prescaler * compo_update_step; + + std::string c2a_command_data_base_file = ini_access.ReadString(section.c_str(), "c2a_command_database_file"); + std::string wings_operation_file = ini_access.ReadString(section.c_str(), "wings_operation_file"); + + return WingsCommandSenderToC2a(prescaler, clock_generator, step_width_s, c2a_command_data_base_file, wings_operation_file); +} diff --git a/src/components/real/communication/wings_command_sender_to_c2a.hpp b/src/components/real/communication/wings_command_sender_to_c2a.hpp new file mode 100644 index 000000000..1b75fbec7 --- /dev/null +++ b/src/components/real/communication/wings_command_sender_to_c2a.hpp @@ -0,0 +1,54 @@ +/* + * @file wings_command_sender_to_c2a.hpp + * @brief A component to send command using WINGS operation file + */ + +#ifndef S2E_COMPONENTS_REAL_COMMUNICATION_C2A_COMMAND_SENDER_HPP_ +#define S2E_COMPONENTS_REAL_COMMUNICATION_C2A_COMMAND_SENDER_HPP_ + +#include +#include + +#include "../../base/component.hpp" + +/* + * @class C2aCommandSender + * @brief A component to send command using WINGS operation file + */ +class WingsCommandSenderToC2a : public Component { + public: + /** + * @fn WingsCommandSenderToC2a + * @brief Constructor + * @param [in] + */ + WingsCommandSenderToC2a(int prescaler, ClockGenerator* clock_generator, const double step_width_s, const std::string command_database_file, + const std::string operation_file) + : Component(prescaler, clock_generator), + c2a_command_database_(command_database_file), + wings_operation_file_(operation_file, c2a_command_database_), + step_width_s_(step_width_s) {} + + /** + * @fn ~WingsCommandSenderToC2a + * @brief Destructor + */ + ~WingsCommandSenderToC2a() {} + + protected: + C2aCommandDatabase c2a_command_database_; //!< Command database + WingsOperationFile wings_operation_file_; //!< WINGS operation file + const double step_width_s_; //!< Step width to execute this component + double wait_s_; + + // Override functions for Component + /** + * @fn MainRoutine + * @brief Main routine to send command + */ + void MainRoutine(const int time_count) override; +}; + +WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const std::string initialize_file); + +#endif // S2E_COMPONENTS_REAL_COMMUNICATION_C2A_COMMAND_SENDER_HPP_ From e6b711cb15cae8e671502fa67081e874e03ec471 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 15:12:33 +0200 Subject: [PATCH 20/34] Move command parse function to component --- .../wings_command_sender_to_c2a.cpp | 118 ++++++++++++++++-- .../wings_command_sender_to_c2a.hpp | 35 +++++- .../initialize/wings_operation_file.cpp | 99 +-------------- .../initialize/wings_operation_file.hpp | 20 +-- 4 files changed, 149 insertions(+), 123 deletions(-) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index deda53281..dfcd384f3 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -1,31 +1,129 @@ /* * @file wings_command_sender_to_c2a.cpp - * @brief A component to send command using WINGS operation file + * @brief A component to send C2A command using WINGS operation file */ #include "wings_command_sender_to_c2a.hpp" #include +#include + +#if C2A_CORE_VER_MAJOR == 4 +// c2a-core v4 +#include "src_core/TlmCmd/common_cmd_packet_util.h" +#elif C2A_CORE_VER_MAJOR <= 3 +// c2a-core <= v3 +#include "src_core/TlmCmd/common_cmd_packet_util.h" +#else +#error "c2a-core version is not supported" +#endif // c2a-core version header void WingsCommandSenderToC2a::MainRoutine(const int time_count) { UNUSED(time_count); - if (wait_s_ <= 0.0) - { - wait_s_ = (double)wings_operation_file_.ExecuteNextLine(); - } - else{ + if (is_end_of_line_ == true) return; + if (wait_s_ <= 0.0) { + std::string line = wings_operation_file_.GetLatestLine(); + if (line == "EOL") { + is_end_of_line_ = true; + } else { + ExecuteCommandLine(line); + } + } else { wait_s_ -= step_width_s_; } - } +} + +void WingsCommandSenderToC2a::ExecuteCommandLine(const std::string line) { + // Separate with space + std::istringstream token_stream(line); + std::string token; + std::vector tokens; + while (token_stream >> token) { + tokens.push_back(token); + } + + if (tokens[0].find("wait_sec") == 0) { + // wait process + wait_s_ = std::stod(tokens[1]); + } else if (tokens[0].find("check_value") == 0) { + // TODO + wait_s_ = 0; + } else { + wait_s_ = 0; + AnalyzeC2aCommand(tokens); + } + + return; +} + +void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector tokens) { + // Recognize command + size_t first_underscore_position = tokens[0].find('_'); + if (first_underscore_position == std::string::npos) return; + size_t first_dot_position = tokens[0].find('.'); + if (first_underscore_position == std::string::npos) return; + + std::string target_name = tokens[0].substr(0, first_underscore_position); + // TODO check target? + std::string command_type = tokens[0].substr(first_underscore_position + 1, first_dot_position - (first_underscore_position + 1)); + std::string command_name = tokens[0].substr(first_dot_position + 1); + + // Get command code + C2aCommandInformation cmd_info = c2a_command_database_.GetCommandInformation(command_name); + if (cmd_info.GetCommandName() == "Error") { + // TODO: error handling + } + CMD_CODE cmd_id = (CMD_CODE)cmd_info.GetCommandId(); + + // Get arguments + std::vector arguments; + for (size_t i = 1; i < tokens.size(); i++) { + arguments.push_back(tokens[i]); + } + // Check number of arguments + if (arguments.size() != cmd_info.GetNumberOfArgument()) { + // TODO: error handling + } + + // Decode arguments + // Read TI + uint32_t ti = 0; + if (command_type == "TL" || command_type == "BL") { + ti = (uint32_t)std::stoi(arguments[0]); + arguments.erase(arguments.begin()); + } + // Read arguments + uint8_t param[CSP_MAX_LEN]; + uint16_t param_len = 0; + for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { + size_t len = 0; + DecodeC2aCommandArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); + param_len += (uint16_t)len; + } + +// Send command +#ifdef USE_C2A + if (command_type == "RT") { + CCP_register_rtc(cmd_id, param, param_len); + } else if (command_type == "TL") { + CCP_register_tlc(ti, TLCD_ID_FROM_GS, cmd_id, param, param_len); + } else if (command_type == "BL") { + // TODO: BL実装したいが、register_blがない? + } else { + // Not reach + } +#endif +} -WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const double compo_update_step, const std::string initialize_file){ +WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const double compo_update_step_s, + const std::string initialize_file) { IniAccess ini_access(initialize_file); - std::string section = "WINGS_COMMAND_SENDER_TO_C2A_"; + std::string section = "WINGS_COMMAND_SENDER_TO_C2A"; int prescaler = ini_access.ReadInt(section.c_str(), "prescaler"); if (prescaler <= 1) prescaler = 1; - double step_width_s = (double)prescaler * compo_update_step; + double step_width_s = (double)prescaler * compo_update_step_s; std::string c2a_command_data_base_file = ini_access.ReadString(section.c_str(), "c2a_command_database_file"); std::string wings_operation_file = ini_access.ReadString(section.c_str(), "wings_operation_file"); diff --git a/src/components/real/communication/wings_command_sender_to_c2a.hpp b/src/components/real/communication/wings_command_sender_to_c2a.hpp index 1b75fbec7..41794be9e 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.hpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.hpp @@ -13,20 +13,20 @@ /* * @class C2aCommandSender - * @brief A component to send command using WINGS operation file + * @brief A component to send C2A command using WINGS operation file */ class WingsCommandSenderToC2a : public Component { public: /** * @fn WingsCommandSenderToC2a * @brief Constructor - * @param [in] + * @param [in] */ WingsCommandSenderToC2a(int prescaler, ClockGenerator* clock_generator, const double step_width_s, const std::string command_database_file, const std::string operation_file) : Component(prescaler, clock_generator), c2a_command_database_(command_database_file), - wings_operation_file_(operation_file, c2a_command_database_), + wings_operation_file_(operation_file), step_width_s_(step_width_s) {} /** @@ -38,8 +38,9 @@ class WingsCommandSenderToC2a : public Component { protected: C2aCommandDatabase c2a_command_database_; //!< Command database WingsOperationFile wings_operation_file_; //!< WINGS operation file - const double step_width_s_; //!< Step width to execute this component - double wait_s_; + const double step_width_s_; //!< Step width to execute this component [s] + double wait_s_ = 0.0; //!< Wait counter [s] + bool is_end_of_line_ = false; //!< Flag to detect end of line // Override functions for Component /** @@ -47,8 +48,30 @@ class WingsCommandSenderToC2a : public Component { * @brief Main routine to send command */ void MainRoutine(const int time_count) override; + + /** + * @fn ExecuteCommandLine + * @brief Execute command line + * @param[in] line: Executed line + */ + void ExecuteCommandLine(const std::string line); + + /** + * @fn AnalyzeC2aCommand + * @brief Analyze C2A command Line + * @param[in] tokens: Command line after space separation + */ + void AnalyzeC2aCommand(const std::vector tokens); }; -WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const std::string initialize_file); +/** + * @fn InitWingsCommandSenderToC2a + * @brief Initialize WingsCommandSenderToC2a + * @param[in] clock_generator: Clock generator + * @param[in] compo_update_step_s: Component update step time [s] + * @param[in] initialize_file: Initialize file name + */ +WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_generator, const double compo_update_step_s, + const std::string initialize_file); #endif // S2E_COMPONENTS_REAL_COMMUNICATION_C2A_COMMAND_SENDER_HPP_ diff --git a/src/library/initialize/wings_operation_file.cpp b/src/library/initialize/wings_operation_file.cpp index f1f3612fd..628c22fcf 100644 --- a/src/library/initialize/wings_operation_file.cpp +++ b/src/library/initialize/wings_operation_file.cpp @@ -6,19 +6,8 @@ #include "wings_operation_file.hpp" #include -#include -#if C2A_CORE_VER_MAJOR == 4 -// c2a-core v4 -#elif C2A_CORE_VER_MAJOR <= 3 -// c2a-core <= v3 -#include "src_core/TlmCmd/common_cmd_packet_util.h" -#else -#error "c2a-core version is not supported" -#endif // c2a-core version header - -WingsOperationFile::WingsOperationFile(const std::string file_path, const C2aCommandDatabase& command_database) - : command_database_(command_database) { +WingsOperationFile::WingsOperationFile(const std::string file_path) { // File open std::ifstream file(file_path); if (!file.is_open()) { @@ -48,87 +37,11 @@ WingsOperationFile::WingsOperationFile(const std::string file_path, const C2aCom } } -size_t WingsOperationFile::ExecuteNextLine() { - std::string input_line = lines_[0]; - - // Separate with space - std::istringstream token_stream(input_line); - std::string token; - std::vector tokens; - while (token_stream >> token) { - tokens.push_back(token); - } - - if (tokens[0].find("wait_sec") == 0) { - // wait process - size_t wait_time_sec = (uint32_t)std::stoi(tokens[0]); - return wait_time_sec; - } - - if (tokens[0].find("check_value") == 0) { - // TODO - return 0; - } - - AnalyzeC2aCommand(tokens); - return 0; -} - -void WingsOperationFile::AnalyzeC2aCommand(const std::vector tokens) { - // Recognize command - size_t first_underscore_position = tokens[0].find('_'); - if (first_underscore_position == std::string::npos) return; - size_t first_dot_position = tokens[0].find('.'); - if (first_underscore_position == std::string::npos) return; +std::string WingsOperationFile::GetLatestLine() { + if (line_pointer_ >= lines_.size()) return "EOL"; - std::string target_name = tokens[0].substr(0, first_underscore_position); - // TODO check target? - std::string command_type = tokens[0].substr(first_underscore_position + 1, first_dot_position); - std::string command_name = tokens[0].substr(first_dot_position + 1); + std::string line = lines_[line_pointer_]; + line_pointer_++; - // Get command code - C2aCommandInformation cmd_info = command_database_.GetCommandInformation(command_name); - if (cmd_info.GetCommandName() == "Error") { - // TODO: error handling - } - CMD_CODE cmd_id = (CMD_CODE)cmd_info.GetCommandId(); - - // Get arguments - std::vector arguments; - for (size_t i = 1; i < tokens.size(); i++) { - arguments.push_back(tokens[i]); - } - // Check number of arguments - if (arguments.size() != cmd_info.GetNumberOfArgument()) { - // TODO: error handling - } - - // Decode arguments - // Read TI - uint32_t ti = 0; - if (command_type == "TL" || command_type == "BL") { - ti = (uint32_t)std::stoi(arguments[0]); - arguments.erase(arguments.begin()); - } - // Read arguments - uint8_t param[CSP_MAX_LEN]; - uint16_t param_len = 0; - for (size_t arg_num = 0; arg_num < arguments.size(); arg_num++) { - size_t len = 0; - DecodeC2aCommandArgument(cmd_info.GetArgumentType(arg_num), arguments[arg_num], param + param_len, len); - param_len += (uint16_t)len; - } - -// Send command -#ifdef USE_C2A - if (command_type == "RT") { - CCP_register_rtc(cmd_id, param, param_len); - } else if (command_type == "TL") { - CCP_register_tlc(ti, TLCD_ID_FROM_GS, cmd_id, param, param_len); - } else if (command_type == "BL") { - // TODO: BL実装したいが、register_blがない? - } else { - // Not reach - } -#endif + return line; } diff --git a/src/library/initialize/wings_operation_file.hpp b/src/library/initialize/wings_operation_file.hpp index 9549170da..11cb2a9b0 100644 --- a/src/library/initialize/wings_operation_file.hpp +++ b/src/library/initialize/wings_operation_file.hpp @@ -22,25 +22,17 @@ class WingsOperationFile { * @brief Constructor * @param[in] file_path: File path of the operation file */ - WingsOperationFile(const std::string file_path, const C2aCommandDatabase& command_database); + WingsOperationFile(const std::string file_path); /** - * @fn ExecuteNextLine - * @brief Execute next line command - * @return Required wait time for next execution [s] + * @fn GetLatestLine + * @brief Return latest line command */ - size_t ExecuteNextLine(); + std::string GetLatestLine(); private: - std::vector lines_; //!!< List of read operation command line - const C2aCommandDatabase& command_database_; //!< C2A command database - - /** - * @fn AnalyzeC2aCommand - * @brief Analyze C2A command Line - * @param[in] tokens: command line after space separation - */ - void AnalyzeC2aCommand(const std::vector tokens); + std::vector lines_; //!!< List of read operation command line + size_t line_pointer_ = 0; //!< Line pointer }; #endif // S2E_LIBRARY_INITIALIZE_WINGS_OPERATION_FILE_HPP_ From 49f3ec50624ea0fe20e4e81bd99dac0a4e0652ce Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 15:38:13 +0200 Subject: [PATCH 21/34] Add ifdef for C2A_USE --- .../real/communication/wings_command_sender_to_c2a.cpp | 2 ++ src/library/initialize/c2a_command_database.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index dfcd384f3..65658c38e 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -8,6 +8,7 @@ #include #include +#ifdef USE_C2A #if C2A_CORE_VER_MAJOR == 4 // c2a-core v4 #include "src_core/TlmCmd/common_cmd_packet_util.h" @@ -17,6 +18,7 @@ #else #error "c2a-core version is not supported" #endif // c2a-core version header +#endif // USE_C2A void WingsCommandSenderToC2a::MainRoutine(const int time_count) { UNUSED(time_count); diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index a86b7961a..cf34d9b57 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -9,6 +9,7 @@ #include #include +#ifdef USE_C2A #if C2A_CORE_VER_MAJOR == 4 // c2a-core v4 #include "src_core/library/endian.h" @@ -18,6 +19,7 @@ #else #error "c2a-core version is not supported" #endif // c2a-core version header +#endif // USE_C2A C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { if (cmd_db_line.find("*") == 0) return; From 5fc1c593a9ec924e6b0188cfe4e5d9e5d431b94e Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 15:48:20 +0200 Subject: [PATCH 22/34] Add ifdef for C2A_USE --- .../real/communication/wings_command_sender_to_c2a.cpp | 4 +++- src/library/initialize/c2a_command_database.cpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index 65658c38e..1bf2d6d96 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -59,6 +59,7 @@ void WingsCommandSenderToC2a::ExecuteCommandLine(const std::string line) { } void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector tokens) { +#ifdef USE_C2A // Recognize command size_t first_underscore_position = tokens[0].find('_'); if (first_underscore_position == std::string::npos) return; @@ -104,7 +105,6 @@ void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector t } // Send command -#ifdef USE_C2A if (command_type == "RT") { CCP_register_rtc(cmd_id, param, param_len); } else if (command_type == "TL") { @@ -114,6 +114,8 @@ void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector t } else { // Not reach } +#else + UNUSED(tokens); #endif } diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index cf34d9b57..6229eb157 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -167,5 +167,9 @@ void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argu default: break; } +#else + UNUSED(argument_string); + UNUSED(param); + UNUSED(size_param); #endif } From 3e3831aa6563c3f90a14d6d816dc79f575362dd0 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 16:14:01 +0200 Subject: [PATCH 23/34] Add header for macro --- .../real/communication/wings_command_sender_to_c2a.cpp | 3 ++- src/library/initialize/c2a_command_database.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index 1bf2d6d96..d9d193344 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -6,6 +6,7 @@ #include "wings_command_sender_to_c2a.hpp" #include +#include #include #ifdef USE_C2A @@ -104,7 +105,7 @@ void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector t param_len += (uint16_t)len; } -// Send command + // Send command if (command_type == "RT") { CCP_register_rtc(cmd_id, param, param_len); } else if (command_type == "TL") { diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index 6229eb157..9b17db22c 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #ifdef USE_C2A From 094690b5286ede0049cefd5e86d0a46b79be4f5c Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 16:24:22 +0200 Subject: [PATCH 24/34] Add initialize files --- .../SAMPLE_MOBC_CMD_DB_CMD_DB.csv | 1000 +++++++++++++++++ .../wings_command_sender_to_c2a/example.ops | 10 + .../wings_command_sender_to_c2a.ini | 4 + 3 files changed, 1014 insertions(+) create mode 100644 data/sample/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv create mode 100644 data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops create mode 100644 data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini diff --git a/data/sample/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv b/data/sample/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv new file mode 100644 index 000000000..ab30be976 --- /dev/null +++ b/data/sample/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv @@ -0,0 +1,1000 @@ +Component,Name,Target,Code,Params,,,,,,,,,,,,,Danger Flag,Is Restricted,Description,Note +MOBC,,,,Num Params,Param1,,Param2,,Param3,,Param4,,Param5,,Param6,,,,, +Comment,,,,,Type,Description,Type,Description,Type,Description,Type,Description,Type,Description,Type,Description,,,, +*,EXAMPLE,OBC,,2,uint32_t,address,int32_t,time [ms],,,,,,,,,,,例,引数の説明と単位を書くこと!(例:time [ms]) +* C2A_CORE,基幹機能コマンド,,,,,,,,,,,,,,,,,,, +,NOP,OBC,0x0000,0,,,,,,,,,,,,,,,ダミーコマンド, +,TMGR_SET_TIME,OBC,0x0001,1,uint32_t,TI,,,,,,,,,,,,,MOBC時刻設定コマンド, +,TMGR_UPDATE_UNIXTIME,OBC,0x0002,3,double,unixtime,uint32_t,total_cycle,uint32_t,step,,,,,,,,,MOBC UNIXTIME修正コマンド, +,TMGR_SET_UTL_UNIXTIME_EPOCH,OBC,0x0003,1,double,ult_unixtime_epoch,,,,,,,,,,,,,UTL_cmdで用いるunixtimeの紀元を変更する,utl_unixtime_epoch [s] +,TMGR_SET_CYCLE_CORRECTION,OBC,0x0004,1,double,cycle_correction,,,,,,,,,,,,,CYCLES_PER_SECの補正倍率を変更する@@ 初期値は1.0, +,TMGR_RESET_CYCLE_CORRECTION,OBC,0x0005,0,,,,,,,,,,,,,,,CYCLES_PER_SECの補正倍率を1.0に初期化する, +,TMGR_CLEAR_UNIXTIME_INFO,OBC,0x0006,0,,,,,,,,,,,,,,,unixtime_info_ を初期化する, +,AM_REGISTER_APP,OBC,0x0007,3,uint32_t,app_id,uint32_t,init_ptr,uint32_t,entry_ptr,,,,,,,,,アプリ登録コマンド, +,AM_INITIALIZE_APP,OBC,0x0008,1,uint32_t,app_id,,,,,,,,,,,,,アプリ初期化コマンド, +,AM_EXECUTE_APP,OBC,0x0009,1,uint32_t,app_id,,,,,,,,,,,,,アプリ実行コマンド, +,AM_SET_PAGE_FOR_TLM,OBC,0x000A,1,uint8_t,,,,,,,,,,,,,,テレメトリ生成用ページ番号設定, +,AM_CLEAR_APP_INFO,OBC,0x000B,0,,,,,,,,,,,,,danger,,アプリ実行時間計測の初期化, +,MM_SET_MODE_LIST,OBC,0x000C,2,uint8_t,mode,uint16_t,bc_index,,,,,,,,,,,モード定義リスト設定コマンド, +,MM_SET_TRANSITION_TABLE,OBC,0x000D,3,uint8_t,from_mode,uint8_t,to_mode,uint16_t,bc_index,,,,,,,,,モード遷移定義テーブル書き換えコマンド, +,MM_START_TRANSITION,OBC,0x000E,1,uint8_t,to_mode,,,,,,,,,,,,,モード遷移開始コマンド, +,MM_FINISH_TRANSITION,OBC,0x000F,0,,,,,,,,,,,,,,,モード遷移終了通知コマンド, +,MM_UPDATE_TRANSITION_TABLE_FOR_TLM,OBC,0x0010,0,,,,,,,,,,,,,,,モードのTLMテーブル情報更新, +,TDSP_SET_TASK_LIST,OBC,0x0011,1,uint8_t,bc_index,,,,,,,,,,,,,タスクリスト設定コマンド, +,TLCD_CLEAR_ALL_TIMELINE,OBC,0x0012,1,uint8_t,TLCD_ID,,,,,,,,,,,danger,,全TLC登録解除, +,TLCD_CLEAR_TIMELINE_AT,OBC,0x0013,2,uint8_t,TLCD_ID,uint32_t,TI,,,,,,,,,,,TI指定TLC登録解除, +,TLCD_DEPLOY_BLOCK,OBC,0x0014,2,uint8_t,TLCD_ID,uint16_t,bc_index,,,,,,,,,,,BLC展開 , +,TLCD_CLEAR_ERR_LOG,OBC,0x0015,1,uint8_t,,,,,,,,,,,,,,最新のコマンド実行異常記録をクリア, +,TLCD_SET_SOE_FLAG,OBC,0x0016,2,uint8_t,TLCD_ID,uint8_t,,,,,,,,,,,,異常時実行停止機能設定(ライン番号@@ フラグ), +,TLCD_SET_LOUT_FLAG,OBC,0x0017,2,uint8_t,TLCD_ID,uint8_t,,,,,,,,,,,,実行停止機能設定(ライン番号@@ フラグ), +,TLCD_SET_ID_FOR_TLM,OBC,0x0018,1,uint8_t,TLCD_ID,,,,,,,,,,,,,テレメで降ろすTL_IDの設定とTLテレメの更新, +,TLCD_SET_PAGE_FOR_TLM,OBC,0x0019,1,uint8_t,page_no,,,,,,,,,,,,,テレメトリ生成用ページ番号設定, +**,Telemetry Generator,,,,,,,,,,,,,,,,,,, +,GENERATE_TLM,OBC,0x001A,3,uint8_t,category,uint8_t,TLM_ID,uint8_t,送出回数,,,,,,,,,TLMパケット生成 (deprecated), +,TG_GENERATE_TLM,OBC,0x001B,4,uint8_t,tlm id,uint8_t,dest flags,uint8_t,dest info,uint8_t,送出回数,,,,,,,自身の OBC のテレメを生成, +,TG_GENERATE_HP_TLM,OBC,0x001C,1,uint8_t,tlm id,,,,,,,,,,,,,HP テレメを生成 (事実上,現在使われていない), +,TG_GENERATE_RT_TLM,OBC,0x001D,1,uint8_t,tlm id,,,,,,,,,,,,,RT テレメを生成, +,TG_GENERATE_ST_TLM,OBC,0x001E,2,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,,,,,ST テレメを生成, +,TG_FORWARD_TLM,OBC,0x001F,5,uint16_t,apid,uint8_t,tlm id,uint8_t,dest flags,uint8_t,dest info,uint8_t,送出回数,,,,,2nd OBC のテレメを転送, +,TG_FORWARD_AS_HP_TLM,OBC,0x0020,2,uint16_t,apid,uint8_t,tlm id,,,,,,,,,,,HP テレメとして 2nd OBC のテレメを転送 (事実上,現在使われていない), +,TG_FORWARD_AS_RT_TLM,OBC,0x0021,2,uint16_t,apid,uint8_t,tlm id,,,,,,,,,,,RT テレメとして 2nd OBC のテレメを転送, +,TG_FORWARD_AS_ST_TLM,OBC,0x0022,3,uint16_t,apid,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,,,ST テレメとして 2nd OBC のテレメを転送, +**,BCTコマンド,,,,,,,,,,,,,,,,,,, +,BCT_CLEAR_BLOCK,OBC,0x0023,1,uint16_t,bc_index,,,,,,,,,,,,,BLC登録解除コマンド, +,BCT_SET_BLOCK_POSITION,OBC,0x0024,2,uint16_t,bc_index,uint8_t,cmd_index,,,,,,,,,,,BLC操作ポインタ設定コマンド, +,BCT_COPY_BCT,OBC,0x0025,2,uint16_t,dst_bc_index,uint16_t,src_bc_index,,,,,,,,,,,BCT の内容を別の場所にコピー, +,BCT_OVERWRITE_CMD,OBC,0x0026,5,uint16_t,CMD_CODE,uint32_t,TI,uint16_t,pos.block,uint8_t,pos.cmd,raw,cmd_param (big endian),,,danger,,BCTの内容を上書き, +,BCT_FILL_NOP,OBC,0x0027,1,uint8_t,,,,,,,,,,,,,,テレメ運用時の10個BCをNOP埋めする.(NOP個数), +**,BCEコマンド,,,,,,,,,,,,,,,,,,, +,BCE_ACTIVATE_BLOCK,OBC,0x0028,0,,,,,,,,,,,,,,,BLC有効化コマンド, +,BCE_ACTIVATE_BLOCK_BY_ID,OBC,0x0029,1,uint16_t,bc_index,,,,,,,,,,,,,BCを(無条件に)有効化, +,BCE_INACTIVATE_BLOCK_BY_ID,OBC,0x002A,1,uint16_t,bc_index,,,,,,,,,,,,,BCを(無条件に)無効化, +,BCE_ROTATE_BLOCK,OBC,0x002B,1,uint16_t,bc_index,,,,,,,,,,,,,BLC回転コマンド, +,BCE_COMBINE_BLOCK,OBC,0x002C,1,uint16_t,bc_index,,,,,,,,,,,,,BLC融合コマンド, +,BCE_TIMELIMIT_COMBINE_BLOCK,OBC,0x002D,2,uint16_t,bc_index,uint8_t,limit_step,,,,,,,,,,,時間制限付きBLC融合コマンド, +,BCE_RESET_ROTATOR_INFO,OBC,0x002E,0,,,,,,,,,,,,,danger,,カウンタ類リセット, +,BCE_RESET_COMBINER_INFO,OBC,0x002F,0,,,,,,,,,,,,,danger,,カウンタ類リセット, +,BCE_SET_ROTATE_INTERVAL,OBC,0x0030,2,uint16_t,,uint16_t,,,,,,,,,,,,BC回転時の回転間隔周期を設定する, +**,GSCDコマンド,,,,,,,,,,,,,,,,,,, +,GSCD_CLEAR_ERR_LOG,OBC,0x0031,0,,,,,,,,,,,,,,,最新のコマンド実行異常記録をクリア, +**,RTCDコマンド,,,,,,,,,,,,,,,,,,, +,RTCD_CLEAR_ALL_REALTIME,OBC,0x0032,0,,,,,,,,,,,,,danger,,全RTC登録解除, +,RTCD_CLEAR_ERR_LOG,OBC,0x0033,0,,,,,,,,,,,,,,,最新のコマンド実行異常記録をクリア, +**,メモリ操作コマンド,,,,,,,,,,,,,,,,,,, +,MEM_SET_REGION,OBC,0x0034,2,uint32_t,始点アドレス,uint32_t,終点アドレス,,,,,,,,,,,始点アドレスと終点アドレスを指定する, +*,MEM_DUMP_REGION_SEQ,OBC,,2,uint8_t,category,uint8_t,送出回数,,,,,,,,,,,カテゴリと送信回数を指定する, +*,MEM_DUMP_REGION_RND,OBC,,3,uint8_t,category,uint8_t,送出回数,uint16_t,ダンプ位置,,,,,,,,,カテゴリと送信回数@@ダンプ位置を指定する, +*,MEM_DUMP_SINGLE,OBC,,3,uint8_t,category,uint8_t,送出回数,uint32_t,ダンプ位置,,,,,,,,,カテゴリと送信回数@@ダンプ位置を指定する, +,MEM_LOAD,OBC,0x0035,2,uint32_t,開始アドレス,raw,HEXBINARY,,,,,,,,,,,開始アドレス、データを指定,第2パラメータの指定は仮設定 +,MEM_SET_DESTINATION,OBC,0x0036,1,uint32_t,コピー先アドレス,,,,,,,,,,,,,コピー先設定, +,MEM_COPY_REGION_SEQ,OBC,0x0037,1,uint32_t,コピー幅,,,,,,,,,,,,,領域コピー, +**,EventLogger,,,,,,,,,,,,,,,,,,, +,EL_INIT,OBC,0x0038,0,,,,,,,,,,,,,,,EL初期化, +,EL_CLEAR_LOG_ALL,OBC,0x0039,0,,,,,,,,,,,,,,,全ログ削除, +,EL_CLEAR_LOG_BY_ERR_LEVEL,OBC,0x003A,1,uint8_t,err_level,,,,,,,,,,,,,エラーレベル指定ログ削除, +,EL_CLEAR_STATISTICS,OBC,0x003B,0,,,,,,,,,,,,,,,統計情報削除, +,EL_CLEAR_TLOG,OBC,0x003C,1,uint8_t,err_level,,,,,,,,,,,,,TLog削除, +,EL_CLEAR_CLOG,OBC,0x003D,1,uint8_t,err_level,,,,,,,,,,,,,CLog削除, +,EL_RECORD_EVENT,OBC,0x003E,4,uint32_t,group,uint32_t,local,uint8_t,err_level,uint32_t,note,,,,,,,イベント記録, +,EL_TLOG_SET_PAGE_FOR_TLM,OBC,0x003F,2,uint8_t,page_no,uint8_t,err_level,,,,,,,,,,,TLogのダウンリンクテレメ設定, +,EL_CLOG_SET_PAGE_FOR_TLM,OBC,0x0040,2,uint8_t,page_no,uint8_t,err_level,,,,,,,,,,,CLogのダウンリンクテレメ設定, +,EL_INIT_LOGGING_SETTINGS,OBC,0x0041,0,,,,,,,,,,,,,,,ログ設定を初期化, +,EL_ENABLE_LOGGING,OBC,0x0042,1,uint32_t,group,,,,,,,,,,,,,ロギングを有効化, +,EL_DISABLE_LOGGING,OBC,0x0043,1,uint32_t,group,,,,,,,,,,,,,ロギングを無効化, +,EL_ENABLE_LOGGING_ALL,OBC,0x0044,0,,,,,,,,,,,,,,,すべてのロギングを有効化, +,EL_DISABLE_LOGGING_ALL,OBC,0x0045,0,,,,,,,,,,,,,,,すべてのロギングを無効化, +,EL_ENABLE_TLOG_OVERWRITE,OBC,0x0046,1,uint8_t,err_level,,,,,,,,,,,,,TLogのログ上書きを有効化, +,EL_DISABLE_TLOG_OVERWRITE,OBC,0x0047,1,uint8_t,err_level,,,,,,,,,,,,,TLogのログ上書きを無効化, +,EL_ENABLE_TLOG_OVERWRITE_ALL,OBC,0x0048,0,,,,,,,,,,,,,,,すべてのTLogのログ上書きを有効化, +,EL_DISABLE_TLOG_OVERWRITE_ALL,OBC,0x0049,0,,,,,,,,,,,,,,,すべてのTLogのログ上書きを無効化, +**,EventHandler,,,,,,,,,,,,,,,,,,, +,EH_INIT,OBC,0x004A,0,,,,,,,,,,,,,,,EHの初期化, +,EH_CLEAR_ALL_RULE,OBC,0x004B,0,,,,,,,,,,,,,,,EHのすべてのルールをクリア, +,EH_LOAD_DEFAULT_RULE,OBC,0x004C,0,,,,,,,,,,,,,,,EHのデフォルトルールを読み込み, +,EH_SET_REGISTER_RULE_EVENT_PARAM,OBC,0x004D,6,uint16_t,rule id,uint32_t,event group,uint32_t,event local,uint8_t,event err level,uint8_t,should_match_err_level,uint16_t,deploy bc index,,,登録するEHルールのイベントパラメータを設定, +,EH_SET_REGISTER_RULE_CONDITION_PARAM,OBC,0x004E,4,uint8_t,condition type,uint16_t,count_threshold,uint32_t,time_threshold [ms],uint8_t,is_active,,,,,,,登録するEHルールの対応条件パラメタを設定, +,EH_REGISTER_RULE,OBC,0x004F,0,,,,,,,,,,,,,,,設定したパラメタでEHルールを登録, +,EH_DELETE_RULE,OBC,0x0050,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを削除, +,EH_INIT_RULE,OBC,0x0051,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを初期化(ルールを有効化し,ルールカウンタも初期化), +,EH_INIT_RULE_FOR_MULTI_LEVEL,OBC,0x0052,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを初期化(ルールを有効化し,ルールカウンタも初期化)(多段EH対応用), +,EH_ACTIVATE_RULE,OBC,0x0053,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを有効化, +,EH_INACTIVATE_RULE,OBC,0x0054,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを無効化, +,EH_ACTIVATE_RULE_FOR_MULTI_LEVEL,OBC,0x0055,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを有効化(多段EH対応用), +,EH_INACTIVATE_RULE_FOR_MULTI_LEVEL,OBC,0x0056,1,uint16_t,rule id,,,,,,,,,,,,,指定したルールを無効化(多段EH対応用), +,EH_SET_RULE_COUNTER,OBC,0x0057,2,uint16_t,rule id,uint16_t,counter,,,,,,,,,,,EH_Rule の counter をセット, +,EH_CLEAR_RULE_COUNTER,OBC,0x0058,1,uint16_t,rule id,,,,,,,,,,,,,EH_Rule の counter を0 クリア, +,EH_CLEAR_RULE_COUNTER_BY_EVENT,OBC,0x0059,3,uint32_t,group,uint32_t,local,uint8_t,err_level,,,,,,,,,EH_Rule の counter を EL_Event 指定で 0 クリア, +,EH_CLEAR_LOG,OBC,0x005A,0,,,,,,,,,,,,,,,EHの対応ログをクリア, +,EH_SET_MAX_RESPONSE_NUM,OBC,0x005B,1,uint8_t,max_response_num,,,,,,,,,,,,,一度のEH実行で対応するイベントの最大数を設定, +,EH_SET_MAX_CHECK_EVENT_NUM,OBC,0x005C,1,uint16_t,max_check_event_num,,,,,,,,,,,,,一度のEH実行でチェックするイベントの最大数を設定, +,EH_SET_MAX_MULTI_LEVEL_NUM,OBC,0x005D,1,uint8_t,max_multi_level_num,,,,,,,,,,,,,設定可能な最大段数を設定, +,EH_SET_PAGE_OF_RULE_TABLE_FOR_TLM,OBC,0x005E,1,uint8_t,page_no,,,,,,,,,,,,,EHルールテーブルのテレメページの設定, +,EH_SET_PAGE_OF_RULE_SORTED_IDX_FOR_TLM,OBC,0x005F,1,uint8_t,page_no,,,,,,,,,,,,,EHルールのソート済みテーブルのテレメページの設定, +,EH_SET_PAGE_OF_LOG_TABLE_FOR_TLM,OBC,0x0060,1,uint8_t,page_no,,,,,,,,,,,,,EHログテーブルのテレメページの設定, +,EH_SET_TARGET_ID_OF_RULE_TABLE_FOR_TLM,OBC,0x0061,1,uint16_t,rule id,,,,,,,,,,,,,EHテレメに表示するルールのID設定, +,EH_MATCH_EVENT_COUNTER_TO_EL,OBC,0x0062,0,,,,,,,,,,,,,,,イベント発生を検知するためのEHカウンタをELカウンタに強制定期に合わせる, +,EH_INIT_RULE_BY_EVENT_GROUP,OBC,0x0063,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_INIT_RULE の by_event_group コマンド.想定外のものまで操作されないか注意すること, +,EH_INIT_RULE_BY_EVENT_GROUP_FOR_MULTI_LEVEL,OBC,0x0064,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_INIT_RULE_FOR_MULTI_LEVEL の by_event_group コマンド.想定外のものまで操作されないか注意すること, +,EH_ACTIVATE_RULE_BY_EVENT_GROUP,OBC,0x0065,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_ACTIVATE_RULE の by_event_group コマンド.想定外のものまで操作されないか注意すること, +,EH_INACTIVATE_RULE_BY_EVENT_GROUP,OBC,0x0066,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_INACTIVATE_RULE の by_event_group コマンド.想定外のものまで操作されないか注意すること, +,EH_ACTIVATE_RULE_BY_EVENT_GROUP_FOR_MULTI_LEVEL,OBC,0x0067,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_ACTIVATE_RULE_FOR_MULTI_LEVEL の by_event_group コマンド.想定外のものまで操作されないか注意すること, +,EH_INACTIVATE_RULE_BY_EVENT_GROUP_FOR_MULTI_LEVEL,OBC,0x0068,1,uint32_t,group,,,,,,,,,,,,,Cmd_EH_INACTIVATE_RULE_FOR_MULTI_LEVEL の by_event_group コマンド.想定外のものまで操作されないか注意すること, +**,EventUtility,,,,,,,,,,,,,,,,,,, +,EVENT_UTIL_ENABLE_EH_EXEC,OBC,0x0069,0,,,,,,,,,,,,,,,EHの実行を有効に, +,EVENT_UTIL_DISABLE_EH_EXEC,OBC,0x006A,0,,,,,,,,,,,,,,,EHの実行を無効に, +,EVENT_UTIL_EXEC_EH,OBC,0x006B,0,,,,,,,,,,,,,,,EHを単発で実行, +**,Telemetry Frame@@ Command Analyze,,,,,,,,,,,,,,,,,,, +,TF_INIT,OBC,0x006C,0,,,,,,,,,,,,,,,TFの初期化, +,CA_INIT,OBC,0x006D,0,,,,,,,,,,,,,,,CAの初期化, +,TF_REGISTER_TLM,OBC,0x006E,2,uint8_t,index,uint32_t,tlm_func,,,,,,,,,,,テレメトリ登録コマンド, +,CA_REGISTER_CMD,OBC,0x006F,3,uint16_t,index,uint32_t,cmd_func,raw,param_info,,,,,,,,,コマンド登録コマンド, +,TF_SET_PAGE_FOR_TLM,OBC,0x0070,1,uint8_t,page_no,,,,,,,,,,,,,テレメトリ定義テーブルページ番号設定, +,CA_SET_PAGE_FOR_TLM,OBC,0x0071,1,uint8_t,page_no,,,,,,,,,,,,,コマンド定義テーブルページ番号設定, +**,Tlm Manager コマンド,,,,,,,,,,,,,,,,,,, +,TLM_MGR_INIT,OBC,0x0072,0,,,,,,,,,,,,,,,初期化,DCU を使っているので,完了に最大 1.5 秒ほどかかる +,TLM_MGR_INIT_MASTER_AND_DEPLOY_BC,OBC,0x0073,0,,,,,,,,,,,,,,,master bc の初期化, +,TLM_MGR_CLEAR_HK_TLM,OBC,0x0074,0,,,,,,,,,,,,,,,HKテレメを初期化,DCU を使っているので,完了に最大 1 秒ほどかかる +,TLM_MGR_CLEAR_HIGH_FREQ_TLM,OBC,0x0075,0,,,,,,,,,,,,,,,HIGH_FREQ テレメを初期化,DCU を使っているので,完了に最大 1 秒ほどかかる +,TLM_MGR_CLEAR_LOW_FREQ_TLM,OBC,0x0076,0,,,,,,,,,,,,,,,LOW_FREQ テレメを初期化,DCU を使っているので,完了に最大 1 秒ほどかかる +,TLM_MGR_CLEAR_USER_TLM,OBC,0x0077,0,,,,,,,,,,,,,,,high_freq@@ low_freq を初期化,DCU を使っているので,完了に最大 1 秒ほどかかる +,TLM_MGR_START_TLM,OBC,0x0078,0,,,,,,,,,,,,,,,TLM送出開始, +,TLM_MGR_STOP_TLM,OBC,0x0079,0,,,,,,,,,,,,,,,TLM送出一時停止(事実上,TLM送出用TLをクリア), +,TLM_MGR_REGISTER_GENERATE_RT_TLM,OBC,0x007A,2,uint8_t,TLM_MGR_BC_ROLE,uint8_t,tlm id,,,,,,,,,,,TG_GENERATE_RT_TLM を登録, +,TLM_MGR_REGISTER_GENERATE_ST_TLM,OBC,0x007B,3,uint8_t,TLM_MGR_BC_ROLE,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,,,TG_GENERATE_ST_TLM を登録, +,TLM_MGR_REGISTER_FORWARD_AS_RT_TLM,OBC,0x007C,3,uint8_t,TLM_MGR_BC_ROLE,uint16_t,apid,uint8_t,tlm id,,,,,,,,,TG_GENERATE_RT_TLM を登録, +,TLM_MGR_REGISTER_FORWARD_AS_ST_TLM,OBC,0x007D,4,uint8_t,TLM_MGR_BC_ROLE,uint16_t,apid,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,TG_GENERATE_ST_TLM を登録, +,TLM_MGR_REGISTER_REPLAY_TLM,OBC,0x007E,2,uint8_t,TLM_MGR_BC_ROLE,uint8_t,dr partition (dest info),,,,,,,,,,,DR_REPLAY_TLM を登録, +,TLM_MGR_DELETE_GENERATE_RT_TLM,OBC,0x007F,2,uint8_t,TLM_MGR_BC_ROLE,uint8_t,tlm id,,,,,,,,,,,TG_GENERATE_RT_TLM を削除, +,TLM_MGR_DELETE_GENERATE_ST_TLM,OBC,0x0080,3,uint8_t,TLM_MGR_BC_ROLE,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,,,TG_GENERATE_ST_TLM を削除, +,TLM_MGR_DELETE_FORWARD_AS_RT_TLM,OBC,0x0081,3,uint8_t,TLM_MGR_BC_ROLE,uint16_t,apid,uint8_t,tlm id,,,,,,,,,TG_GENERATE_RT_TLM を削除, +,TLM_MGR_DELETE_FORWARD_AS_ST_TLM,OBC,0x0082,4,uint8_t,TLM_MGR_BC_ROLE,uint16_t,apid,uint8_t,tlm id,uint8_t,dr partition (dest info),,,,,,,TG_GENERATE_ST_TLM を削除, +,TLM_MGR_DELETE_REPLAY_TLM,OBC,0x0083,2,uint8_t,TLM_MGR_BC_ROLE,uint8_t,dr partition (dest info),,,,,,,,,,,DR_REPLAY_TLM を削除, +**,Divided Cmd Utility コマンド,,,,,,,,,,,,,,,,,,, +,DCU_ABORT_CMD,OBC,0x0084,1,uint16_t,Cmd ID,,,,,,,,,,,,,実行中の分割コマンドを停止する, +,DCU_DOWN_ABORT_FLAG,OBC,0x0085,1,uint16_t,Cmd ID,,,,,,,,,,,,,エラー,またはコマンドによって中断ステータスとなっているコマンドを,実行可能状態に戻す, +,DCU_CLEAR_LOG,OBC,0x0086,0,,,,,,,,,,,,,,,ログをクリアする, +**,Test App コマンド,,,,,,,,,,,,,,,,,,, +,TEST_CCP_REGISTER_TLC_ASAP,OBC,0x0087,1,uint32_t,ti,,,,,,,,,,,,,CCP_register_tlc_asap のテスト用コマンド, +,TEST_CCP_GET_RAW_PARAM_INFO,OBC,0x0088,3,uint16_t,raw data len,uint8_t,first data,raw,raw data,,,,,,,,,CCP UTIL の ParamGenerator のテスト, +**,,,,,,,,,,,,,,,,,,,, +* CDH,GS用,,,,,,,,,,,,,,,,,,, +,DI_GS_DRIVER_RESET,OBC,0x0100,0,,,,,,,,,,,,,,,GS ドライバの初期化, +,DI_GS_SET_RT_FLUSH_INTERVAL,OBC,0x0101,1,uint32_t,排出間隔,,,,,,,,,,,,,RT VCDUの排出間隔設定, +,DI_GS_SET_RP_FLUSH_INTERVAL,OBC,0x0102,1,uint32_t,排出間隔,,,,,,,,,,,,,RP VCDUの排出間隔設定, +,DI_GS_SET_FARM_PW,OBC,0x0103,1,uint8_t,positive_window_width,,,,,,,,,,,,,FARM-1のPositive Window Width設定, +,DI_GS_SET_INFO,OBC,0x0104,1,uint8_t,TLM選択,,,,,,,,,,,,,GS送信TLMが0ならCCSDSに@@ 1ならUARTの情報が出てくる, +,DI_GS_CCSDS_GET_BUFFER,OBC,0x0105,0,,,,,,,,,,,,,,,, +,DI_GS_CCSDS_SET_RATE,OBC,0x0106,1,uint8_t,bps セットパラメータ,,,,,,,,,,,danger,,40M/パラメータ が bps になる.初期値は 0xAD で 230.4 Kbps (微妙に対応していない), +,DI_GS_UART_TLM_ON,OBC,0x0107,0,,,,,,,,,,,,,,,TLM の UART への送出を行う, +,DI_GS_UART_TLM_OFF,OBC,0x0108,0,,,,,,,,,,,,,,,TLM の UART への送出を止める, +**,WDT用コマンド,,,,,,,,,,,,,,,,,,, +,WDT_INIT,OBC,0x0109,0,,,,,,,,,,,,,,,WDT初期化.WDTがアプリイニシャライザを持たなくなったので追加, +,WDT_ENABLE,OBC,0x010A,0,,,,,,,,,,,,,,,WDT有効化, +,WDT_DISABLE,OBC,0x010B,0,,,,,,,,,,,,,,,WDT無効化, +,WDT_STOP_CLEAR,OBC,0x010C,0,,,,,,,,,,,,,danger,,WDTのカウンタクリアを止める=リセット実行, +,WDT_START_CLEAR,OBC,0x010D,0,,,,,,,,,,,,,,,WDTのカウンタクリアを開始する, +**,UART TESTコマンド,,,,,,,,,,,,,,,,,,, +,UART_TEST_INIT_DI,OBC,0x010E,0,,,,,,,,,,,,,,,DI初期化, +,UART_TEST_UPDATE,OBC,0x010F,0,,,,,,,,,,,,,,,DI update, +,UART_TEST_SEND_TEST,OBC,0x0110,1,uint8_t,id,,,,,,,,,,,,,DI send test, +**,,,,,,,,,,,,,,,,,,,, +* POWER,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* COM,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* MISSION,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* PROP,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* AOCS,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* Thermal,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* Trajectory,,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* HILS,HILS用コマンド,,,,,,,,,,,,,,,,,,, +**,,,,,,,,,,,,,,,,,,,, +* Other,汎用コマンド用コマンド,,,,,,,,,,,,,,,,,,, +,UTIL_CMD_ADD,OBC,0x03E0,6,uint8_t,,uint32_t,,uint32_t,,uint32_t,,uint32_t,,uint32_t,,,,汎用コマンドのバッファに指定サイズのデータを入れる, +,UTIL_CMD_SEND,OBC,0x03E1,1,uint8_t,,,,,,,,,,,,,,引数のCHに汎用コマンドのバッファにあるデータを送信する, +,UTIL_CMD_RESET,OBC,0x03E2,0,,,,,,,,,,,,,,,汎用コマンドのバッファをクリアする, +**,汎用カウンタ用コマンド,,,,,,,,,,,,,,,,,,, +*,UTIL_COUNTER_INCREMENT,OBC,,1,uint8_t,,,,,,,,,,,,,,引数の汎用カウンタをインクリメントする, +*,UTIL_COUNTER_RESET,OBC,,1,uint8_t,,,,,,,,,,,,,,引数の汎用カウンタをリセットする.0xffでALL_CLR, +*,UTIL_COUNTER_SET_PARAM,OBC,,3,uint8_t,,uint32_t,,uint8_t,,,,,,,,,,引数の汎用カウンタの閾値・アノマリ発行有無を設定する, +**,,,,,,,,,,,,,,,,,,,, +* NonOrder,これ以下はコマンドIDが自動で割り振られない!,,,,,,,,,,,,,,,,,,, +**,CmdCodeSibGeneratorによって,RTのみ生成,,,,,,,,,,,,,,,,,,, +**,CDH特殊コマンド,,,,,,,,,,,,,,,,,,, +*,OBC_CHECK_SIB_VERSION,OBC,0x05ff,0,,,,,,,,,,,,,,,SI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,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,, diff --git a/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops b/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops new file mode 100644 index 000000000..42c3a83b5 --- /dev/null +++ b/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops @@ -0,0 +1,10 @@ +.# ===== Example ===== +.# +.# コメントは読み飛ばされる +.# +.MOBC_RT.Cmd_NOP + wait_sec 5 + MOBC_RT.Cmd_MM_START_TRANSITION 2 + wait_sec 3 + check_value # check_valueは今は使えず読み飛ばされる +.# diff --git a/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini b/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini new file mode 100644 index 000000000..434c185c3 --- /dev/null +++ b/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini @@ -0,0 +1,4 @@ +[WINGS_COMMAND_SENDER_TO_C2A] +prescaler = 1 +c2a_command_database_file = ../../data/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv +wings_operation_file = ../../data/initialize_files/components/wings_command_sender_to_c2a/example.ops From 340608dd3bea114676f6acae9b435dd2809e91db Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 16:39:16 +0200 Subject: [PATCH 25/34] Revert unnecessary change in this PR --- src/components/real/cdh/on_board_computer_with_c2a.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 5cc4c6804..67b4b44f3 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -46,11 +46,14 @@ ObcWithC2a::~ObcWithC2a() {} void ObcWithC2a::Initialize() { #ifdef USE_C2A - TMGR_init(); // Time Manager Initialize at the beginning in order to measure the execution time of C2A core initialization. + TMGR_init(); // Time Manager + // Initialize at the beginning in order to measure the execution + // time of C2A core initialization. C2A_core_init(); WDT_init(); // Watchdog timer. In SILS, it does not have meaning. - TMGR_clear(); // This called in C2A_core_init, but should be called again just before executing the C2A main loop. + TMGR_clear(); // This called in C2A_core_init, but should be called again + // just before executing the C2A main loop. #endif } From 89ada36857c92a94683234ce4a9be7159bf7d0d3 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Fri, 1 Sep 2023 16:42:52 +0200 Subject: [PATCH 26/34] Revert unnecessary change in this PR --- src/components/real/cdh/on_board_computer_with_c2a.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 67b4b44f3..4085f290e 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -66,7 +66,8 @@ void ObcWithC2a::MainRoutine(const int time_count) { Initialize(); } for (int i = 0; i < timing_regulator_; i++) { - TMGR_count_up_master_clock(); // The update time oc C2A clock should be 1msec + TMGR_count_up_master_clock(); // The update time oc C2A clock should be + // 1msec TDSP_execute_pl_as_task_list(); } #else From 69fe0683a3440593cb7acf4b5e6624b5e9b666a0 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 2 Sep 2023 10:28:30 +0200 Subject: [PATCH 27/34] Add assertion for let commands --- .../components/wings_command_sender_to_c2a/example.ops | 2 ++ .../real/communication/wings_command_sender_to_c2a.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops b/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops index 42c3a83b5..16226c302 100644 --- a/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops +++ b/data/sample/initialize_files/components/wings_command_sender_to_c2a/example.ops @@ -7,4 +7,6 @@ MOBC_RT.Cmd_MM_START_TRANSITION 2 wait_sec 3 check_value # check_valueは今は使えず読み飛ばされる + let mode_id = 2 # letはいまはつかえない + AOBC_RT.Cmd_MM_START_TRANSITION {mode_id} # letを前提とした{}付きの引数があるとコマンドは送信されない .# diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index d9d193344..1120954f5 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -45,11 +45,15 @@ void WingsCommandSenderToC2a::ExecuteCommandLine(const std::string line) { tokens.push_back(token); } + // Handle WINGS commands if (tokens[0].find("wait_sec") == 0) { // wait process wait_s_ = std::stod(tokens[1]); } else if (tokens[0].find("check_value") == 0) { - // TODO + // TODO: Support check_value + wait_s_ = 0; + } else if (tokens[0].find("let") == 0) { + // TODO: Support let command wait_s_ = 0; } else { wait_s_ = 0; @@ -82,6 +86,7 @@ void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector t // Get arguments std::vector arguments; for (size_t i = 1; i < tokens.size(); i++) { + if (tokens[i].find("{") == 0) return; // let command is not supported now TODO: support let command arguments.push_back(tokens[i]); } // Check number of arguments From ed3268859b464bbce4115b5daa8d1a2732e30c67 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 2 Sep 2023 10:29:52 +0200 Subject: [PATCH 28/34] Fix format --- .../real/communication/wings_command_sender_to_c2a.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index 1120954f5..c40da48e0 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -86,7 +86,7 @@ void WingsCommandSenderToC2a::AnalyzeC2aCommand(const std::vector t // Get arguments std::vector arguments; for (size_t i = 1; i < tokens.size(); i++) { - if (tokens[i].find("{") == 0) return; // let command is not supported now TODO: support let command + if (tokens[i].find("{") == 0) return; // let command is not supported now TODO: support let command arguments.push_back(tokens[i]); } // Check number of arguments From 54582e168e59d7f9891d13747bb5dc2ccfb55d88 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Sat, 2 Sep 2023 10:52:37 +0200 Subject: [PATCH 29/34] Add enable flag --- .../wings_command_sender_to_c2a.ini | 1 + .../real/communication/wings_command_sender_to_c2a.cpp | 5 ++++- .../real/communication/wings_command_sender_to_c2a.hpp | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini b/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini index 434c185c3..0d8a2811e 100644 --- a/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini +++ b/data/sample/initialize_files/components/wings_command_sender_to_c2a/wings_command_sender_to_c2a.ini @@ -1,4 +1,5 @@ [WINGS_COMMAND_SENDER_TO_C2A] +command_send_enable = ENABLE prescaler = 1 c2a_command_database_file = ../../data/initialize_files/components/wings_command_sender_to_c2a/SAMPLE_MOBC_CMD_DB_CMD_DB.csv wings_operation_file = ../../data/initialize_files/components/wings_command_sender_to_c2a/example.ops diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index c40da48e0..c10e1f5c2 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -23,6 +23,7 @@ void WingsCommandSenderToC2a::MainRoutine(const int time_count) { UNUSED(time_count); + if (is_enabled_ == false) return; if (is_end_of_line_ == true) return; if (wait_s_ <= 0.0) { std::string line = wings_operation_file_.GetLatestLine(); @@ -130,6 +131,8 @@ WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_genera IniAccess ini_access(initialize_file); std::string section = "WINGS_COMMAND_SENDER_TO_C2A"; + bool is_enabled = ini_access.ReadEnable(section.c_str(), "command_send_enable"); + int prescaler = ini_access.ReadInt(section.c_str(), "prescaler"); if (prescaler <= 1) prescaler = 1; @@ -138,5 +141,5 @@ WingsCommandSenderToC2a InitWingsCommandSenderToC2a(ClockGenerator* clock_genera std::string c2a_command_data_base_file = ini_access.ReadString(section.c_str(), "c2a_command_database_file"); std::string wings_operation_file = ini_access.ReadString(section.c_str(), "wings_operation_file"); - return WingsCommandSenderToC2a(prescaler, clock_generator, step_width_s, c2a_command_data_base_file, wings_operation_file); + return WingsCommandSenderToC2a(prescaler, clock_generator, step_width_s, c2a_command_data_base_file, wings_operation_file, is_enabled); } diff --git a/src/components/real/communication/wings_command_sender_to_c2a.hpp b/src/components/real/communication/wings_command_sender_to_c2a.hpp index 41794be9e..d70964826 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.hpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.hpp @@ -23,10 +23,11 @@ class WingsCommandSenderToC2a : public Component { * @param [in] */ WingsCommandSenderToC2a(int prescaler, ClockGenerator* clock_generator, const double step_width_s, const std::string command_database_file, - const std::string operation_file) + const std::string operation_file, const bool is_enabled) : Component(prescaler, clock_generator), c2a_command_database_(command_database_file), wings_operation_file_(operation_file), + is_enabled_(is_enabled), step_width_s_(step_width_s) {} /** @@ -38,6 +39,7 @@ class WingsCommandSenderToC2a : public Component { protected: C2aCommandDatabase c2a_command_database_; //!< Command database WingsOperationFile wings_operation_file_; //!< WINGS operation file + bool is_enabled_; //!< Enable flag const double step_width_s_; //!< Step width to execute this component [s] double wait_s_ = 0.0; //!< Wait counter [s] bool is_end_of_line_ = false; //!< Flag to detect end of line From db4b6a9d95141c295cf1c60e3c83ac2cccd1e986 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Mon, 4 Sep 2023 19:48:42 +0200 Subject: [PATCH 30/34] Fix to use S2E's endian_memcpy --- .../initialize/c2a_command_database.cpp | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index 9b17db22c..df746a411 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -8,20 +8,9 @@ #include #include #include +#include #include -#ifdef USE_C2A -#if C2A_CORE_VER_MAJOR == 4 -// c2a-core v4 -#include "src_core/library/endian.h" -#elif C2A_CORE_VER_MAJOR <= 3 -// c2a-core <= v3 -#include "src_core/Library/endian.h" -#else -#error "c2a-core version is not supported" -#endif // c2a-core version header -#endif // USE_C2A - C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { if (cmd_db_line.find("*") == 0) return; @@ -99,66 +88,65 @@ C2aCommandDatabase::C2aCommandDatabase(const std::string file_path) { } void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argument_string, uint8_t* param, size_t& size_param) { -#ifdef USE_C2A switch (type) { case C2aArgumentType::kUint8t: { size_param = 1; uint8_t argument = (uint8_t)std::stoul(argument_string); // TODO: 範囲外処理 - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kUint16t: { size_param = 2; uint16_t argument = (uint16_t)std::stoul(argument_string); // TODO: 範囲外処理 - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kUint32t: { size_param = 4; uint32_t argument = (uint32_t)std::stoul(argument_string); // TODO: 範囲外処理 - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kUint64t: { size_param = 8; uint64_t argument = std::stoul(argument_string); - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kInt8t: { size_param = 1; int8_t argument = (int8_t)std::stoi(argument_string); // TODO: 範囲外処理 - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kInt16t: { size_param = 2; int16_t argument = (int16_t)std::stoi(argument_string); // TODO: 範囲外処理 - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kInt32t: { size_param = 4; int32_t argument = std::stoi(argument_string); - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kInt64t: { size_param = 8; int64_t argument = std::stol(argument_string); - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kFloat: { size_param = 4; float argument = std::stof(argument_string); - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kDouble: { size_param = 8; double argument = std::stod(argument_string); - ENDIAN_memcpy(param, &argument, size_param); + endian_memcpy(param, &argument, size_param); break; } case C2aArgumentType::kRaw: { @@ -168,9 +156,4 @@ void DecodeC2aCommandArgument(const C2aArgumentType type, const std::string argu default: break; } -#else - UNUSED(argument_string); - UNUSED(param); - UNUSED(size_param); -#endif } From 0c6773173dc4921dcdb93fc500c4ccf387ded9ec Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Mon, 4 Sep 2023 19:49:28 +0200 Subject: [PATCH 31/34] Fix format --- src/library/initialize/c2a_command_database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index df746a411..d0463307b 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -7,8 +7,8 @@ #include #include -#include #include +#include #include C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { From 6ed998c1174c760df48e0627b337c6183bb0dccd Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Mon, 11 Sep 2023 11:48:01 +0200 Subject: [PATCH 32/34] Add comments to describe used C2A features --- src/components/real/cdh/on_board_computer_with_c2a.cpp | 1 + .../real/communication/wings_command_sender_to_c2a.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/components/real/cdh/on_board_computer_with_c2a.cpp b/src/components/real/cdh/on_board_computer_with_c2a.cpp index 4085f290e..fc577cd9a 100644 --- a/src/components/real/cdh/on_board_computer_with_c2a.cpp +++ b/src/components/real/cdh/on_board_computer_with_c2a.cpp @@ -1,6 +1,7 @@ /* * @file on_board_computer_with_c2a.cpp * @brief Class to emulate on board computer with C2A flight software + * @note Used C2A functions: TMGR_init, C2A_core_init, WDT_init, TMGR_clear, TMGR_count_up_master_clock, TDSP_execute_pl_as_task_list */ #include "on_board_computer_with_c2a.hpp" diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index c10e1f5c2..ec483cc24 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -1,6 +1,8 @@ /* * @file wings_command_sender_to_c2a.cpp * @brief A component to send C2A command using WINGS operation file + * @note Used C2A functions: CCP_register_rtc, CCP_register_tlc + * Used C2A structures: CMD_CODE */ #include "wings_command_sender_to_c2a.hpp" From 9c9369c6dcf55a55106c74f4de6985c1f249eec1 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Wed, 27 Sep 2023 11:27:56 +0200 Subject: [PATCH 33/34] Remove Cmd_ prefix check for v3.9.0 C2A --- src/library/initialize/c2a_command_database.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/library/initialize/c2a_command_database.cpp b/src/library/initialize/c2a_command_database.cpp index d0463307b..cf3f2bb16 100644 --- a/src/library/initialize/c2a_command_database.cpp +++ b/src/library/initialize/c2a_command_database.cpp @@ -23,7 +23,6 @@ C2aCommandInformation::C2aCommandInformation(const std::string cmd_db_line) { } // Command name - if (tokens[1].find("Cmd_") != 0) return; command_name_ = tokens[1]; // Command ID From 46d1cfacbe18cf019d4f8f74976c7690900921a0 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari <19573779+200km@users.noreply.github.com> Date: Thu, 5 Oct 2023 20:14:40 +0200 Subject: [PATCH 34/34] Update src/components/real/communication/wings_command_sender_to_c2a.cpp Co-authored-by: sksat --- .../real/communication/wings_command_sender_to_c2a.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/real/communication/wings_command_sender_to_c2a.cpp b/src/components/real/communication/wings_command_sender_to_c2a.cpp index ec483cc24..b77f72fc3 100644 --- a/src/components/real/communication/wings_command_sender_to_c2a.cpp +++ b/src/components/real/communication/wings_command_sender_to_c2a.cpp @@ -14,7 +14,7 @@ #ifdef USE_C2A #if C2A_CORE_VER_MAJOR == 4 // c2a-core v4 -#include "src_core/TlmCmd/common_cmd_packet_util.h" +#include "src_core/tlm_cmd/common_cmd_packet_util.h" #elif C2A_CORE_VER_MAJOR <= 3 // c2a-core <= v3 #include "src_core/TlmCmd/common_cmd_packet_util.h"