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:
12
src/main.cpp
12
src/main.cpp
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user