igibson.utils package¶
Submodules¶
igibson.utils.assets_utils module¶
-
igibson.utils.assets_utils.
change_data_path
()¶
-
igibson.utils.assets_utils.
download_assets
()¶ Download iGibson assets
-
igibson.utils.assets_utils.
download_dataset
(url)¶ Download Gibson dataset
-
igibson.utils.assets_utils.
download_demo_data
()¶ Download iGibson demo dataset
-
igibson.utils.assets_utils.
download_ext_scene_assets
()¶
-
igibson.utils.assets_utils.
download_ig_dataset
()¶ Download iGibson dataset
-
igibson.utils.assets_utils.
get_3dfront_scene_path
(scene_name)¶ Get 3D-FRONT scene path
- Parameters
scene_name – scene name
- Returns
file path to the scene name
-
igibson.utils.assets_utils.
get_all_object_models
()¶ Get iGibson all object models
- Returns
a list of all object model paths
-
igibson.utils.assets_utils.
get_cubicasa_scene_path
(scene_name)¶ Get cubicasa scene path
- Parameters
scene_name – scene name
- Returns
file path to the scene name
-
igibson.utils.assets_utils.
get_ig_assets_version
()¶ Get iGibson asset version
- Returns
iGibson asset version
-
igibson.utils.assets_utils.
get_ig_category_ids
()¶ Get iGibson object categories
- Returns
file path to the scene name
-
igibson.utils.assets_utils.
get_ig_category_path
(category_name)¶ Get iGibson object category path
- Parameters
category_name – object category
- Returns
file path to the object category
-
igibson.utils.assets_utils.
get_ig_model_path
(category_name, model_name)¶ Get iGibson object model path
- Parameters
category_name – object category
model_name – object model
- Returns
file path to the object model
-
igibson.utils.assets_utils.
get_ig_scene_path
(scene_name)¶ Get iGibson scene path
- Parameters
scene_name – scene name
- Returns
file path to the scene name
-
igibson.utils.assets_utils.
get_scene_path
(scene_id)¶ Gibson scene path
- Parameters
scene_id – scene id
- Returns
scene path for this scene_id
-
igibson.utils.assets_utils.
get_texture_file
(mesh_file)¶ Get texture file
- Parameters
mesh_file – mesh obj file
- Returns
texture file path
igibson.utils.constants module¶
Constant Definitions
-
class
igibson.utils.constants.
OccupancyGridState
¶ Bases:
object
-
FREESPACE
= 1.0¶
-
OBSTACLES
= 0.0¶
-
UNKNOWN
= 0.5¶
-
igibson.utils.generate_trav_map module¶
igibson.utils.map_utils module¶
-
class
igibson.utils.map_utils.
Plane
(orig, normal)¶ Bases:
object
-
igibson.utils.map_utils.
compute_triangle_plane_intersections
(vertices, faces, tid, plane, dists, dist_tol=1e-08)¶ Compute the intersection between a triangle and a plane Returns a list of intersections in the form (INTERSECT_EDGE, <intersection point>, <edge>) for edges intersection (INTERSECT_VERTEX, <intersection point>, <vertex index>) for vertices This return between 0 and 2 intersections : - 0 : the plane does not intersect the plane - 1 : one of the triangle’s vertices lies on the plane (so it just “touches” the plane without really intersecting) - 2 : the plane slice the triangle in two parts (either vertex-edge, vertex-vertex or edge-edge)
-
igibson.utils.map_utils.
gen_map
(vertices, faces, output_folder, img_filename_format='floor_{}.png')¶
-
igibson.utils.map_utils.
gen_trav_map
(vertices, faces, output_folder, add_clutter=False, trav_map_filename_format='floor_trav_{}.png', obstacle_map_filename_format='floor_{}.png')¶ Generate traversability maps.
-
igibson.utils.map_utils.
get_xy_floors
(vertices, faces, dist_threshold=-0.98)¶
-
igibson.utils.map_utils.
point_to_plane_dist
(p, plane)¶
igibson.utils.mesh_util module¶
3D mesh manipulation utilities.
-
igibson.utils.mesh_util.
anorm
(x, axis=None, keepdims=False)¶ Compute L2 norms alogn specified axes.
-
igibson.utils.mesh_util.
frustum
(left, right, bottom, top, znear, zfar)¶ Create view frustum matrix.
-
igibson.utils.mesh_util.
homotrans
(M, p)¶
-
igibson.utils.mesh_util.
load_obj
(fn)¶ Load 3d mesh form .obj’ file.
- Args:
fn: Input file name or file-like object.
- Returns:
dictionary with the following keys (some of which may be missing): position: np.float32, (n, 3) array, vertex positions uv: np.float32, (n, 2) array, vertex uv coordinates normal: np.float32, (n, 3) array, vertex uv normals face: np.int32, (k*3,) traingular face indices
-
igibson.utils.mesh_util.
lookat
(eye, target=[0, 0, 0], up=[0, 1, 0])¶ Generate LookAt modelview matrix.
-
igibson.utils.mesh_util.
mat2xyz
(mat)¶
-
igibson.utils.mesh_util.
normalize
(v, axis=None, eps=1e-10)¶ L2 Normalize along specified axes.
-
igibson.utils.mesh_util.
normalize_mesh
(mesh)¶ Scale mesh to fit into -1..1 cube
-
igibson.utils.mesh_util.
ortho
(left, right, bottom, top, znear, zfar)¶ Create orthonormal projection matrix.
-
igibson.utils.mesh_util.
perspective
(fovy, aspect, znear, zfar)¶ Create perspective projection matrix.
-
igibson.utils.mesh_util.
quat2rotmat
(quat)¶ - Parameters
quat – quaternion in w,x,y,z
- Returns
rotation matrix 4x4
-
igibson.utils.mesh_util.
safemat2quat
(mat)¶ - Parameters
mat – 4x4 matrix
- Returns
quaternion in w,x,y,z
-
igibson.utils.mesh_util.
sample_view
(min_dist, max_dist=None)¶ Sample random camera position. Sample origin directed camera position in given distance range from the origin. ModelView matrix is returned.
-
igibson.utils.mesh_util.
save_obj
(vertices_info, faces_info, fn)¶
-
igibson.utils.mesh_util.
transform_vertex
(vertices, pose_rot, pose_trans)¶
-
igibson.utils.mesh_util.
xyz2mat
(xyz)¶
-
igibson.utils.mesh_util.
xyzw2wxyz
(orn)¶ - Parameters
orn – quaternion in xyzw
- Returns
quaternion in wxyz
igibson.utils.monitor module¶
-
class
igibson.utils.monitor.
Monitor
(env, filename, allow_early_resets=False, reset_keywords=())¶ Bases:
gym.core.Wrapper
-
EXT
= 'monitor.csv'¶
-
close
()¶ Override close in your subclass to perform any necessary cleanup.
Environments will automatically close() themselves when garbage collected or when the program exits.
-
f
= None¶
-
get_episode_lengths
()¶
-
get_episode_rewards
()¶
-
get_total_steps
()¶
-
-
igibson.utils.monitor.
get_monitor_files
(dir)¶
-
igibson.utils.monitor.
load_results
(dir)¶
igibson.utils.motion_planning_wrapper module¶
igibson.utils.semantics_utils module¶
-
igibson.utils.semantics_utils.
get_class_name_to_class_id
(starting_class_id=<SemanticClass.SCENE_OBJS: 3>)¶ Get mapping from semantic class name to class id
- Parameters
starting_class_id – starting class id for scene objects
igibson.utils.urdf_utils module¶
-
igibson.utils.urdf_utils.
parse_urdf
(tree)¶ Parse URDF for spliting by floating joints later
-
igibson.utils.urdf_utils.
round_up
(n, decimals=0)¶ Helper function to round a float
-
igibson.utils.urdf_utils.
save_urdfs_without_floating_joints
(tree, file_prefix)¶ Split one URDF into multiple URDFs if there are floating joints and save them
-
igibson.utils.urdf_utils.
splitter
(parent_map, child_map, joint_map, single_child_link)¶ Recursively split URDFs by floating joints
-
igibson.utils.urdf_utils.
transform_element_xyzrpy
(element, transformation)¶ Transform a URDF element by transformation
- Parameters
element – URDF XML element
transformation – transformation that should be applied to the element
igibson.utils.utils module¶
-
igibson.utils.utils.
cartesian_to_polar
(x, y)¶ Convert cartesian coordinate to polar coordinate
-
igibson.utils.utils.
get_rpy_from_transform
(transform)¶ Returns the roll, pitch, yaw angles (Euler) for a given rotation or homogeneous transformation matrix transformation = Array with the rotation (3x3) or full transformation (4x4)
-
igibson.utils.utils.
get_transform_from_xyz_rpy
(xyz, rpy)¶ Returns a homogeneous transformation matrix (numpy array 4x4) for the given translation and rotation in roll,pitch,yaw xyz = Array of the translation rpy = Array with roll, pitch, yaw rotations
-
igibson.utils.utils.
l2_distance
(v1, v2)¶ Returns the L2 distance between vector v1 and v2.
-
igibson.utils.utils.
parse_config
(config)¶ Parse iGibson config file / object
-
igibson.utils.utils.
quatFromXYZW
(xyzw, seq)¶ Convert quaternion from XYZW (pybullet convention) to arbitrary sequence.
-
igibson.utils.utils.
quatToXYZW
(orn, seq)¶ Convert quaternion from arbitrary sequence to XYZW (pybullet convention).
-
igibson.utils.utils.
quatXYZWFromRotMat
(rot_mat)¶ Convert quaternion from rotation matrix
-
igibson.utils.utils.
quat_pos_to_mat
(pos, quat)¶ Convert position and quaternion to transformation matrix
-
igibson.utils.utils.
rotate_vector_2d
(v, yaw)¶ Rotates 2d vector by yaw counterclockwise
-
igibson.utils.utils.
rotate_vector_3d
(v, r, p, y, cck=True)¶ Rotates 3d vector by roll, pitch and yaw counterclockwise
igibson.utils.vision_utils module¶
-
class
igibson.utils.vision_utils.
RandomScale
(minsize, maxsize, interpolation=2)¶ Bases:
object
Rescale the input PIL.Image to the given size. Args: size (sequence or int): Desired output size. If size is a sequence like (w, h), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size) interpolation (int, optional): Desired interpolation. Default is
PIL.Image.BILINEAR