Skip to main content
Manipulating poses is a common task when staging simulations, resetting robots, or arranging assets. AirGen exposes synchronized RPCs for querying and setting poses on robots and world objects.
import airgen

client = airgen.VehicleClient()
client.confirmConnection()
This page complements the GPS Navigation and Runtime Object Spawning guides by focusing on world-frame (Pose) operations.

Query the Current Pose

from airgen.types import Pose

robot_pose = client.simGetRobotPose(robot_name="drone0")
object_pose = client.simGetObjectPose("Crate_01")

print("Robot altitude (m):", -robot_pose.position.z_val)
simGetRobotPose returns the pose relative to the robot’s spawn origin in the world NED frame. simGetObjectPose reads the pose of movable actors in the scene.

simSetRobotPose

Teleport a robot to a specified Pose. The parameters mirror the geodetic variant but operate in meters.
from airgen.types import Pose, Quaternionr, Vector3r

reset_pose = Pose(
    position_val=Vector3r(0.0, 0.0, -5.0),
    orientation_val=Quaternionr.from_euler_angles_degrees(0.0, 0.0, 180.0),
)

client.simSetRobotPose(
    pose=reset_pose,
    ignore_collision=False,
    sweep=True,
    on_ground=False,
    robot_name="drone0",
).join()
  • Set ignore_collision=True to bypass collision checks.
  • sweep=True performs a swept volume check between the current pose and target pose.
  • bounds_trim shrinks the collision hull when collisions are enforced (Vector3r(0.05, 0.05, 0.05) by default).
  • Enable on_ground for ground or legged robots to align with terrain height. Adjust ground_trace_range_up / ground_trace_range_down to bound the search region.
The RPC returns a msgpackrpc.future.Future. Call .join() to wait without inspecting the result or .get() to retrieve the success flag.

simSetObjectPose & simSetObjectGeoPose

Use the same pose structure to reposition movable world objects.
crate_pose = Pose(
    position_val=Vector3r(2.0, 3.0, -0.5),
    orientation_val=Quaternionr.from_euler_angles_degrees(0.0, 0.0, 45.0),
)

client.simSetObjectPose(
    object_name="Crate_01",
    pose=crate_pose,
    teleport=True,  # False applies physics-based interpolation
)
In georeferenced scenes, call simSetObjectGeoPose with a GeoPose to align objects by latitude/longitude.
from airgen.types import GeoPoint, GeoPose

billboard_pose = GeoPose(
    geopoint_val=GeoPoint(37.7751, -122.4189, 12.0),
    orientation_val=Quaternionr.IDENTITY,
)
client.simSetObjectGeoPose("Billboard", billboard_pose)

Working with Multiple Robots

Every pose setter accepts the optional robot_name parameter. This lets you orchestrate heterogeneous fleets from a single connection.
from airgen.types import Pose, Quaternionr, Vector3r

for robot in ["drone0", "car0", "quadruped0"]:
    client.simSetRobotPose(
        Pose(
            position_val=Vector3r.ZERO,
            orientation_val=Quaternionr.IDENTITY,
        ),
        ignore_collision=True,
        robot_name=robot,
    ).join()
Use the Robots & AirGen Client page to review how robot names are assigned within GRID sessions.

Pose Validation Patterns

After issuing a pose command, validate the result by querying the pose and comparing it against the target within a tolerance.
import numpy as np

expected = reset_pose.position
actual = client.simGetRobotPose(robot_name="drone0").position

if np.isclose(expected.x_val, actual.x_val, atol=0.01):
    print("Pose update succeeded")
This pattern is especially useful when ignore_collision=False, because the simulator may reject placements that intersect the environment.
Use pose utilities alongside Movement for fine-grained control, and pair them with Runtime Object Spawning when authoring dynamic scenes.