Skip to main content

__init__

LeggedClient.__init__(ip="", port=41481, timeout_value=3600)
Initializes a quadruped / legged client connection.
Arguments
ip
str, optional
IP address of the server, defaults to localhost.
port
int, optional
Port number of the legged RPC server, defaults to 41481.
timeout_value
int, optional
Timeout value for the connection, defaults to 3600.
All legged methods accept an optional robot_name. When not supplied, AirGen targets the first configured robot (alphabetical order).
GRID currently ships two quadrupeds for LeggedClient: Ghost V60 and Unitree Go2.

getState

LeggedClient.getState(robot_name="")
Returns state data of the robot
Arguments
robot_name
str, optional
Name of the robot
Returns
State
State
state data of the robot

setGaitAsync

LeggedClient.setGaitAsync(name, robot_name="")
Sets the gait of the robot.
Arguments
name
str
Name of the gait to set to.
robot_name
str, optional
Name of the robot. Defaults to "".
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
future. call .join() to wait for method to finish.

simGetAllGaitNames

LeggedClient.simGetAllGaitNames(robot_name="")
Retrieves the names of all the available gaits for a robot.
Arguments
robot_name
str
Name of the robot.
Returns
list
list
List of strings representing the names of available Gait modes.

rotateToYawAsync

LeggedClient.rotateToYawAsync(yaw, tolerance=5.0, yaw_rate=90.0, timeout_sec=3e38, robot_name="")
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.
Arguments
yaw
float
The target yaw angle in degrees.
tolerance
float, optional
The acceptable deviation from the target yaw angle, in degrees. Defaults to 5.
yaw_rate
float
Desired yaw rate in degrees/second.
timeout_sec
float, optional
The maximum time allowed for the rotation, in seconds. Defaults to 3e38.
robot_name
str, optional
The name of the robot to send this command to. Defaults to "".
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

rotateByYawRateAsync

LeggedClient.rotateByYawRateAsync(yaw_rate, duration, robot_name="")
Rotates the robot at a specified yaw rate asynchronously.
Arguments
yaw_rate
float
Desired yaw rate in degrees/second.
duration
float
The duration for which the robot should rotate at the specified yaw rate, in seconds.
robot_name
str, optional
The name of the robot to send this command to. Defaults to "".
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveOnPathAsync

LeggedClient.moveOnPathAsync( path, speed, yaw_rate=90.0, tolerance=0.5, lookahead=-1, adaptive_lookahead=1, timeout_sec=3e38, robot_name="", )
Give a list of 3D points (local space), and the robot will move along that path at the specified speed and yaw_rate
Arguments
path
List[Vector3r]
A list of 3D vectors (local NED) representing the path to follow.
speed
float
The speed at which the robot should move along the path, in meters per second.
timeout_sec
float, optional
The maximum time allowed for the robot to reach the destination, in seconds.
lookahead
int, optional
The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
adaptive_lookahead
int, optional
If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
yaw_rate
float
Desired yaw rate in degrees/second.
tolerance
float, optional
The acceptable distance from a waypoint at which the robot will consider the path completed.
robot_name
str, optional
The name of the robot being controlled, if applicable. Defaults to "".
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveByVelocityAsync

LeggedClient.moveByVelocityAsync( vx, vy, vz, duration, yaw_rate=90.0, orient_dir = Vector3r.ZERO, robot_name="", )
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.
Arguments
vx
float
X component of desired velocity (local NED)
vy
float
Y component of desired velocity (local NED)
vz
float
Z component of desired velocity (local NED)
duration
float
Desired amount of time (seconds), to move with the given velocity.
yaw_rate
float, optional
Desired yaw rate in degrees/second.
orient_dir
Vector3r, optional
Desired orientation direction (local NED).
robot_name
str, optional
Name of the robot to send this command to.
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveByVelocityAsyncV

LeggedClient.moveByVelocityAsyncV( velocity: Vector3r, duration, yaw_rate=90.0, orient_dir=Vector3r.ZERO, robot_name="", )
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.
Arguments
velocity
Vector3r
Desired velocity (local NED)
duration
float
Desired amount of time (seconds), to move with the given velocity.
yaw_rate
float, optional
Desired yaw rate in degrees/second.
orient_dir
Vector3r, optional
Desired orientation direction (local NED).
robot_name
str, optional
Name of the robot to send this command to.
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveByVelocityBodyFrameAsync

LeggedClient.moveByVelocityBodyFrameAsync( vx, vy, vz, duration, yaw_rate=90.0, robot_name="" )
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.
Arguments
vx
float
X component of desired velocity in the robot’s body frame of reference
vy
float
Y component of desired velocity in the robot’s body frame of reference
vz
float
Z component of desired velocity in the robot’s body frame of reference
duration
float
Desired amount of time (seconds), to move with the given velocity
yaw_rate
float, optional
Desired yaw rate in degrees/second.
robot_name
str, optional
Name of the robot to send this command to
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveByVelocityBodyFrameAsyncV

LeggedClient.moveByVelocityBodyFrameAsyncV( velocity: Vector3r, duration, yaw_rate=90.0, robot_name="" )
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.
Arguments
velocity
Vector3r
Desired velocity in the robot’s body frame of reference
duration
float
Desired amount of time (seconds), to move with the given velocity
yaw_rate
float, optional
Desired yaw rate in degrees/second.
robot_name
str, optional
Name of the robot to send this command to
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveToPositionAsync

LeggedClient.moveToPositionAsync( x, y, z, speed, yaw_rate=90.0, tolerance=0.5, lookahead=-1, adaptive_lookahead=1, timeout_sec=3e38, robot_name="", )
Move the robot directly toward a desired position (local space) with a given speed and yaw_rate
Arguments
x
float
X component of desired position (local NED)
y
float
Y component of desired position (local NED)
z
float
Z component of desired position (local NED)
speed
float, positive
Desired speed in m/s.
yaw_rate
float, optional
Desired yaw rate in degrees/second.
tolerance
float, optional
The acceptable distance from the position at which the robot will consider the path completed.
lookahead
int, optional
The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
adaptive_lookahead
int, optional
If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
timeout_sec
float, optional
Maximum time allowed for the robot to reach the destination, in seconds.
robot_name
str, optional
Name of the robot
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.

moveToPositionAsyncV

LeggedClient.moveToPositionAsyncV( position: Vector3r, speed, yaw_rate=90.0, tolerance=0.5, lookahead=-1, adaptive_lookahead=1, timeout_sec=3e38, robot_name="" )
Move the robot directly toward a desired position (local space) with a given speed and yaw_rate
Arguments
position
Vector3r
Desired position (local NED)
speed
float, positive
Desired speed in m/s.
yaw_rate
float, optional
Desired yaw rate in degrees/second.
tolerance
float, optional
The acceptable distance from the position at which the robot will consider the path completed.
lookahead
int, optional
The lookahead distance used for following the path. If less than 0, auto-lookahead is enabled. Must not be 0.
adaptive_lookahead
int, optional
If greater than 0, adaptive lookahead is enabled; otherwise, it is disabled.
timeout_sec
float, optional
Maximum time allowed for the robot to reach the destination, in seconds.
robot_name
str, optional
Name of the robot
Returns
msgpackrpc.future.Future
msgpackrpc.future.Future
A future object that resolves to a bool, indicating whether the operation succeeded (True) or failed (False).
Call
Call
.join() to wait until the operation completes.