Add navigation functionality to CustomRobot and Controller classes. Introduced Navigation class for handling mapping and pose navigation commands. Updated CustomRobot to process navigation commands and manage Navigation instance. Enhanced Controller with motion switching capabilities, improving overall robot control and navigation features.

This commit is contained in:
2025-09-20 16:05:10 +08:00
parent 2de8f53ae2
commit 38db96e433
7 changed files with 462 additions and 195 deletions

29
include/navigation.hpp Normal file
View File

@@ -0,0 +1,29 @@
#ifndef NAVIGATION_HPP
#define NAVIGATION_HPP
#include <string>
#include <memory>
#include <nlohmann/json.hpp>
#include "unitree/robot/client/client.hpp"
class Navigation {
public:
Navigation();
~Navigation();
void Init();
bool startMapping();
bool endMapping(const std::string& address);
bool initializePose(double x, double y, double z, double q_x, double q_y, double q_z, double q_w, const std::string& address);
bool poseNavigation(double x, double y, double z, double q_x, double q_y, double q_z, double q_w, int mode, double speed);
bool pauseNavigation();
bool resumeNavigation();
bool closeSlam();
private:
std::unique_ptr<unitree::robot::Client> client_;
bool callSlamService(int api_id, const nlohmann::json& data);
};
#endif // NAVIGATION_HPP