General
get_public_fields
airgen.utils.general.get_public_fields(obj)
list_to_2d_float_array
airgen.utils.general.list_to_2d_float_array(flst, width, height)
string_to_float_array
airgen.utils.general.string_to_float_array(bstr)
string_to_uint8_array
airgen.utils.general.string_to_uint8_array(bstr)
to_dict
airgen.utils.general.to_dict(obj)
to_str
airgen.utils.general.to_str(obj)
vector3d2list
airgen.utils.general.vector3d2list(vector3d)
wait_key
airgen.utils.general.wait_key(message="")
write_file
airgen.utils.general.write_file(filename, bstr)
Sensor
imagetype2request
airgen.utils.sensor.imagetype2request(camera_name, image_type)
Helper function to create an uncompressed AirGen ImageRequest for a given image type.
Arguments
Returns
responses2images
airgen.utils.sensor.responses2images(responses, dtype=None)
Convert AirGen image responses to NumPy arrays.
Arguments
Returns
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
airgen.utils.mechanics.cameracoord2worldcoord(camera_coord, camera_params)
homo_coord_to_nonhome_coord
airgen.utils.mechanics.homo_coord_to_nonhome_coord(home_coord)
imagecoord2direction
airgen.utils.mechanics.imagecoord2direction(pixelcoord, camera_param)
Given camera parameters (position, pose, and FOV) and pixel coordinates, return the 3D direction of the pixel relative to the camera.
Arguments
imagecoord2orientation
airgen.utils.mechanics.imagecoord2orientation(pixelcoord, camera_param)
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).
Arguments
imagecoord2pose
airgen.utils.mechanics.imagecoord2pose(pixelcoord, point_depth, camera_param)
Convert pixel coordinates to 3D coordinates.
Arguments
pose2vector
airgen.utils.mechanics.pose2vector(pitch, roll, yaw)
Transform a target direction represented in
(pitch, roll, yaw)
in radians into a directional vector.Arguments
quat_wxyz_to_xyzw
airgen.utils.mechanics.quat_wxyz_to_xyzw(quat_wxyz)
rotate_xy
airgen.utils.mechanics.rotate_xy(vec, theta)
to_eularian_angles
airgen.utils.mechanics.to_eularian_angles(q)
vec2eulerangles
airgen.utils.mechanics.vec2eulerangles(vec)
Vision
Thevision
subsection of AirGen utilities provides essential functions for handling camera parameters and generating point clouds from depth images.
build_camera
airgen.utils.vision.build_camera(camera_params)
build_camera_intrinsic
airgen.utils.vision.build_camera_intrinsic(camera_params)
build_camera_inv_extrinsic
airgen.utils.vision.build_camera_inv_extrinsic(camera_params)
camera_unproject_depth
airgen.utils.vision.camera_unproject_depth(depth, cam_inv_ext_mat, cam_inv_calib_mat)
depth2pointcloud
airgen.utils.vision.depth2pointcloud(depth, camera_param, mask=None)
Generates a point cloud from a depth image.
Arguments
Trajectory
Thetrajectory
subsection of AirGen utilities focuses on waypoint-based path planning and trajectory generation.
Waypoint
airgen.utils.trajectory.Waypoint(x, y, z, yaw, time)
calc_time
airgen.utils.trajectory.calc_time(start, end)
fit_min_snap_trajectory
airgen.utils.trajectory.fit_min_snap_trajectory(waypoint_arr, isJoint=True)
joint
airgen.utils.trajectory.joint(waypoints)
separate
airgen.utils.trajectory.separate(waypoints)
rr_camera_capture_logger
airgen.utils.visualize.rr_camera_capture_logger(rr_space_view_name)
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.
Returns
A callable function that logs camera data to the specified view space.
- Usage:
rr_log_airgen_image
airgen.utils.visualize.rr_log_airgen_image(entity_path, image_type, image, image_name="")