Skip to content

Commit

Permalink
HighState add MotorState
Browse files Browse the repository at this point in the history
  • Loading branch information
TrivasZhang committed Nov 25, 2021
1 parent 2c8b7c8 commit b5d6db2
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 18 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/example_walk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/example_wirelessHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 7 additions & 7 deletions include/unitree_legged_sdk/comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion include/unitree_legged_sdk/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void ()> Callback;

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions include/unitree_legged_sdk/udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/unitree_legged_sdk/unitree_joystick.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*****************************************************************
Copyright (c) 2020, Unitree Robotics.Co.Ltd. All rights reserved.
*****************************************************************/

#ifndef UNITREE_JOYSTICK_H
#define UNITREE_JOYSTICK_H

Expand Down
7 changes: 3 additions & 4 deletions include/unitree_legged_sdk/unitree_legged_sdk.h
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
Binary file modified lib/libunitree_legged_sdk_amd64.so
Binary file not shown.
Binary file modified lib/libunitree_legged_sdk_arm64.so
Binary file not shown.

0 comments on commit b5d6db2

Please sign in to comment.