> ## 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.

# LeggedClient

## \_\_init\_\_

<ResponseField name="LeggedClient.__init__(ip=&#x22;&#x22;, port=41481, timeout_value=3600)">
  Initializes a quadruped / legged client connection.

  <ResponseField name="Arguments">
    <ParamField query="ip" type="str, optional">
      IP address of the server, defaults to localhost.
    </ParamField>

    <ParamField query="port" type="int, optional">
      Port number of the legged RPC server, defaults to 41481.
    </ParamField>

    <ParamField query="timeout_value" type="int, optional">
      Timeout value for the connection, defaults to 3600.
    </ParamField>
  </ResponseField>
</ResponseField>

<Note>
  All legged methods accept an optional `robot_name`. When not supplied, AirGen targets the first configured robot (alphabetical order).
</Note>

<Tip>GRID currently ships two quadrupeds for `LeggedClient`: Ghost V60 and Unitree Go2.</Tip>

## getState

<ResponseField name="LeggedClient.getState(robot_name=&#x22;&#x22;)">
  Returns state data of the robot

  <ResponseField name="Arguments">
    <ParamField query="robot_name" type="str, optional">
      Name of the robot
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="State" type="State">
      state data of the robot
    </ResponseField>
  </ResponseField>
</ResponseField>

## setGaitAsync

<ResponseField name="LeggedClient.setGaitAsync(name, robot_name=&#x22;&#x22;)">
  Sets the gait of the robot.

  <ResponseField name="Arguments">
    <ParamField query="name" type="str">
      Name of the gait to set to.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot. Defaults to "".
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      future. call .join() to wait for method to finish.
    </ResponseField>
  </ResponseField>
</ResponseField>

## simGetAllGaitNames

<ResponseField name="LeggedClient.simGetAllGaitNames(robot_name=&#x22;&#x22;)">
  Retrieves the names of all the available gaits for a robot.

  <ResponseField name="Arguments">
    <ParamField query="robot_name" type="str">
      Name of the robot.
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="list" type="list">
      List of strings representing the names of available Gait modes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## rotateToYawAsync

<ResponseField name="LeggedClient.rotateToYawAsync(yaw, tolerance=5.0, yaw_rate=90.0, timeout_sec=3e38, robot_name=&#x22;&#x22;)">
  Rotates the robot to a specified yaw angle (world space) asynchronously using the given yaw\_rate.

  Note: yaw\_rate sign is ignored, and the robot will rotate in the shortest direction to reach the target yaw.

  <ResponseField name="Arguments">
    <ParamField query="yaw" type="float">
      The target yaw angle in degrees.
    </ParamField>

    <ParamField query="tolerance" type="float, optional">
      The acceptable deviation from the target yaw angle, in degrees. Defaults to 5.
    </ParamField>

    <ParamField query="yaw_rate" type="float">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="timeout_sec" type="float, optional">
      The maximum time allowed for the rotation, in seconds. Defaults to 3e38.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      The name of the robot to send this command to. Defaults to "".
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## rotateByYawRateAsync

<ResponseField name="LeggedClient.rotateByYawRateAsync(yaw_rate, duration, robot_name=&#x22;&#x22;)">
  Rotates the robot at a specified yaw rate asynchronously.

  <ResponseField name="Arguments">
    <ParamField query="yaw_rate" type="float">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="duration" type="float">
      The duration for which the robot should rotate at the specified yaw rate, in seconds.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      The name of the robot to send this command to. Defaults to "".
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveOnPathAsync

<ResponseField
  name="LeggedClient.moveOnPathAsync(
