Skip to main content

Go2

Inherits from: Quadruped Go2 quadruped robot.

Inherited methods

  • From Quadruped: setDefaultJointAngles, setDefaultJointVelocities
  • From Robot: cleanup

init

Go2.__init__(network_interface_name: str = 'eth0', low_level_control: bool = False)
Initialize the Go2 quadruped robot. The default network interface is “eth0”, which assumes that the robot is being controller via the onboard computer.
Arguments
network_interface_name (str)
str
name of the network interface, defaults to “eth0”
low_level_control (bool)
bool
whether to use low level control. If False, high level control is used. Defaults to False

addSensor

Go2.addSensor(name: str, sensor: Sensor) -> None
Add an external sensor to the robot. By default, the built-in camera is added as go2_camera.
Arguments
name (str)
str
required
Unique identifier for the sensor
sensor (Sensor)
Sensor
required
Sensor object to add (e.g. Camera, IMU, Lidar)
Returns
Note
None
The sensor will be accessible via self.sensors[name]

getImage

Go2.getImage(camera_name: str = 'go2_camera', image_type: str = '') -> Image | None
Get an image from the specified camera. Note that by default only the rgb go2_camera is available. If external cameras are added, they can be accessed by their name.
Arguments
camera_name (str)
str
name of the camera
image_type (str)
str
supported image types depend on camera, for default go2_camera only “rgb” is supported
Returns
Image
Image | None
requested image

standUp

Go2.standUp() -> None
Make the robot stand up from a lying position.
Returns
returns
None

lieDown

Go2.lieDown() -> None
Make the robot lie down from a standing position.
Returns
returns
None

getState

Go2.getState() -> dict
Get the state (position and orientation) of the go2 as a dictionary.
Returns
dict
dict
Current state of the unitree go2 agent containing: - position (Position): unitree go2 agent’s current position (x,y,z) with respect to the world coordinate - orientation (Orientation): current orientation of the unitree go

getPosition

Go2.getPosition() -> Position | None
Get the current position of the unitree go2 agent with respect to the world coordinate.
Returns
Position
Position | None
unitree go2 agent’s current position (x,y,z) with respect to the world coordinate

getOrientation

Go2.getOrientation() -> Orientation | None
Get the current orientation of the unitree go2 agent in radians.
Returns
Orientation
Orientation | None
current orientation of the unitree go2 agent in radians

moveByVelocity

Go2.moveByVelocity(linear_velocity: Velocity, angular_velocity: Velocity, frame: str = 'body') -> None
Move the agent by velocity (velocity vector is respect to world coordinates). If “always walking” mode is not set on the Go2, the robot will attempt to move to this relative pose instead (i.e. it will move linear x forward, y left, and angular z to yaw). Note: The velocity is only maintained for 1 second, after which the robot will stop moving unless another command is sent. The user can always preemptively send a new command to interrupt the current movement.
Arguments
linear_velocity (Velocity)
Velocity
required
contains x velocity (x_vel), y velocity (y_vel), z_vel is discarded
angular_velocity (Velocity)
Velocity
required
contains yaw to turn by (z_vel), x_vel and y_vel are discarded
frame (str)
str
frame of the velocity vector. Defaults to “body”. “world” is not supported.
Returns
returns
None

setJointAngles

Go2.setJointAngles(joint_position: dict) -> None
Set the position of the robot’s joints when low-level control enabled.
Arguments
joint_position (dict)
dict
required
Dictionary mapping joint names to target positions
Returns
returns
None

setJointVelocities

Go2.setJointVelocities(joint_velocity: dict) -> None
Set the velocity of the robot’s joints when low-level control enabled.
Arguments
joint_velocity (dict)
dict
required
Dictionary mapping joint names to target velocities
Returns
returns
None

setJointTorques

Go2.setJointTorques(joint_torque: dict) -> None
Set the torque of the robot’s joints when low-level control enabled.
Arguments
joint_torque (dict)
dict
required
Dictionary mapping joint names to target torques
Returns
returns
None

getMotorState

Go2.getMotorState()
Get the current state of all motors when low-level control enabled.
Returns
https
//github.com/unitreerobotics/unitree_sdk2_python/blob/3af1610228977f449e22c8fba868bb8516d41ec3/unitree_sdk2py/idl/unitree_go/msg/dds_/MotorState.py

getIMU

Go2.getIMU()
Get the current IMU state when low-level control enabled.

getBatteryState

Go2.getBatteryState()
Get the current battery state when low-level control enabled.

getFootForce

Go2.getFootForce()
Get the current foot force readings when low-level control enabled.

getLowLevelState

Go2.getLowLevelState()
Get the complete low level state.
Returns
https
//github.com/unitreerobotics/unitree_sdk2_python/blob/3af1610228977f449e22c8fba868bb8516d41ec3/unitree_sdk2py/idl/unitree_go/msg/dds_/LowState.py#L34

getJointAngles

Go2.getJointAngles() -> list[float]
No docstring provided.
Returns
returns
list[float]

stop

Go2.stop() -> None
Soft e-stop for the robot. Should stop the robot from moving gracefully. i.e. a quadruped would stop moving.
Returns
returns
None