diff --git a/include/custom_robot.hpp b/include/custom_robot.hpp index 47c823e..ed31a91 100644 --- a/include/custom_robot.hpp +++ b/include/custom_robot.hpp @@ -6,6 +6,7 @@ #include "mqtt.hpp" #include "navigation.hpp" #include "recharge.hpp" +#include "monitor.hpp" // #include "low_controller.hpp" #include @@ -59,6 +60,7 @@ private: std::unique_ptr rsc_; std::unique_ptr mqttClient_; std::unique_ptr recharge_; + std::unique_ptr monitor_; CustomConfig config_; std::atomic running_; diff --git a/src/custom_robot.cpp b/src/custom_robot.cpp index 6961330..50e6910 100644 --- a/src/custom_robot.cpp +++ b/src/custom_robot.cpp @@ -66,6 +66,10 @@ CustomRobot::~CustomRobot() { recharge_.reset(); } + if (monitor_) { + monitor_.reset(); + } + try { unitree::robot::ChannelFactory::Instance()->Release(); LOG_INFO("ChannelFactory released"); @@ -94,6 +98,9 @@ bool CustomRobot::initialize() { recharge_ = std::make_unique(); recharge_->Init(); + monitor_ = std::make_unique(); + monitor_->initialize(); + if (!initializeMqtt()) { LOG_ERROR("Failed to initialize MQTT client"); return false;