Skip to main content

General

get_public_fields

Get all public fields of an object (not starting with _).
Object
The object to retrieve fields from.
List[str]
List[str]

list_to_2d_float_array

Convert a list of floats to a 2D array.
List[float]
List of float values.
int
The width of the array.
int
The height of the array.
np.ndarray
A NumPy array with dtype=np.float32 and shape (height, width).

string_to_float_array

Convert a string to a float array.
str | bytes
The string or bytes to convert.
np.ndarray
np.ndarray

string_to_uint8_array

Convert a string to a uint8 array.
str | bytes
The string or bytes to convert.
np.ndarray
A NumPy array with dtype=uint8.

to_dict

Convert an object to a dictionary of its public fields.
Object
The object to convert.
Dict[str, Any]
Dict[str, Any]

to_str

Convert an object to a string of its public fields.
Object
The object to convert.
str
str

vector3d2list

Turn an AirGen Vector3r into a list of three floats.
Vector3r
The 3D vector to convert.
List[float]
List[float]

wait_key

Wait for a key press on the console and return it.
str, optional
message to display while waiting.

write_file

Write binary data to a file. Used for writing compressed PNG images.
str
The name of the file.
bytes
The binary data to write.

Sensor

imagetype2request

Helper function to create an uncompressed AirGen ImageRequest for a given image type.
Literal["front_center", "bottom_center"]
The name of the camera.
ImageType
The type of image to capture.

responses2images

Convert AirGen image responses to NumPy arrays.
List[ImageResponse]
The image responses to convert.
Optional[Any]
The data type for the resulting NumPy arrays.
Dict[str, np.ndarray]
A dictionary with keys corresponding to camera names and values as the images.image: For ImageType.Scene, ImageType.DepthVis, ImageType.OpticalFlowVis, image data is RGB image, numpy array with dtype=np.uint8, shape=(height, width, 3)For ImageType.DepthPerspective, ImageType.DepthPlanar, ImageType.DisparityNormalized, image data is depth image in meters, numpy array with dtype=np.float32, shape=(height, width, 1)For ImageType.Segmentation, image data is array of objects’ SegmentationIDs, numpy array with dtype=np.uint8, shape=(height, width, 1)For ImageType.SurfaceNormals, image data is array of unit vector (normalized length), numpy array with dtype=np.float32, shape=(height, width, 3)For ImageType.OpticalFlow, image data is array of displacements in x,y directions, numpy array with dtype=np.float32, shape=(height, width, 2)For ImageType.Infrared, image data is array of infrared values (object’s SegmentationID for now), numpy array with dtype=np.uint8, shape=(height, width, 1)camera parameters: width (int): image widthheight (int): image heightfov (float): camera field of view in degreescamera_position (List[float]): camera position (x,y,z) in airgen (NED frame)camera_orientation_euler_pry (List[float]): camera orientation (pitch, roll, yaw) in degreescamera_orientation_quat_wxyz (List[float]): camera orientation (w,x,y,z) in quaternion format

Mechanics

cameracoord2worldcoord

Given AirGen camera parameters, transform a camera coordinate back to AirGen world coordinates.
List[float]
A coordinate (x, y, z).
dict
Camera parameters.
np.ndarray
np.ndarray

homo_coord_to_nonhome_coord

Turn homogeneous coordinates into non-homogeneous coordinates by factoring out the last dimension.
ivy.Array
An array of shape (..., n).
ivy.Array
An array of shape (..., n-1).

imagecoord2direction

Given camera parameters (position, pose, and FOV) and pixel coordinates, return the 3D direction of the pixel relative to the camera.
Tuple[float, float]
Coordinate of the pixel in the image in xy format.
Dict[str, Any]
Camera parameters.
Tuple[float, float, float]
Normalized unit directional vector (x, y, z).

imagecoord2orientation

Given camera parameters (position, pose, and FOV) and pixel coordinates, return the 3D direction of the pixel relative to the camera, represented in yaw and pitch (absolute degrees).
Tuple[float, float]
Coordinate of the pixel in the image in xy format.
Dict[str, Any]
Camera parameters.
Tuple[float, float, float]
Target pitch, roll, yaw in radians.

imagecoord2pose

