Refactor configuration management by introducing CustomConfig class. Updated config.hpp to streamline settings and removed legacy configuration presets. Adjusted controller and custom_robot classes to utilize the new configuration structure. Enhanced error handling and logging during initialization processes.

This commit is contained in:
2025-09-08 18:16:50 +08:00
parent f72ce9ce58
commit 926d88972d
8 changed files with 188 additions and 556 deletions

View File

@@ -6,6 +6,8 @@
#include <memory>
#include <atomic>
#include <string>
#include <vector>
#include <unitree/robot/go2/robot_state/robot_state_client.hpp>
namespace custom {
@@ -18,6 +20,8 @@ public:
bool initialize();
bool start();
Controller* getController() const { return controller_.get(); }
// Robot state methods
bool GetServiceList(std::vector<unitree::robot::go2::ServiceState>& serviceList);
bool SwitchService(const std::string& serviceName, bool enable);
@@ -25,8 +29,9 @@ public:
private:
std::unique_ptr<Controller> controller_;
std::unique_ptr<unitree::robot::go2::RobotStateClient> stateClient_;
std::unique_ptr<unitree::robot::go2::RobotStateClient> rsc_;
CustomConfig config_;
std::atomic<bool> running_;
std::atomic<bool> initialized_;
};