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

@@ -17,19 +17,19 @@ namespace custom {
class Controller {
public:
explicit Controller(const std::string& networkInterface);
Controller();
~Controller();
bool initialize();
bool start();
bool stop();
void shutdown() { stop(); }
bool isRunning() const { return running_; }
// Sport
bool StandUp();
bool StandDown();
bool Sit();
bool Lie();
bool Damp();
bool RecoveryStand();
bool StopMove();
@@ -47,12 +47,11 @@ public:
private:
std::unique_ptr<unitree::robot::go2::SportClient> sportClient_;
std::unique_ptr<unitree::robot::go2::ObstaclesAvoidClient> obstacleClient_;
std::unique_ptr<unitree::robot::go2::SportClient> sc_;
std::unique_ptr<unitree::robot::go2::ObstaclesAvoidClient> oac_;
std::atomic<bool> running_;
std::atomic<bool> initialized_;
std::string networkInterface_;
};
} // namespace custom