0% found this document useful (0 votes)
273 views10 pages

Go1 Unitree Legged SDK Manual

The document provides documentation for a robotics SDK. It describes how to use the SDK to control a robot, including establishing communication, dependencies, building and running examples. It also covers using the SDK for communication between computers via UDP and LCM.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views10 pages

Go1 Unitree Legged SDK Manual

The document provides documentation for a robotics SDK. It describes how to use the SDK to control a robot, including establishing communication, dependencies, building and running examples. It also covers using the SDK for communication between computers via UDP and LCM.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

unitree_legged_sdk manual.

md 2021/12/4

unitree_legged_sdk manual

2021.12.4

1 / 10
unitree_legged_sdk manual.md 2021/12/4

Go1 SDK guide manual v3.4


Guide manual update log
1. Introduction
1.1 Usage of control robot
1.1.1 Communication
1.1.2 Dependencies
1.1.3 Build
1.1.4 Run
1.2 Other Usage
1.2.1 Communication between PCs with UDP
1.2.2 Communication between PCs with LCM and UDP
1.3 File System
2. Header file
2.1 comm.h
2.2 udp.h
2.3 lcm.h
3. Examples
3.1 Low-level control examples of robot
3.2 High-level control examples of robot
3.3 Communication examples of robot

2 / 10
unitree_legged_sdk manual.md 2021/12/4

1. Introduction
The unitree_legged_sdk is mainly used for communication between PC (with Linux system) and Controller
board.

It also can be used in other PCs with UDP.

notics: support robot: Go1, not support robot: Laikago, Aliengo, A1. (Check release v3.2 for support)

1.1 Usage of control robot

There are four steps that use this software development kit (SDK) to control robot.

Communication

Dependencies

Build

Run

1.1.1 Communication

Establish communication between PC and Controller board.

If you‘re using the PC(Raspberry in the red box below) on Go1, you can skip this section, but this is not
recommended.

Use own PC(with Ubuntu system) USB port to connect Go1's Ethernet port.

3 / 10
unitree_legged_sdk manual.md 2021/12/4

USB to Ethernet

User PC Go1

Then open terminal and execute following commands:

# Run this command after you plug in the USB hub,


# you can find an extra device ID. For example, enpxxx
ifconfig

sudo ifconfig enpxxx down # enpxxx is your PC usb port


sudo ifconfig enpxxx 192.168.123.162/24
sudo ifconfig enpxxx up
ping 192.168.123.161

if you can recive message like "64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=xxx ms", you are
connected.

Use own PC(with Ubuntu system) Ethernet port to connect Go1's Ethernet port.

4 / 10
unitree_legged_sdk manual.md 2021/12/4

Ethernet cable

Go1 User PC

Then open terminal and execute following command:

sudo ifconfig eth0 down # eth0 is your PC Ethernet port


sudo ifconfig eth0 192.168.123.162/24
sudo ifconfig eth0 up
ping 192.168.123.161

if you can recive message like "64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=xxx ms", you are
connected.

1.1.2 Dependencies

If you‘re using the PC on Go1, you can skip this section.

Boost (version 1.5.4 or higher)


CMake (version 2.8.3 or higher)
LCM (version 1.4.0 or higher)

# Download LCM package, then:


cd lcm-x.x.x
mkdir build
cd build
cmake ../
make
sudo make install

1.1.3 Build

Open the terminal in the unitree_legged_sdk folder and execute following command.

5 / 10
unitree_legged_sdk manual.md 2021/12/4

mkdir build
cd build
cmake ../
make

1.1.4 Run

Open the terminal to run the binary file in the "build/bin" folder.

high-level example can be run directly, for example:

# Run examples with 'sudo' for memory locking.


# WARNING: Make sure the robot is in Sport mode.
sudo ./example_walk

Before running the low-level examples, please switch Go1's control mode to Basic mode using wireless
handle.

# WARNING: Make sure the robot is hung up and in Basic mode.


sudo ./example_postion

1.2 Other Usage

1.2.1 Communication between PCs with UDP

Connect two computers with a network cable (or USB to Ethernet hub), and set the PC's Ethernet IP address as
below.

Then open the terminal on different PC to run the binary file in the "build/bin" folder.

6 / 10
unitree_legged_sdk manual.md 2021/12/4

