#pragma once #include #include #include #include #include #include #include #include #include #include #include "logger.hpp" namespace custom { class Controller { public: Controller(); ~Controller(); bool initialize(); bool start(); bool stop(); void shutdown() { stop(); } bool isRunning() const { return running_; } // Sport bool StandUp(); bool StandDown(); bool Sit(); bool Damp(); bool RecoveryStand(); bool StopMove(); bool BalanceStand(); bool Euler(float roll, float pitch, float yaw); bool Move(float vx, float vy, float vyaw); bool RiseSit(); bool SpeedLevel(int level); bool Hello(); bool Stretch(); bool SwitchJoystick(bool flag); bool Heart(); bool Pose(bool flag); bool Scrape(); bool FrontFlip(); bool FrontJump(); bool FrontPounce(); bool Dance1(); bool Dance2(); bool TrajectoryFollow(const std::vector>& path); bool FootRaiseHeight(float height); // Obstacle bool SwitchSet(bool enable); bool SwitchGet(bool& enable); bool UseRemoteCommandFromApi(bool isRemoteCommandsFromApi); bool MoveToAbsolutePosition(float x, float y, float yaw); bool MoveToIncrementPosition(float x, float y, float yaw); // MotionSwitcher bool CheckMode(std::string& form, std::string& name); bool SelectMode(const std::string& nameOrAlias); bool ReleaseMode(); private: template bool ExecuteSportCmd(Func&& func); template bool ExecuteObstacleCmd(Func&& func); template bool ExecuteMotionSwitchCmd(Func&& func); std::unique_ptr sc_; std::unique_ptr oac_; std::unique_ptr msc_; std::atomic running_; std::atomic initialized_; }; } // namespace custom