This commit is contained in:
2025-09-24 10:53:28 +08:00
commit f8e4df77fb
856 changed files with 140098 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
#ifndef __UT_ROBOT_GO2_SPORT_API_HPP__
#define __UT_ROBOT_GO2_SPORT_API_HPP__
#include <unitree/common/json/jsonize.hpp>
namespace unitree
{
namespace robot
{
namespace go2
{
/*service name*/
const std::string ROBOT_SPORT_SERVICE_NAME = "sport";
/*api version*/
const std::string ROBOT_SPORT_API_VERSION = "1.0.0.1";
/*api id*/
const int32_t ROBOT_SPORT_API_ID_DAMP = 1001;
const int32_t ROBOT_SPORT_API_ID_BALANCESTAND = 1002;
const int32_t ROBOT_SPORT_API_ID_STOPMOVE = 1003;
const int32_t ROBOT_SPORT_API_ID_STANDUP = 1004;
const int32_t ROBOT_SPORT_API_ID_STANDDOWN = 1005;
const int32_t ROBOT_SPORT_API_ID_RECOVERYSTAND = 1006;
const int32_t ROBOT_SPORT_API_ID_EULER = 1007;
const int32_t ROBOT_SPORT_API_ID_MOVE = 1008;
const int32_t ROBOT_SPORT_API_ID_SIT = 1009;
const int32_t ROBOT_SPORT_API_ID_RISESIT = 1010;
const int32_t ROBOT_SPORT_API_ID_SPEEDLEVEL = 1015;
const int32_t ROBOT_SPORT_API_ID_HELLO = 1016;
const int32_t ROBOT_SPORT_API_ID_STRETCH = 1017;
const int32_t ROBOT_SPORT_API_ID_CONTENT = 1020;
const int32_t ROBOT_SPORT_API_ID_DANCE1 = 1022;
const int32_t ROBOT_SPORT_API_ID_DANCE2 = 1023;
const int32_t ROBOT_SPORT_API_ID_SWITCHJOYSTICK = 1027;
const int32_t ROBOT_SPORT_API_ID_POSE = 1028;
const int32_t ROBOT_SPORT_API_ID_SCRAPE = 1029;
const int32_t ROBOT_SPORT_API_ID_FRONTFLIP = 1030;
const int32_t ROBOT_SPORT_API_ID_FRONTJUMP = 1031;
const int32_t ROBOT_SPORT_API_ID_FRONTPOUNCE = 1032;
const int32_t ROBOT_SPORT_API_ID_HEART = 1036;
const int32_t ROBOT_SPORT_API_ID_STATICWALK = 1061;
const int32_t ROBOT_SPORT_API_ID_TROTRUN = 1062;
const int32_t ROBOT_SPORT_API_ID_ECONOMICGAIT = 1063;
const int32_t ROBOT_SPORT_API_ID_LEFTFLIP = 2041;
const int32_t ROBOT_SPORT_API_ID_BACKFLIP = 2043;
const int32_t ROBOT_SPORT_API_ID_HANDSTAND = 2044;
const int32_t ROBOT_SPORT_API_ID_FREEWALK = 2045;
const int32_t ROBOT_SPORT_API_ID_FREEBOUND = 2046;
const int32_t ROBOT_SPORT_API_ID_FREEJUMP = 2047;
const int32_t ROBOT_SPORT_API_ID_FREEAVOID = 2048;
const int32_t ROBOT_SPORT_API_ID_CLASSICWALK = 2049;
const int32_t ROBOT_SPORT_API_ID_WALKUPRIGHT = 2050;
const int32_t ROBOT_SPORT_API_ID_CROSSSTEP = 2051;
const int32_t ROBOT_SPORT_API_ID_AUTORECOVERY_SET = 2054;
const int32_t ROBOT_SPORT_API_ID_AUTORECOVERY_GET = 2055;
const int32_t ROBOT_SPORT_API_ID_SWITCHAVOIDMODE = 2058;
}
}
}
#endif //__UT_ROBOT_GO2_SPORT_API_HPP__

View File

@@ -0,0 +1,86 @@
#ifndef __UT_ROBOT_GO2_SPORT_CLIENT_HPP__
#define __UT_ROBOT_GO2_SPORT_CLIENT_HPP__
#include <unitree/robot/client/client.hpp>
namespace unitree
{
namespace robot
{
namespace go2
{
/*
* PathPoint
*/
struct stPathPoint
{
float timeFromStart;
float x;
float y;
float yaw;
float vx;
float vy;
float vyaw;
};
typedef struct stPathPoint PathPoint;
/*
* SportClient
*/
class SportClient : public Client
{
public:
explicit SportClient(bool enableLease = false);
~SportClient();
void Init();
int32_t Damp();
int32_t BalanceStand();
int32_t StopMove();
int32_t StandUp();
int32_t StandDown();
int32_t RecoveryStand();
int32_t Euler(float roll, float pitch, float yaw);
int32_t Move(float vx, float vy, float vyaw);
int32_t Sit();
int32_t RiseSit();
int32_t SpeedLevel(int level);
int32_t Hello();
int32_t Stretch();
int32_t SwitchJoystick(bool flag);
int32_t Content();
int32_t Heart();
int32_t Pose(bool flag);
int32_t Scrape();
int32_t FrontFlip();
int32_t FrontJump();
int32_t FrontPounce();
int32_t Dance1();
int32_t Dance2();
int32_t LeftFlip();
int32_t BackFlip();
int32_t HandStand(bool flag);
int32_t FreeWalk();
int32_t FreeBound(bool flag);
int32_t FreeJump(bool flag);
int32_t FreeAvoid(bool flag);
int32_t ClassicWalk(bool flag);
int32_t WalkUpright(bool flag);
int32_t CrossStep(bool flag);
int32_t AutoRecoverSet(bool flag);
int32_t AutoRecoverGet(bool& flag);
int32_t StaticWalk();
int32_t TrotRun();
int32_t EconomicGait();
int32_t SwitchAvoidMode();
};
}
}
}
#endif//__UT_ROBOT_GO2_SPORT_CLIENT_HPP__

View File

@@ -0,0 +1,19 @@
#ifndef __UT_ROBOT_GO2_SPORT_ERROR_HPP__
#define __UT_ROBOT_GO2_SPORT_ERROR_HPP__
#include <unitree/common/decl.hpp>
namespace unitree
{
namespace robot
{
namespace go2
{
UT_DECL_ERR(UT_ROBOT_SPORT_ERR_CLIENT_POINT_PATH, 4101, "point path error.")
UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_OVERTIME, 4201, "server overtime.")
UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_NOT_INIT, 4205, "server function not init.")
}
}
}
#endif//__UT_ROBOT_GO2_SPORT_ERROR_HPP__