> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Go2

## Go2

Inherits from: [`Quadruped`](/robot-api/reference/base/robot/quadruped/Quadruped)

Go2 quadruped robot.

### Inherited methods

* From [`Quadruped`](/robot-api/reference/base/robot/quadruped/Quadruped): `setDefaultJointAngles`, `setDefaultJointVelocities`
* From [`Robot`](/robot-api/reference/base/robot/robot/Robot): `cleanup`

### **init**

```python theme={null}
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.

<ResponseField name="Arguments">
  <ParamField query="network_interface_name (str)" type="str">
    name of the network interface, defaults to "eth0"
  </ParamField>

  <ParamField query="low_level_control (bool)" type="bool">
    whether to use low level control. If False, high level control is used. Defaults to False
  </ParamField>
</ResponseField>

### addSensor

```python theme={null}
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`.

<ResponseField name="Arguments">
  <ParamField query="name (str)" type="str" required>
    Unique identifier for the sensor
  </ParamField>

  <ParamField query="sensor (Sensor)" type="Sensor" required>
    Sensor object to add (e.g. Camera, IMU, Lidar)
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Note" type="None">
    The sensor will be accessible via self.sensors\[name]
  </ResponseField>
</ResponseField>

### getImage

```python theme={null}
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.

<ResponseField name="Arguments">
  <ParamField query="camera_name (str)" type="str">
    name of the camera
  </ParamField>

  <ParamField query="image_type (str)" type="str">
    supported image types depend on camera, for default `go2_camera` only "rgb" is supported
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="Image" type="Image | None">
    requested image
  </ResponseField>
</ResponseField>

### standUp

```python theme={null}
Go2.standUp() -> None
```

Make the robot stand up from a lying position.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### lieDown

```python theme={null}
Go2.lieDown() -> None
```

Make the robot lie down from a standing position.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### getState

```python theme={null}
Go2.getState() -> dict
```

Get the state (position and orientation) of the go2 as a dictionary.

<ResponseField name="Returns">
  <ResponseField name="dict" type="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
  </ResponseField>
</ResponseField>

### getPosition

```python theme={null}
Go2.getPosition() -> Position | None
```

Get the current position of the unitree go2 agent with respect to the world coordinate.

<ResponseField name="Returns">
  <ResponseField name="Position" type="Position | None">
    unitree go2 agent's current position (x,y,z) with respect to the world coordinate
  </ResponseField>
</ResponseField>

### getOrientation

```python theme={null}
Go2.getOrientation() -> Orientation | None
```

Get the current orientation of the unitree go2 agent in radians.

<ResponseField name="Returns">
  <ResponseField name="Orientation" type="Orientation | None">
    current orientation of the unitree go2 agent in radians
  </ResponseField>
</ResponseField>

### moveByVelocity

```python theme={null}
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.

<ResponseField name="Arguments">
  <ParamField query="linear_velocity (Velocity)" type="Velocity" required>
    contains x velocity (x\_vel), y velocity (y\_vel), z\_vel is discarded
  </ParamField>

  <ParamField query="angular_velocity (Velocity)" type="Velocity" required>
    contains yaw to turn by (z\_vel), x\_vel and y\_vel are discarded
  </ParamField>

  <ParamField query="frame (str)" type="str">
    frame of the velocity vector. Defaults to "body". "world" is not supported.
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### setJointAngles

```python theme={null}
Go2.setJointAngles(joint_position: dict) -> None
```

Set the position of the robot's joints when low-level control enabled.

<ResponseField name="Arguments">
  <ParamField query="joint_position (dict)" type="dict" required>
    Dictionary mapping joint names to target positions
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### setJointVelocities

```python theme={null}
Go2.setJointVelocities(joint_velocity: dict) -> None
```

Set the velocity of the robot's joints when low-level control enabled.

<ResponseField name="Arguments">
  <ParamField query="joint_velocity (dict)" type="dict" required>
    Dictionary mapping joint names to target velocities
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### setJointTorques

```python theme={null}
Go2.setJointTorques(joint_torque: dict) -> None
```

Set the torque of the robot's joints when low-level control enabled.

<ResponseField name="Arguments">
  <ParamField query="joint_torque (dict)" type="dict" required>
    Dictionary mapping joint names to target torques
  </ParamField>
</ResponseField>

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>

### getMotorState

```python theme={null}
Go2.getMotorState()
```

Get the current state of all motors when low-level control enabled.

<ResponseField name="Returns">
  <ResponseField name="https" type="">
    //github.com/unitreerobotics/unitree\_sdk2\_python/blob/3af1610228977f449e22c8fba868bb8516d41ec3/unitree\_sdk2py/idl/unitree\_go/msg/dds\_/*MotorState*.py
  </ResponseField>
</ResponseField>

### getIMU

```python theme={null}
Go2.getIMU()
```

Get the current IMU state when low-level control enabled.

### getBatteryState

```python theme={null}
Go2.getBatteryState()
```

Get the current battery state when low-level control enabled.

### getFootForce

```python theme={null}
Go2.getFootForce()
```

Get the current foot force readings when low-level control enabled.

### getLowLevelState

```python theme={null}
Go2.getLowLevelState()
```

Get the complete low level state.

<ResponseField name="Returns">
  <ResponseField name="https" type="">
    //github.com/unitreerobotics/unitree\_sdk2\_python/blob/3af1610228977f449e22c8fba868bb8516d41ec3/unitree\_sdk2py/idl/unitree\_go/msg/dds\_/*LowState*.py#L34
  </ResponseField>
</ResponseField>

### getJointAngles

```python theme={null}
Go2.getJointAngles() -> list[float]
```

*No docstring provided.*

<ResponseField name="Returns">
  <ResponseField name="returns" type="list[float]" />
</ResponseField>

### stop

```python theme={null}
Go2.stop() -> None
```

Soft e-stop for the robot. Should stop the robot from moving gracefully.

i.e. a quadruped would stop moving.

<ResponseField name="Returns">
  <ResponseField name="returns" type="None" />
</ResponseField>