path,
speed,
yaw_rate=90.0,
tolerance=0.5,
lookahead=-1,
adaptive_lookahead=1,
timeout_sec=3e38,
robot_name=&#x22;&#x22;,
)"
>
  Give a list of 3D points (local space), and the robot will move along that path at the specified speed and yaw\_rate

  <ResponseField name="Arguments">
    <ParamField query="path" type="List[Vector3r]">
      A list of 3D vectors (local NED) representing the path to follow.
    </ParamField>

    <ParamField query="speed" type="float">
      The speed at which the robot should move along the path, in meters per second.
    </ParamField>

    <ParamField query="timeout_sec" type="float, optional">
      The maximum time allowed for the robot to reach the destination, in seconds.
    </ParamField>

    <ParamField query="lookahead" type="int, optional">
      The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
    </ParamField>

    <ParamField query="adaptive_lookahead" type="int, optional">
      If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
    </ParamField>

    <ParamField query="yaw_rate" type="float">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="tolerance" type="float, optional">
      The acceptable distance from a waypoint at which the robot will consider the path completed.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      The name of the robot being controlled, if applicable. Defaults to "".
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveByVelocityAsync

<ResponseField
  name="LeggedClient.moveByVelocityAsync(
vx,
vy,
vz,
duration,
yaw_rate=90.0,
orient_dir = Vector3r.ZERO,
robot_name=&#x22;&#x22;,
)"
>
  Move the robot with a given velocity, orientation direction and yaw\_rate for a desired duration (seconds).

  Notes:
  To prevent the robot from rotating, yaw\_rate can be set to zero. For a non-zero yaw\_rate, the following applies:
  If orient\_dir is not ZERO, the robot will orient towards it for the entire duration,
  otherwise it'll orient toward velocity's direction instead.

  <ResponseField name="Arguments">
    <ParamField query="vx" type="float">
      X component of desired velocity (local NED)
    </ParamField>

    <ParamField query="vy" type="float">
      Y component of desired velocity (local NED)
    </ParamField>

    <ParamField query="vz" type="float">
      Z component of desired velocity (local NED)
    </ParamField>

    <ParamField query="duration" type="float">
      Desired amount of time (seconds), to move with the given velocity.
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="orient_dir" type="Vector3r, optional">
      Desired orientation direction (local NED).
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot to send this command to.
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveByVelocityAsyncV

<ResponseField
  name="LeggedClient.moveByVelocityAsyncV(
velocity: Vector3r,
duration,
yaw_rate=90.0,
orient_dir=Vector3r.ZERO,
robot_name=&#x22;&#x22;,
)"
>
  Move the robot with a given velocity, orientation direction and yaw\_rate for a desired duration (seconds).

  Notes:
  To prevent the robot from rotating, yaw\_rate can be set to zero. For a non-zero yaw\_rate, the following applies:
  If orient\_dir is not ZERO, the robot will orient towards it for the entire duration,
  otherwise it'll orient toward velocity's direction instead.

  <ResponseField name="Arguments">
    <ParamField query="velocity" type="Vector3r">
      Desired velocity (local NED)
    </ParamField>

    <ParamField query="duration" type="float">
      Desired amount of time (seconds), to move with the given velocity.
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="orient_dir" type="Vector3r, optional">
      Desired orientation direction (local NED).
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot to send this command to.
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveByVelocityBodyFrameAsync

<ResponseField
  name="LeggedClient.moveByVelocityBodyFrameAsync(
vx,
vy,
vz,
duration,
yaw_rate=90.0,
robot_name=&#x22;&#x22;
)"
>
  Move the robot with a given velocity (body-frame) and yaw\_rate for a desired duration (seconds)

  Notes:
  The velocity vector is interpreted **only at the moment the command starts**.
  It is not continuously rotated with the robot's changing orientation.
  In other words, the motion is just initialized in body frame, not "body-frame tracked" over time.

  <ResponseField name="Arguments">
    <ParamField query="vx" type="float">
      X component of desired velocity in the robot's body frame of reference
    </ParamField>

    <ParamField query="vy" type="float">
      Y component of desired velocity in the robot's body frame of reference
    </ParamField>

    <ParamField query="vz" type="float">
      Z component of desired velocity in the robot's body frame of reference
    </ParamField>

    <ParamField query="duration" type="float">
      Desired amount of time (seconds), to move with the given velocity
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot to send this command to
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveByVelocityBodyFrameAsyncV

