refactor(controller): Remove unused motion control methods and update CMake configuration
- Removed several unused methods from the Controller class, including HandStand, ClassicWalk, AutoRecoverSet, StaticWalk, TrotRun, EconomicGait, and SwitchAvoidMode. - Updated CMakeLists.txt to remove the hardcoded include path for unitree SDK, streamlining the include directories for the main target.
This commit is contained in:
@@ -23,7 +23,6 @@ message(STATUS "Found unitree_sdk2 in: ${unitree_sdk2_DIR}")
|
||||
# Include directories
|
||||
include_directories(
|
||||
include
|
||||
/usr/local/include/unitree/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/nlohmann
|
||||
$<$<NOT:$<BOOL:${PahoMqttC_FOUND}>>:${PAHO_MQTT_C_INCLUDE_DIR}>
|
||||
@@ -42,8 +41,6 @@ set(SOURCES
|
||||
|
||||
add_executable(main ${SOURCES})
|
||||
|
||||
target_include_directories(main PRIVATE /usr/local/include)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(main
|
||||
PRIVATE
|
||||
|
||||
@@ -54,19 +54,12 @@ public:
|
||||
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<std::array<float, 6>>& path);
|
||||
bool FootRaiseHeight(float height);
|
||||
|
||||
|
||||
@@ -297,12 +297,6 @@ bool Controller::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();
|
||||
@@ -327,12 +321,6 @@ bool Controller::FreeAvoid(bool 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);
|
||||
@@ -345,36 +333,6 @@ bool Controller::CrossStep(bool 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<std::array<float, 6>>& path) {
|
||||
// This function requires special handling as it needs to convert the path format
|
||||
// For now, we'll provide a basic implementation
|
||||
|
||||
@@ -587,8 +587,6 @@ bool CustomRobot::processSportCmd(const std::string& cmd, const nlohmann::json&
|
||||
return controller_->LeftFlip();
|
||||
} else if (cmd == "BackFlip") {
|
||||
return controller_->BackFlip();
|
||||
} else if (cmd == "HandStand") {
|
||||
return controller_->HandStand(message["param"]["flag"]);
|
||||
} else if (cmd == "FreeWalk") {
|
||||
return controller_->FreeWalk();
|
||||
} else if (cmd == "FreeBound") {
|
||||
@@ -597,22 +595,10 @@ bool CustomRobot::processSportCmd(const std::string& cmd, const nlohmann::json&
|
||||
return controller_->FreeJump(message["param"]["flag"]);
|
||||
} else if (cmd == "FreeAvoid") {
|
||||
return controller_->FreeAvoid(message["param"]["flag"]);
|
||||
} else if (cmd == "ClassicWalk") {
|
||||
return controller_->ClassicWalk(message["param"]["flag"]);
|
||||
} else if (cmd == "WalkUpright") {
|
||||
return controller_->WalkUpright(message["param"]["flag"]);
|
||||
} else if (cmd == "CrossStep") {
|
||||
return controller_->CrossStep(message["param"]["flag"]);
|
||||
} else if (cmd == "AutoRecoverSet") {
|
||||
return controller_->AutoRecoverSet(message["param"]["flag"]);
|
||||
} else if (cmd == "StaticWalk") {
|
||||
return controller_->StaticWalk();
|
||||
} else if (cmd == "TrotRun") {
|
||||
return controller_->TrotRun();
|
||||
} else if (cmd == "EconomicGait") {
|
||||
return controller_->EconomicGait();
|
||||
} else if (cmd == "SwitchAvoidMode") {
|
||||
return controller_->SwitchAvoidMode();
|
||||
} else if (cmd == "TrajectoryFollow") {
|
||||
return controller_->TrajectoryFollow(message["param"]["path"]);
|
||||
} else if (cmd == "FootRaiseHeight") {
|
||||
|
||||
Reference in New Issue
Block a user