Simulator

Simulator

class gibson2.core.simulator.Simulator(gravity=9.8, timestep=0.004166666666666667, use_fisheye=False, mode='gui', resolution=256, fov=90, device_idx=0, render_to_tensor=False)
__init__(gravity=9.8, timestep=0.004166666666666667, use_fisheye=False, mode='gui', resolution=256, fov=90, device_idx=0, render_to_tensor=False)

Simulator class is a wrapper of physics simulator (pybullet) and MeshRenderer, it loads objects into both pybullet and also MeshRenderer and syncs the pose of objects and robot parts.

Parameters
  • gravity – gravity on z direction.

  • timestep – timestep of physical simulation

  • use_fisheye – use fisheye

  • mode – choose mode from gui or headless

  • resolution – resolution of camera (square)

  • fov – field of view of camera in degree

  • device_idx – GPU device index to run rendering on

  • render_to_tensor – Render to GPU tensors

set_timestep(timestep)
Parameters

timestep – set timestep after the initialization of Simulator

add_viewer()

Attach a debugging viewer to the renderer. This will make the step much slower so should be avoided when training agents

reload()

Destroy the MeshRenderer and physics simulator and start again.

load()

Set up MeshRenderer and physics simulation client. Initialize the list of objects.

import_scene(scene, texture_scale=1.0, load_texture=True, class_id=0)

Import a scene. A scene could be a synthetic one or a realistic Gibson Environment.

Parameters
  • scene – Scene object

  • texture_scale – Option to scale down the texture for rendering

  • load_texture – If you don’t need rgb output, texture loading could be skipped to make rendering faster

  • class_id – Class id for rendering semantic segmentation

import_object(object, class_id=0)
Parameters
  • object – Object to load

  • class_id – Class id for rendering semantic segmentation

import_robot(robot, class_id=0)

Import a robot into Simulator

Parameters
  • robot – Robot

  • class_id – Class id for rendering semantic segmentation

Returns

id for robot in pybullet

import_interactive_object(obj, class_id=0)

Import articulated objects into simulator

Parameters
  • obj

  • class_id – Class id for rendering semantic segmentation

Returns

pybulet id

step()

Step the simulation and update positions in renderer

static update_position(instance)

Update position for an object or a robot in renderer.

Parameters

instance – Instance in the renderer

isconnected()
Returns

pybullet is alive

disconnect()

clean up the simulator