Convert pixel coordinates to 3D coordinates.
Tuple[float, float]
Coordinate of the pixel in the image in xy format.
float
Depth of the point.
Dict[str, Any]
Camera parameters.
Tuple[float, float, float]
Target coordinate in (x, y, z) and orientation (pitch, roll, yaw) in radians.

pose2vector

Transform a target direction represented in (pitch, roll, yaw) in radians into a directional vector.
float
Pitch angle in radians.
float
Roll angle in radians.
float
Yaw angle in radians.
Tuple[float, float, float]
Unit directional vector (x, y, z).

quat_wxyz_to_xyzw

Transform a quaternion (represented by a list of floats) from wxyz format to xyzw format.
List[float]
A quaternion in wxyz format.
np.ndarray
A quaternion in xyzw format.

rotate_xy

Rotate the xy component of a 3D vector by theta (in degrees) counterclockwise in the xy plane.Assume the orientation:
np.ndarray
A vector of shape (3,).
float
Rotation angle in degrees.
np.ndarray
Rotated vector of shape (3,).

to_eularian_angles

Transform a quaternion into Euler angles.
Quaternionr
A quaternion in wxyz format.
Tuple[float, float, float]
Euler angles (pitch, roll, yaw) in radians.

vec2eulerangles

Transform an AirGen directional vector into Euler angles.
np.ndarray
A directional vector of shape (N, 3).
np.ndarray
np.ndarray: Euler angles of shape (N, 3) where each row is (pitch, roll, yaw) in degrees.

Vision

The vision subsection of AirGen utilities provides essential functions for handling camera parameters and generating point clouds from depth images.

build_camera

Given AirGen camera parameters, this function builds the inverse extrinsic matrix and the camera intrinsic matrix.
dict
AirGen camera parameters.
Tuple[ivy.Array, ivy.Array]
Tuple of: Inverse Extrinsic Matrix, Intrinsic Matrix

build_camera_intrinsic

Constructs the camera intrinsic matrix using AirGen camera parameters.
dict
AirGen camera parameters.
ivy.Array
ivy.Array

build_camera_inv_extrinsic

Generates the inverse extrinsic matrix for the camera based on its parameters.
dict
AirGen camera parameters.
ivy.Array
Inverse Extrinsic Matrix

camera_unproject_depth

Generates a point cloud from a depth image (Depth Perspective).
np.ndarray
Depth image of shape (H, W, 1).
ivy.Array
Inverse of camera extrinsic matrix.
ivy.Array
Inverse of camera intrinsic matrix.
np.ndarray
Point cloud of shape (N, 3).

depth2pointcloud

Generates a point cloud from a depth image.
np.ndarray
Depth image of shape (H, W, 1).
dict
Camera parameters containing field of view, height, width, and pose.
Optional[np.ndarray]
Boolean mask where 1 indicates the object of interest (H, W, 1). Defaults to None.
np.ndarray
Point cloud in AirGen world coordinates of shape (N, 3).

Trajectory

The trajectory subsection of AirGen utilities focuses on waypoint-based path planning and trajectory generation.

Waypoint

Stores a waypoint with positional and timing information.
Position in the world frame.
Euler angle of the waypoint.
Time at which the waypoint is to be reached.

calc_time

Calculates a fitting time for the trajectory between two waypoints.
Waypoint
Starting waypoint.
Waypoint
Ending waypoint.

fit_min_snap_trajectory

Starting point for trajectory generation by transforming an array of arrays into an array of waypoints.
array of arrays
Input waypoints.
bool
Indicates whether to calculate joint operations. Defaults to True.

joint

Calculates a trajectory using joint operations.
array of Waypoints
Waypoints to be connected by joint operations.

separate

Calculates a trajectory using separate operations.
array of Waypoints
Waypoints to be processed individually.

Visualize

The visualize subsection of AirGen utilities provides methods to log camera data and images from AirGen to Rerun for real-time visualization.

rr_camera_capture_logger

Given a view space name (entity_path in Rerun), returns a function that logs camera data (pose and capture in AirGen’s 3D world coordinate) to that view space.
str
Name of the view space (entity_path) in Rerun.
A callable function that logs camera data to the specified view space.
  • Usage:

rr_log_airgen_image

Logs images from AirGen to Rerun.
str
Path to the entity in Rerun.
ImageType
Type of image to log.
np.ndarray
Image data.
str, optional
Name of the image (default is an empty string).
If image_type is not supported.