diff --git a/README.md b/README.md index c6854ef..841e3d1 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ -# v3.4 +# v3.4.2 The unitree_legged_sdk is mainly used for communication between PC and Controller board. It also can be used in other PCs with UDP. ### Notice support robot: Go1 -not support robot: Laikago, Aliengo, A1. (Check release [v3.2](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.2) for support) +not support robot: Laikago, Aliengo, A1. (Check release [v3.3.1](https://github.com/unitreerobotics/unitree_legged_sdk/releases/tag/v3.3.1) for support) + +### Sport Mode +Legged_sport >= v1.32 ### Dependencies * [Boost](http://www.boost.org) (version 1.5.4 or higher) diff --git a/examples/example_walk.cpp b/examples/example_walk.cpp index 4b74430..4efbedf 100644 --- a/examples/example_walk.cpp +++ b/examples/example_walk.cpp @@ -14,7 +14,7 @@ class Custom { public: Custom(uint8_t level): - safe(LeggedType::A1), + safe(LeggedType::Go1), udp(8090, "192.168.123.161", 8082, sizeof(HighCmd), sizeof(HighState)) { udp.InitCmdData(cmd); diff --git a/examples/example_wirelessHandle.cpp b/examples/example_wirelessHandle.cpp index 52ef087..0e4069c 100644 --- a/examples/example_wirelessHandle.cpp +++ b/examples/example_wirelessHandle.cpp @@ -14,7 +14,7 @@ using namespace UNITREE_LEGGED_SDK; class Custom { public: - Custom(uint8_t level): safe(LeggedType::A1), udp(level){ + Custom(uint8_t level): safe(LeggedType::Go1), udp(level){ udp.InitCmdData(cmd); } void UDPSend(); diff --git a/include/unitree_legged_sdk/comm.h b/include/unitree_legged_sdk/comm.h index 0d79063..4f662b6 100644 --- a/include/unitree_legged_sdk/comm.h +++ b/include/unitree_legged_sdk/comm.h @@ -128,21 +128,22 @@ namespace UNITREE_LEGGED_SDK uint16_t robotID; uint32_t SN; uint8_t bandWidth; + IMU imu; + MotorState motorState[20]; + BmsState bms; + int16_t footForce[4]; + int16_t footForceEst[4]; uint8_t mode; float progress; - IMU imu; - uint8_t gaitType; // 0.idle 1.trot 2.trot running 3.climb stair + uint8_t gaitType; // 0.idle 1.trot 2.trot running 3.climb stair 4.trot obstacle float footRaiseHeight; // (unit: m, default: 0.08m), foot up height while walking float position[3]; // (unit: m), from own odometry in inertial frame, usually drift float bodyHeight; // (unit: m, default: 0.28m), float velocity[3]; // (unit: m/s), forwardSpeed, sideSpeed, rotateSpeed in body frame float yawSpeed; // (unit: rad/s), rotateSpeed in body frame + float rangeObstacle[4]; Cartesian footPosition2Body[4]; // foot position relative to body Cartesian footSpeed2Body[4]; // foot speed relative to body - int8_t temperature[20]; - BmsState bms; - int16_t footForce[4]; - int16_t footForceEst[4]; uint8_t wirelessRemote[40]; uint32_t reserve; uint32_t crc; @@ -168,7 +169,6 @@ namespace UNITREE_LEGGED_SDK // 11. straightHand // 12. dance1 // 13. dance2 - // 14. two leg stand uint8_t gaitType; // 0.idle 1.trot 2.trot running 3.climb stair uint8_t speedLevel; // 0. default low speed. 1. medium speed 2. high speed. during walking, only respond MODE 3 diff --git a/include/unitree_legged_sdk/loop.h b/include/unitree_legged_sdk/loop.h index e36938c..b8e1d4c 100644 --- a/include/unitree_legged_sdk/loop.h +++ b/include/unitree_legged_sdk/loop.h @@ -17,7 +17,7 @@ namespace UNITREE_LEGGED_SDK { -constexpr int THREAD_PRIORITY = 99; // real-time priority +constexpr int THREAD_PRIORITY = 95; // real-time priority typedef boost::function Callback; @@ -40,6 +40,10 @@ class Loop { std::thread _thread; }; +/* + period unit:second + bindCPU change the CPU affinity of this thread +*/ class LoopFunc : public Loop { public: LoopFunc(std::string name, float period, const Callback& _cb) diff --git a/include/unitree_legged_sdk/udp.h b/include/unitree_legged_sdk/udp.h index f8fdde1..7b2423e 100644 --- a/include/unitree_legged_sdk/udp.h +++ b/include/unitree_legged_sdk/udp.h @@ -49,8 +49,8 @@ namespace UNITREE_LEGGED_SDK int sendLength, int recvLength, bool initiativeDisconnect = false, RecvEnum recvType = RecvEnum::nonBlock, bool setIpPort = false); ~UDP(); - void SetIpPort(const char* targetIP, uint16_t targetPort); // if not indicated at constructor function - void SetRecvTimeout(int time); // use in RecvEnum::blockTimeout (unit: ms) + void SetIpPort(const char* targetIP, uint16_t targetPort); // if not indicated at constructor function + void SetRecvTimeout(int time); // use in RecvEnum::blockTimeout (unit: ms) void SetDisconnectTime(float callback_dt, float disconnectTime); // initiativeDisconnect = true, disconnect for another IP to connect void SetAccessibleTime(float callback_dt, float accessibleTime); // check if can access data diff --git a/include/unitree_legged_sdk/unitree_joystick.h b/include/unitree_legged_sdk/unitree_joystick.h index 8ea87c0..25fe707 100755 --- a/include/unitree_legged_sdk/unitree_joystick.h +++ b/include/unitree_legged_sdk/unitree_joystick.h @@ -1,6 +1,7 @@ /***************************************************************** Copyright (c) 2020, Unitree Robotics.Co.Ltd. All rights reserved. *****************************************************************/ + #ifndef UNITREE_JOYSTICK_H #define UNITREE_JOYSTICK_H diff --git a/include/unitree_legged_sdk/unitree_legged_sdk.h b/include/unitree_legged_sdk/unitree_legged_sdk.h index a93a6c1..613b939 100644 --- a/include/unitree_legged_sdk/unitree_legged_sdk.h +++ b/include/unitree_legged_sdk/unitree_legged_sdk.h @@ -1,7 +1,6 @@ -/************************************************************************ -Copyright (c) 2020, Unitree Robotics.Co.Ltd. All rights reserved. -Use of this source code is governed by the MPL-2.0 license, see LICENSE. -************************************************************************/ +/***************************************************************** + Copyright (c) 2020, Unitree Robotics.Co.Ltd. All rights reserved. +******************************************************************/ #ifndef _UNITREE_LEGGED_SDK_H_ #define _UNITREE_LEGGED_SDK_H_ diff --git a/lib/libunitree_legged_sdk_amd64.so b/lib/libunitree_legged_sdk_amd64.so index 6bd87ca..db01d5e 100755 Binary files a/lib/libunitree_legged_sdk_amd64.so and b/lib/libunitree_legged_sdk_amd64.so differ diff --git a/lib/libunitree_legged_sdk_arm64.so b/lib/libunitree_legged_sdk_arm64.so index caf4b58..8c03d3e 100644 Binary files a/lib/libunitree_legged_sdk_arm64.so and b/lib/libunitree_legged_sdk_arm64.so differ