Skip to content

Commit

Permalink
feat: add startup info printing during initialization (AimRT#107)
Browse files Browse the repository at this point in the history
Include a method to print detailed startup information about the framework, enhancing user awareness of the version and providing relevant links for support.
  • Loading branch information
zhangyi1357 authored Nov 18, 2024
1 parent 1f34013 commit 1f173fd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/runtime/core/aimrt_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ AimRTCore::~AimRTCore() {
hook_task_vec_array_.clear();
}

void AimRTCore::PrintStartupInfo() const {
constexpr const char* aimrt_info = R"(
╔═══════════════════════════════════════════════════════════╗
║ ║
║ █████╗ ██╗███╗ ███╗██████╗ ████████╗ ║
║ ██╔══██╗██║████╗ ████║██╔══██╗╚══██╔══╝ ║
║ ███████║██║██╔████╔██║██████╔╝ ██║ ║
║ ██╔══██║██║██║╚██╔╝██║██╔══██╗ ██║ ║
║ ██║ ██║██║██║ ╚═╝ ██║██║ ██║ ██║ ║
║ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ║
║ ║
║ Modern High Performance Robotics Framework ║
║ Official Website: https://aimrt.org ║
║ Documentation: https://docs.aimrt.org ║
║ Version: v{:<32}║
╚═══════════════════════════════════════════════════════════╝
)";
constexpr const auto* version_str = util::GetAimRTVersion();
AIMRT_INFO(aimrt_info, version_str);
}

void AimRTCore::Initialize(const Options& options) {
EnterState(State::kPreInit);

Expand Down Expand Up @@ -70,6 +91,7 @@ void AimRTCore::Initialize(const Options& options) {
std::bind(&AimRTCore::GetExecutor, this, std::placeholders::_1));
logger_manager_.Initialize(configurator_manager_.GetAimRTOptionsNode("log"));
SetCoreLogger();
PrintStartupInfo();
EnterState(State::kPostInitLog);

// Init allocator
Expand Down
1 change: 1 addition & 0 deletions src/runtime/core/aimrt_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class AimRTCore {
void CheckCfgFile() const;
void StartImpl();
void ShutdownImpl();
void PrintStartupInfo() const;

private:
Options options_;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/core/util/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace aimrt::runtime::core::util {

inline const char* GetAimRTVersion() {
constexpr const char* GetAimRTVersion() {
return AIMRT_VERSION;
}
} // namespace aimrt::runtime::core::util

0 comments on commit 1f173fd

Please sign in to comment.