# UDP Client
sudo ./udp_send_test

# UDP Server
sudo ./udp_recv_test

1.2.2 Communication between PCs with LCM and UDP

Connect two computers with a network cable (or USB to Ethernet hub), and set the PC's Ethernet IP address as
below.

Then open the terminal and run the binary file in the "build/bin" folder.

# Warnning: Make sure robot in Sport mode


sudo ./lcm_server HIGHLEVEL

# Warnning: Make sure robot in Basic mode


sudo ./lcm_server LOWLEVEL

1.3 File System

The files in "include/unitree_legged_sdk/" defines constant, variable, class, API functions, etc.

include/unitree_legged_sdk/ description

7 / 10
unitree_legged_sdk manual.md 2021/12/4

include/unitree_legged_sdk/ description

a1_const.h aliengo_const.h
Defines the limits of the robot's 12 joint motors
go1_const.h

quadruped.h Defines robot type, control level type, leg nunber and joint number

unitree_joystick.h Defines key and joystick variable data type

defines common class, such as LowState, LowCmd, HighState and


comm.h
HighCmd class, to store user command or robot sates data

safety.h Defines Safety class, keep the robot in a safe environment

Defines UDP class, user can communication between PC and Controller


udp.h
board through UDP object, it also can be used in other PCs

Defines LCM class, user can send command and receive robot states data
lcm.h
on one PC through LCM object

Defines Lcm_Server_Low class and Lcm_Server_High class, except


lcm_server.h communication through UDP object, user can also communication
through LCM object

Defines LoopFunc class, users can generate different threads for different
loop.h
objects through LoopFunc object

unitree_legged_sdk.h Included all of the above header files

A "build/bin/" folder will be added to the file system after "1.1.3 Build" section, which contains executables
files generated by examples in the "example/" folder.

examples/ description notics

Example of low-level position control of robot, the calf of right Basic


example_position.cpp
front leg will flapping mode

Example of low-level torque control of robot, the thigh joint of


Basic
example_torque.cpp right front leg will move to zero position and be in impedance
mode
control state

Example of low-level velocity control of robot, the calf of right Basic


example_velocity.cpp
front leg will flapping mode

Example of high-level control of robot, the robot will do a series Sport


example_walk.cpp
of movements mode

Example of wireless handle communication, joystick data will be Basic


example_wirelessHandle.cpp
printed on the screen When key A is pressed mode

Example of LCM communication server, contains low-level and


lcm_server.cpp
high-level communication

Example of UDP communication server, running


multi_pc_udp_recv.cpp
client(multi_pc_udp_send.cpp) on the another PC
8 / 10
unitree_legged_sdk manual.md 2021/12/4

examples/ description notics

Example of UDP communication client, running


multi_pc_udp_send.cpp
server(multi_pc_udp_send.cpp) on another PC.

2. Header file
More detailed about some of the "unitree_legged_sdk" header files.

2.1 comm.h

This file is a part of Unitree robots software development kits(unitree_legged_sdk), defines common class,
such as LowState, LowCmd, HighState and HighCmd class, to store user command or robot sates data.

Refer to this link for more information.

2.2 udp.h

This file is a part of Unitree robots software development kits(unitree_legged_sdk), defines UDP class, user can
communication between PC and Controller board through UDP object, it also can be used in other PCs. refer
to Section 3.3.1 for detailed usage

Refer to this link for more information.

2.3 lcm.h

Defines LCM class, user can send command and receive robot states data on one PC through LCM object,
refer to Section 3.3.2 for detailed usage

Refer to this link for more information.

3. Examples
3.1 Low-level control examples of robot

example_position.cpp、example_velocity.cpp and example_torque.cpp examples is running on Basic mode of


robot.

Refer to example_position、example_velocity、example_torque for more information.

3.2 High-level control examples of robot

example_walk.cpp is running on Sport mode of robot.

Refer to this link for more information.

3.3 Communication examples of robot

multi_pc_udp_send.cpp、 multi_pc_udp_recv.cpp is running on different PC.

Refer to multi_pc_udp_send、multi_pc_udp_recv for more information.

9 / 10
unitree_legged_sdk manual.md 2021/12/4

lcm_server.cpp

Refer to this link for more information.

10 / 10

You might also like