igibson.scenes package

Submodules

igibson.scenes.empty_scene module

class igibson.scenes.empty_scene.EmptyScene

Bases: igibson.scenes.scene_base.Scene

A empty scene for debugging

get_random_point(floor=None)

Get a random point in the region of [-5, 5] x [-5, 5]

get_shortest_path(floor, source_world, target_world, entire_path=False)

Get a trivial shortest path because the scene is empty

load()

Load the scene into pybullet

igibson.scenes.gibson_indoor_scene module

class igibson.scenes.gibson_indoor_scene.StaticIndoorScene(scene_id, trav_map_resolution=0.1, trav_map_erosion=2, trav_map_type='with_obj', build_graph=True, num_waypoints=10, waypoint_resolution=0.2, pybullet_load_texture=False)

Bases: igibson.scenes.indoor_scene.IndoorScene

Static indoor scene class for iGibson. Contains the functionalities for navigation such as shortest path computation

get_floor_height(floor=0)

Return the current floor height (in meter)

Returns

current floor height

get_random_floor()

Get a random floor

Returns

random floor number

load()

Load the scene (including scene mesh and floor plane) into pybullet

load_floor_metadata()

Load floor metadata

load_floor_planes()

Load additional floor planes (because the scene mesh can have bumpy floor surfaces)

load_scene_mesh()

Load scene mesh

reset_floor(floor=0, additional_elevation=0.02, height=None)

Resets the floor plane to a new floor

Parameters
  • floor – Integer identifying the floor to move the floor plane to

  • additional_elevation – Additional elevation with respect to the height of the floor

  • height – Alternative parameter to control directly the height of the ground plane

igibson.scenes.igibson_indoor_scene module

class igibson.scenes.igibson_indoor_scene.InteractiveIndoorScene(scene_id, trav_map_resolution=0.1, trav_map_erosion=2, trav_map_type='with_obj', build_graph=True, num_waypoints=10, waypoint_resolution=0.2, pybullet_load_texture=False, texture_randomization=False, link_collision_tolerance=0.03, object_randomization=False, object_randomization_idx=None, should_open_all_doors=False, load_object_categories=None, load_room_types=None, load_room_instances=None, seg_map_resolution=0.1, scene_source='IG')

Bases: igibson.scenes.gibson_indoor_scene.StaticIndoorScene

Create an interactive scene defined with iGibson Scene Description Format (iGSDF). iGSDF is an extension of URDF that we use to define an interactive scene. It has support for URDF scaling, URDF nesting and randomization. InteractiveIndoorScene inherits from StaticIndoorScene the functionalities to compute shortest path and other navigation functionalities.

add_object(category, model=None, model_path=None, filename=None, bounding_box=None, scale=None, object_name=None, joint_name=None, joint_type=None, joint_parent=None, position=None, orientation_rpy=None, in_rooms=None)

Adds an object to the scene

Parameters
  • category – object category, e.g. door

  • model – object model in the object dataset

  • model_path – folder path of that object model

  • filename – urdf file path of that object model

  • bounding_box – bounding box of this object

  • scale – scaling factor of this object

  • object_name – object name, unique for each object instance, e.g. door_3

  • joint_name – name of the joint that connects the object to the scene

  • joint_type – type of the joint that connects the object to the scene

  • joint_parent – parent of the joint that connects the object to the scene (i.e. world)

  • position – position of the joint that connects the object to the scene

  • orientation_rpy – orientation of the joint that connects the object to the scene

  • in_rooms – which room(s) this object is in. It can be in more than one rooms if it sits at room boundary (e.g. doors)

check_collision(body_a, body_b=None, link_a=None, fixed_body_ids=None)

Helper function to check for collision for scene quality

check_scene_quality(body_ids, fixed_body_ids)

Helper function to check for scene quality. 1) Objects should have no collision with each other. 2) Fixed, articulated objects that cannot fully extend their joints should be less than self.link_collision_tolerance

Parameters
  • body_ids – body ids of all scene objects

  • fixed_body_ids – body ids of all fixed scene objects

Returns

whether scene passes quality check

filter_rooms_and_object_categories(load_object_categories, load_room_types, load_room_instances)

Handle partial scene loading based on object categories, room types or room instances

Parameters
  • load_object_categories – only load these object categories into the scene (a list of str)

  • load_room_types – only load objects in these room types into the scene (a list of str)

  • load_room_instances – only load objects in these room instances into the scene (a list of str)

force_wakeup_scene_objects()

Force wakeup sleeping objects

get_body_ids()

Return the body ids of all scene objects

Returns

body ids

get_num_objects()

Get the number of objects

Returns

number of objects

get_random_point_by_room_instance(room_instance)

Sample a random point by room instance

Parameters

room_instance – room instance (e.g. bathroom_1)

Returns

floor (always 0), a randomly sampled point in [x, y, z]

get_random_point_by_room_type(room_type)

Sample a random point by room type

Parameters

room_type – room type (e.g. bathroom)

Returns

floor (always 0), a randomly sampled point in [x, y, z]

get_room_instance_by_point(xy)

Return the room instance given a point

Parameters

xy – 2D location in world reference frame (metric)

Returns

room instance that this point is in or None, if this point is not on the room segmentation map

get_room_type_by_point(xy)

Return the room type given a point

Parameters

xy – 2D location in world reference frame (metric)

Returns

room type that this point is in or None, if this point is not on the room segmentation map

