#ifndef GO1_PRO_UNITREE_LEGGED_COMM_H_ #define GO1_PRO_UNITREE_LEGGED_COMM_H_ #include #include namespace UNITREE_LEGGED_SDK { constexpr int HIGHLEVEL = 0xee; constexpr int LOWLEVEL = 0xff; constexpr int TRIGERLEVEL = 0xf0; constexpr double PosStopF = 2.146E+9f; constexpr double VelStopF = 16000.0f; extern const int HIGH_CMD_LENGTH; extern const int HIGH_STATE_LENGTH; extern const int LOW_CMD_LENGTH; extern const int LOW_STATE_LENGTH; #pragma pack(push, 1) struct BmsCmd { uint8_t off; std::array reserve; }; struct BmsState { uint8_t version_h; uint8_t version_l; uint8_t bms_status; uint8_t SOC; int32_t current; uint16_t cycle; std::array BQ_NTC; std::array MCU_NTC; std::array cell_vol; }; struct Cartesian { float x; float y; float z; }; struct IMU { std::array quaternion; std::array gyroscope; std::array accelerometer; std::array rpy; int8_t temperature; }; struct LED { uint8_t r; uint8_t g; uint8_t b; }; struct MotorState { uint8_t mode; float q; float dq; float ddq; float tauEst; float q_raw; float dq_raw; float ddq_raw; int8_t temperature; std::array reserve; }; struct MotorCmd { uint8_t mode; float q; float dq; float tau; float Kp; float Kd; std::array reserve; }; struct LowState { std::array head; uint8_t levelFlag; uint8_t frameReserve; std::array SN; std::array version; uint16_t bandWidth; IMU imu; std::array motorState; BmsState bms; std::array footForce; std::array footForceEst; uint32_t tick; std::array wirelessRemote; uint32_t reserve; uint32_t crc; }; struct LowCmd { std::array head; uint8_t levelFlag; uint8_t frameReserve; std::array SN; std::array version; uint16_t bandWidth; std::array motorCmd; BmsCmd bms; std::array wirelessRemote; uint32_t reserve; uint32_t crc; }; struct HighState { std::array head; uint8_t levelFlag; uint8_t frameReserve; std::array SN; std::array version; uint16_t bandWidth; IMU imu; std::array motorState; BmsState bms; std::array footForce; std::array footForceEst; uint8_t mode; float progress; uint8_t gaitType; float footRaiseHeight; std::array position; float bodyHeight; std::array velocity; float yawSpeed; std::array rangeObstacle; std::array footPosition2Body; std::array footSpeed2Body; std::array wirelessRemote; uint32_t reserve; uint32_t crc; }; struct HighCmd { std::array head; uint8_t levelFlag; uint8_t frameReserve; std::array SN; std::array version; uint16_t bandWidth; uint8_t mode; uint8_t gaitType; uint8_t speedLevel; float footRaiseHeight; float bodyHeight; std::array position; std::array euler; std::array velocity; float yawSpeed; BmsCmd bms; std::array led; std::array wirelessRemote; uint32_t reserve; uint32_t crc; }; #pragma pack(pop) struct UDPState { unsigned long long TotalCount; unsigned long long SendCount; unsigned long long RecvCount; unsigned long long SendError; unsigned long long FlagError; unsigned long long RecvCRCError; unsigned long long RecvLoseError; }; } // namespace UNITREE_LEGGED_SDK #endif