Refactor logging in CustomRobot and main event loop implementation. Removed service logging from CustomRobot::start for cleaner output. Added a continuous event loop in main to keep the program running and allow for future periodic tasks.

This commit is contained in:
2025-09-08 20:11:08 +08:00
parent 99ca9456c0
commit e7bfce9dcb
3 changed files with 12 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
#include <iostream>
#include <memory>
#include <signal.h>
#include <thread>
#include <chrono>
#include "custom_robot.hpp"
#include "logger.hpp"
#include "config.hpp"
@@ -32,6 +34,16 @@ int main(int argc, char** argv) {
LOG_INFO("Robot initialized successfully");
g_robot->start();
// Keep the program running
LOG_INFO("System is running. Press Ctrl+C to stop.");
// Main event loop - wait for signals or other events
while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
// You can add periodic tasks here if needed
}
} catch (const std::exception& e) {
LOG_ERROR("Exception: " + std::string(e.what()));
return 1;