From de6e080dca112420114b152f4533e95db74ff174 Mon Sep 17 00:00:00 2001 From: Sucan126 <632190820@qq.com> Date: Mon, 22 Sep 2025 15:25:42 +0800 Subject: [PATCH] Revert "refactor(controller): Remove unused motion control methods" This reverts commit bd023eaba3d80cab0895465f41deeb18054d6571. --- include/controller.hpp | 16 +++++++ src/controller.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/include/controller.hpp b/include/controller.hpp index c80bf4b..b9a24e3 100644 --- a/include/controller.hpp +++ b/include/controller.hpp @@ -43,6 +43,7 @@ public: bool Hello(); bool Stretch(); bool SwitchJoystick(bool flag); + bool Content(); bool Heart(); bool Pose(bool flag); bool Scrape(); @@ -51,6 +52,21 @@ public: bool FrontPounce(); bool Dance1(); bool Dance2(); + bool LeftFlip(); + bool BackFlip(); + bool HandStand(bool flag); + bool FreeWalk(); + bool FreeBound(bool flag); + bool FreeJump(bool flag); + bool FreeAvoid(bool flag); + bool ClassicWalk(bool flag); + bool WalkUpright(bool flag); + bool CrossStep(bool flag); + bool AutoRecoverSet(bool flag); + bool StaticWalk(); + bool TrotRun(); + bool EconomicGait(); + bool SwitchAvoidMode(); bool TrajectoryFollow(const std::vector>& path); bool FootRaiseHeight(float height); diff --git a/src/controller.cpp b/src/controller.cpp index d7cbb43..336bc3d 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -231,6 +231,12 @@ bool Controller::SwitchJoystick(bool flag) { }); } +bool Controller::Content() { + return ExecuteSportCmd([](auto* sc) { + return sc->Content(); + }); +} + bool Controller::Heart() { return ExecuteSportCmd([](auto* sc) { return sc->Heart(); @@ -279,6 +285,96 @@ bool Controller::Dance2() { }); } +bool Controller::LeftFlip() { + return ExecuteSportCmd([](auto* sc) { + return sc->LeftFlip(); + }); +} + +bool Controller::BackFlip() { + return ExecuteSportCmd([](auto* sc) { + return sc->BackFlip(); + }); +} + +bool Controller::HandStand(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->HandStand(flag); + }); +} + +bool Controller::FreeWalk() { + return ExecuteSportCmd([](auto* sc) { + return sc->FreeWalk(); + }); +} + +bool Controller::FreeBound(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->FreeBound(flag); + }); +} + +bool Controller::FreeJump(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->FreeJump(flag); + }); +} + +bool Controller::FreeAvoid(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->FreeAvoid(flag); + }); +} + +bool Controller::ClassicWalk(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->ClassicWalk(flag); + }); +} + +bool Controller::WalkUpright(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->WalkUpright(flag); + }); +} + +bool Controller::CrossStep(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->CrossStep(flag); + }); +} + +bool Controller::AutoRecoverSet(bool flag) { + return ExecuteSportCmd([flag](auto* sc) { + return sc->AutoRecoverSet(flag); + }); +} + +bool Controller::StaticWalk() { + return ExecuteSportCmd([](auto* sc) { + return sc->StaticWalk(); + }); +} + +bool Controller::TrotRun() { + return ExecuteSportCmd([](auto* sc) { + return sc->TrotRun(); + }); +} + +bool Controller::EconomicGait() { + return ExecuteSportCmd([](auto* sc) { + return sc->EconomicGait(); + }); +} + +bool Controller::SwitchAvoidMode() { + return ExecuteSportCmd([](auto* sc) { + return sc->SwitchAvoidMode(); + }); +} + bool Controller::TrajectoryFollow(const std::vector>& path) { // This function requires special handling as it needs to convert the path format // For now, we'll provide a basic implementation