load()

Load all scene objects into pybullet

load_avg_obj_dims()

Load average object dimensions for scene objects

load_overlapped_bboxes()

Load overlapped bounding boxes in scene definition. E.g. a dining table usually has overlaps with the surrounding dining chairs

load_room_sem_ins_seg_map(seg_map_resolution)

Load room segmentation map

Parameters

seg_map_resolution – room segmentation map resolution

open_all_doors()

Attempt to open all doors to maximum values without collision

open_all_objs_by_categories(categories, mode='random', prob=1.0)

Attempt to open all objects of a number of categories without collision

Parameters
  • categories – object categories (a list of str)

  • mode – opening mode (zero, max, or random)

  • prob – opening probability

open_all_objs_by_category(category, mode='random', prob=1.0)

Attempt to open all objects of a certain category without collision

Parameters
  • category – object category (str)

  • mode – opening mode (zero, max, or random)

  • prob – opening probability

open_one_obj(body_id, mode='random')

Attempt to open one object without collision

Parameters
  • body_id – body id of the object

  • mode – opening mode (zero, max, or random)

randomize_texture()

Randomize texture/material for all objects in the scene

reset_scene_objects()

Reset the pose and joint configuration of all scene objects. Also open all doors if self.should_open_all_doors is True

seg_map_to_world(xy)

Transforms a 2D point in map reference frame into world (simulator) reference frame

Parameters

xy – 2D location in seg map reference frame (image)

Returns

2D location in world reference frame (metric)

world_to_seg_map(xy)

Transforms a 2D point in world (simulator) reference frame into map reference frame

Parameters

xy – 2D location in world reference frame (metric)

Returns

2D location in seg map reference frame (image)

igibson.scenes.indoor_scene module

class igibson.scenes.indoor_scene.IndoorScene(scene_id, trav_map_resolution=0.1, trav_map_erosion=2, trav_map_type='with_obj', build_graph=True, num_waypoints=10, waypoint_resolution=0.2, pybullet_load_texture=False)

Bases: igibson.scenes.scene_base.Scene

Indoor scene class for Gibson and iGibson. Contains the functionalities for navigation such as shortest path computation

build_trav_graph(maps_path, floor, trav_map)

Build traversibility graph and only take the largest connected component

Parameters
  • maps_path – String with the path to the folder containing the traversability maps

  • floor – floor number

  • trav_map – traversability map

get_random_point(floor=None)

Sample a random point on the given floor number. If not given, sample a random floor number.

Parameters

floor – floor number

Return floor

floor number

Return point

randomly sampled point in [x, y, z]

get_shortest_path(floor, source_world, target_world, entire_path=False)

Get the shortest path from one point to another point. If any of the given point is not in the graph, add it to the graph and create an edge between it to its closest node.

Parameters
  • floor – floor number

  • source_world – 2D source location in world reference frame (metric)

  • target_world – 2D target location in world reference frame (metric)

  • entire_path – whether to return the entire path

has_node(floor, world_xy)

Return whether the traversability graph contains a point

Parameters
  • floor – floor number

  • world_xy – 2D location in world reference frame (metric)

load_trav_map(maps_path)

Loads the traversability maps for all floors

Parameters

maps_path – String with the path to the folder containing the traversability maps

map_to_world(xy)

Transforms a 2D point in map reference frame into world (simulator) reference frame

Parameters

xy – 2D location in map reference frame (image)

Returns

2D location in world reference frame (metric)

world_to_map(xy)

Transforms a 2D point in world (simulator) reference frame into map reference frame

Parameters

xy – 2D location in world reference frame (metric)

Returns

2D location in map reference frame (image)

igibson.scenes.scene_base module

class igibson.scenes.scene_base.Scene

Bases: object

Base class for all Scene objects Contains the base functionalities and the functions that all derived classes need to implement

get_floor_height(floor=0)

Get the height of the given floor

Parameters

floor – Integer identifying the floor

Returns

Height of the given floor

get_random_floor()

Sample a random floor among all existing floor_heights in the scene While Gibson v1 scenes can have several floor_heights, the EmptyScene, StadiumScene and scenes from iGibson have only a single floor

Returns

An integer between 0 and NumberOfFloors-1

get_random_point(floor=None)

Sample a random valid location in the given floor

Parameters

floor – integer indicating the floor, or None if randomly sampled

Returns

A tuple of random floor and random valid point (3D) in that floor

get_shortest_path(floor, source_world, target_world, entire_path=False)

Query the shortest path between two points in the given floor

Parameters
  • floor – Floor to compute shortest path in

  • source_world – Initial location in world reference frame

  • target_world – Target location in world reference frame

  • entire_path – Flag indicating if the function should return the entire shortest path or not

Returns

Tuple of path (if indicated) as a list of points, and geodesic distance (lenght of the path)

load()

Load the scene into pybullet The elements to load may include: floor, building, objects, etc

Returns

A list of pybullet ids of elements composing the scene, including floors, buildings and objects

igibson.scenes.stadium_scene module

class igibson.scenes.stadium_scene.StadiumScene

Bases: igibson.scenes.scene_base.Scene

A simple stadium scene for debugging

get_random_point(floor=None)

Get a random point in the region of [-5, 5] x [-5, 5]

get_shortest_path(floor, source_world, target_world, entire_path=False)

Get a trivial shortest path because the scene is empty

load()

Load the scene into pybullet

Module contents