Skip to main content
Quadrupeds (legged robots) in AirGen are exposed through the LeggedClient, which extends the base VehicleClient with legged-specific motion and gait APIs. This guide walks through common control patterns for a legged agent: connecting to the simulator, switching gaits, issuing velocity or waypoint commands, and repositioning the robot with pose utilities.

Prerequisites

  • A session configured with at least one quadruped (Ghost V60 or Unitree Go2), for example quadruped0.
  • The AirGen Python package available inside your notebook or shell (pip install pyairgen on GRID Enterprise, pre-installed on OpenGRID sessions).
import airgen

# Connect to the legged RPC endpoint
client = airgen.LeggedClient()

# Optional: explicit robot selection when multiple quadrupeds are configured
ROBOT_NAME = "quadruped0"

client.enableApiControl(True, robot_name=ROBOT_NAME)
client.armDisarm(True, robot_name=ROBOT_NAME)
If you’re using the GRID notebook scaffolding, the object airgen_quadruped_0 (or similarly named) already exposes a connected client as airgen_quadruped_0.client.

Inspect Available Gaits

Legged locomotion is organized around named gaits. Query the scene to understand which options are available and activate the one you need.
available_gaits = client.simGetAllGaitNames(robot_name=ROBOT_NAME)
print("Scene gait library:", available_gaits)

# Switch to pacing gait
client.setGaitAsync("pace", robot_name=ROBOT_NAME).join()
setGaitAsync returns a msgpackrpc.future.Future. Call .join() or .get() to wait for completion and capture success state.

Command Body Velocities

Use moveByVelocityAsync to command linear velocities in the world (NED) frame while optionally spinning at a constant yaw rate.
duration = 3.0  # seconds
client.moveByVelocityAsync(vx=1.0, vy=0.0, vz=0.0, duration=duration, yaw_rate=45.0, robot_name=ROBOT_NAME).join()
  • vx, vy, vz are expressed in meters per second along world X (forward), Y (right), and Z (down).
  • yaw_rate is in degrees per second; pass 0.0 to maintain heading.

Follow a Waypoint Path

To traverse a sequence of waypoints, supply a list of Vector3r world coordinates to moveOnPathAsync.
from airgen.types import Vector3r

path = [
    Vector3r(0.0, 0.0, -0.5),
    Vector3r(5.0, 0.0, -0.5),
    Vector3r(5.0, 3.0, -0.5),
]

client.moveOnPathAsync(
    path=path,
    speed=1.0,          # m/s
    yaw_rate=30.0,      # deg/s while walking the path
    tolerance=0.25,     # meters
    robot_name=ROBOT_NAME,
).join()
lookahead and adaptive_lookahead offer additional smoothing when following dense paths; refer to the LeggedClient reference for parameter definitions.

Relocate with Pose Utilities

When you need to reposition a legged robot instantly (for example, resetting a scenario), use the pose-setting APIs shared across robot types.
from airgen.types import Pose, Quaternionr, Vector3r

reset_pose = Pose(
    position_val=Vector3r(0.0, 0.0, -0.5),
    orientation_val=Quaternionr.from_euler_angles_degrees(roll=0.0, pitch=0.0, yaw=90.0),
)

# Respect collisions and snap the body to the ground plane
client.simSetRobotPose(
    pose=reset_pose,
    ignore_collision=False,
    sweep=True,
    on_ground=True,
    robot_name=ROBOT_NAME,
).join()
simSetRobotPose operates in the world (NED) frame. For geodetic placement by latitude/longitude, convert to a GeoPose and call simSetRobotGeoPose as described in the GPS Navigation guide.

Combine with GPS Paths

Legged robots inherit the GPS helpers from VehicleClient. This allows long-distance navigation driven by latitude/longitude waypoints.
from airgen.types import GeoPoint

gps_point = GeoPoint(latitude=37.774886, longitude=-122.419226, altitude=15.0)
client.moveToGPSAsync(
    lla=gps_point,
    velocity=0.75,
    robot_name=ROBOT_NAME,
)
AirGen internally converts the geodetic target into world coordinates using the current geo-reference. See GPS Navigation for practical tips on mixing local and global frames.
With these primitives you can blend gait selection, world-frame velocities, and scripted path following to stage complex quadruped scenarios, all while using the same client infrastructure as multirotors and wheeled robots.