<ResponseField
  name="LeggedClient.moveByVelocityBodyFrameAsyncV(
velocity: Vector3r,
duration,
yaw_rate=90.0,
robot_name=&#x22;&#x22;
)"
>
  Move the robot with a given velocity (body-frame) and yaw\_rate for a desired duration (seconds)

  Notes:
  The velocity vector is interpreted **only at the moment the command starts**.
  It is not continuously rotated with the robot's changing orientation.
  In other words, the motion is just initialized in body frame, not "body-frame tracked" over time.

  <ResponseField name="Arguments">
    <ParamField query="velocity" type="Vector3r">
      Desired velocity in the robot's body frame of reference
    </ParamField>

    <ParamField query="duration" type="float">
      Desired amount of time (seconds), to move with the given velocity
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot to send this command to
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveToPositionAsync

<ResponseField
  name="LeggedClient.moveToPositionAsync(
x,
y,
z,
speed,
yaw_rate=90.0,
tolerance=0.5,
lookahead=-1,
adaptive_lookahead=1,
timeout_sec=3e38,
robot_name=&#x22;&#x22;,
)"
>
  Move the robot directly toward a desired position (local space) with a given speed and yaw\_rate

  <ResponseField name="Arguments">
    <ParamField query="x" type="float">
      X component of desired position (local NED)
    </ParamField>

    <ParamField query="y" type="float">
      Y component of desired position (local NED)
    </ParamField>

    <ParamField query="z" type="float">
      Z component of desired position (local NED)
    </ParamField>

    <ParamField query="speed" type="float, positive">
      Desired speed in m/s.
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="tolerance" type="float, optional">
      The acceptable distance from the position at which the robot will consider the path completed.
    </ParamField>

    <ParamField query="lookahead" type="int, optional">
      The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
    </ParamField>

    <ParamField query="adaptive_lookahead" type="int, optional">
      If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
    </ParamField>

    <ParamField query="timeout_sec" type="float, optional">
      Maximum time allowed for the robot to reach the destination, in seconds.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>

## moveToPositionAsyncV

<ResponseField
  name="LeggedClient.moveToPositionAsyncV(
position: Vector3r,
speed,
yaw_rate=90.0,
tolerance=0.5,
lookahead=-1,
adaptive_lookahead=1,
timeout_sec=3e38,
robot_name=&#x22;&#x22;
)"
>
  Move the robot directly toward a desired position (local space) with a given speed and yaw\_rate

  <ResponseField name="Arguments">
    <ParamField query="position" type="Vector3r">
      Desired position (local NED)
    </ParamField>

    <ParamField query="speed" type="float, positive">
      Desired speed in m/s.
    </ParamField>

    <ParamField query="yaw_rate" type="float, optional">
      Desired yaw rate in degrees/second.
    </ParamField>

    <ParamField query="tolerance" type="float, optional">
      The acceptable distance from the position at which the robot will consider the path completed.
    </ParamField>

    <ParamField query="lookahead" type="int, optional">
      The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
    </ParamField>

    <ParamField query="adaptive_lookahead" type="int, optional">
      If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
    </ParamField>

    <ParamField query="timeout_sec" type="float, optional">
      Maximum time allowed for the robot to reach the destination, in seconds.
    </ParamField>

    <ParamField query="robot_name" type="str, optional">
      Name of the robot
    </ParamField>
  </ResponseField>

  <ResponseField name="Returns">
    <ResponseField name="msgpackrpc.future.Future" type="msgpackrpc.future.Future">
      A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
    </ResponseField>

    <ResponseField name="Call" type="Call">
      .join() to wait until the operation completes.
    </ResponseField>
  </ResponseField>
</ResponseField>
