habitat.core.simulator

class habitat.core.simulator.DepthSensor(*args, **kwargs)[source]
get_observation(*args, **kwargs)[source]

Returns: current observation for Sensor.

class habitat.core.simulator.Observations(sensors: Dict[str, habitat.core.simulator.Sensor], *args, **kwargs)[source]

Dictionary containing sensor observations

Parameters

sensors – list of sensors whose observations are fetched and packaged.

class habitat.core.simulator.RGBSensor(*args, **kwargs)[source]
get_observation(*args, **kwargs) → Any[source]

Returns: current observation for Sensor.

class habitat.core.simulator.SemanticSensor(*args, **kwargs)[source]
get_observation(*args, **kwargs)[source]

Returns: current observation for Sensor.

class habitat.core.simulator.Sensor(*args, **kwargs)[source]

Represents a sensor that provides data from the environment to agent. The user of this class needs to implement the get_observation method and the user is also required to set the below attributes:

uuid

universally unique id.

sensor_type

type of Sensor, use SensorTypes enum if your sensor comes under one of it’s categories.

observation_space

gym.Space object corresponding to observation of sensor.

get_observation(*args, **kwargs) → Any[source]
Returns

current observation for Sensor.

class habitat.core.simulator.SensorSuite(sensors: List[habitat.core.simulator.Sensor])[source]

Represents a set of sensors, with each sensor being identified through a unique id.

Parameters

sensors – list containing sensors for the environment, uuid of each sensor must be unique.

get_observations(*args, **kwargs) → habitat.core.simulator.Observations[source]
Returns

collect data from all sensors and return it packaged inside Observation.

class habitat.core.simulator.SensorTypes[source]

Enumeration of types of sensors.

class habitat.core.simulator.Simulator[source]

Basic simulator class for habitat. New simulators to be added to habtiat must derive from this class and implement the abstarct methods.

action_space_shortest_path(source: habitat.core.simulator.AgentState, targets: List[habitat.core.simulator.AgentState], agent_id: int = 0) → List[habitat.core.simulator.ShortestPathPoint][source]

Calculates the shortest path between source and target agent states.

Parameters
  • source – source agent state for shortest path calculation.

  • targets – target agent state(s) for shortest path calculation.

  • agent_id – id for agent (relevant for multi-agent setup).

Returns

list of agent states and actions along the shortest path from source to the nearest target (both included).

property forward_vector

The forward direction in the global coordinate frame i.e. the direction of forward movement for an agent with 0 degrees rotation in the ground plane.

geodesic_distance(position_a: List[float], position_b: List[float]) → float[source]

Calculates geodesic distance between two points.

Parameters
  • position_a – coordinates of first point.

  • position_b – coordinates of second point.

Returns

the geodesic distance in the cartesian space between points position_a and position_b, if no path is found between the points then infinity is returned.

get_agent_state(agent_id: int = 0)[source]
Parameters

agent_id – id of agent.

Returns

state of agent corresponding to agent_id.

get_observations_at(position: List[float], rotation: List[float], keep_agent_at_new_pose: bool = False) → Optional[habitat.core.simulator.Observations][source]

Returns the observation.

Parameters
  • position – list containing 3 entries for (x, y, z).

  • rotation – list with 4 entries for (x, y, z, w) elements of unit quaternion (versor) representing agent 3D orientation, (https://en.wikipedia.org/wiki/Versor)

  • keep_agent_at_new_pose – If true, the agent will stay at the requested location. Otherwise it will return to where it started.

Returns

The observations or None if it was unable to get valid observations.

get_straight_shortest_path_points(position_a: List[float], position_b: List[float]) → List[List[float]][source]

Returns points along the geodesic (shortest) path between two points irrespective of the angles between the waypoints.

Args:
position_a: the start point. This will be the first point in the

returned list.

position_b: the end point. This will be the last point in the

returned list.

Returns

a list of waypoints (x, y, z) on the geodesic path between the two points.

is_navigable(point: List[float]) → bool[source]

Return true if the agent can stand at the specified point.

Parameters

point – the point to check.

reset() → habitat.core.simulator.Observations[source]

resets the simulator and returns the initial observations.

Returns

initial observations from simulator.

sample_navigable_point() → List[float][source]

Samples a navigable point from the simulator. A point is defined as navigable if the agent can be initialized at that point.

Returns

navigable point.

step(action: int) → habitat.core.simulator.Observations[source]

Perform an action in the simulator and return observations.

Parameters

action – action to be performed inside the simulator.

Returns

observations after taking action in simulator.

property up_vector

The vector representing the direction upward (perpendicular to the floor) from the global coordinate frame.