habitat.core.simulator.Simulator class

Abstract simulator class for habitat. New simulators to be added to habitat must derive from this class and implement the abstract methods.

Methods

def action_space_shortest_path(self, source: AgentState, targets: typing.List[AgentState], agent_id: int = 0) -> typing.List[ShortestPathPoint]
Calculates the shortest path between source and target agent states.
def close(self, destroy: bool = True) -> None
def geodesic_distance(self, position_a: typing.Union[typing.Sequence[float], numpy.ndarray], position_b: typing.Union[typing.Sequence[float], typing.Sequence[typing.Sequence[float]], numpy.ndarray], episode: typing.Optional[dataset.Episode] = None) -> float
Calculates geodesic distance between two points.
def get_agent_state(self, agent_id: int = 0) -> AgentState
def get_observations_at(self, position: typing.List[float], rotation: typing.List[float], keep_agent_at_new_pose: bool = False) -> typing.Optional[Observations]
Returns the observation.
def get_straight_shortest_path_points(self, position_a: typing.List[float], position_b: typing.List[float]) -> typing.List[typing.List[float]]
Returns points along the geodesic (shortest) path between two points irrespective of the angles between the waypoints.
def is_navigable(self, point: typing.List[float]) -> bool
Return True if the agent can stand at the specified point.
def previous_step_collided(self) -> bool
Whether or not the previous step resulted in a collision
def reconfigure(self, config: DictConfig, episode: typing.Optional[dataset.Episode] = None)
def render(self, mode: str = 'rgb') -> typing.Any
def reset(self) -> Observations
resets the simulator and returns the initial observations.
def sample_navigable_point(self) -> typing.List[float]
Samples a navigable point from the simulator. A point is defined as navigable if the agent can be initialized at that point.
def seed(self, seed: int) -> None
def step(self, action, *args, **kwargs) -> Observations
Perform an action in the simulator and return observations.

Special methods

def __enter__(self) -> Simulator
def __exit__(self, exc_type, exc_val, exc_tb)
def __init__(self, *args, **kwargs) -> None

Properties

action_space: gym.spaces.space.Space get
forward_vector: numpy.ndarray get
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.
sensor_suite: SensorSuite get
up_vector: numpy.ndarray get
The vector representing the direction upward (perpendicular to the floor) from the global coordinate frame.

Data

habitat_config: DictConfig = None
The Dictconfig object containing configuration parameters specifically pertaining to the habitat Simulator.

Method documentation

def habitat.core.simulator.Simulator.action_space_shortest_path(self, source: AgentState, targets: typing.List[AgentState], agent_id: int = 0) -> typing.List[ShortestPathPoint]

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).

def habitat.core.simulator.Simulator.geodesic_distance(self, position_a: typing.Union[typing.Sequence[float], numpy.ndarray], position_b: typing.Union[typing.Sequence[float], typing.Sequence[typing.Sequence[float]], numpy.ndarray], episode: typing.Optional[dataset.Episode] = None) -> float

Calculates geodesic distance between two points.

Parameters
position_a coordinates of first point.
position_b coordinates of second point or list of goal points coordinates.
episode The episode with these ends points. This is used for shortest path computation caching
Returns the geodesic distance in the cartesian space between points position_a and position_b, if no path is found between the points then math.inf is returned.

def habitat.core.simulator.Simulator.get_agent_state(self, agent_id: int = 0) -> AgentState

Parameters
agent_id id of agent.
Returns state of agent corresponding to agent_id.

def habitat.core.simulator.Simulator.get_observations_at(self, position: typing.List[float], rotation: typing.List[float], keep_agent_at_new_pose: bool = False) -> typing.Optional[Observations]

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.

def habitat.core.simulator.Simulator.get_straight_shortest_path_points(self, position_a: typing.List[float], position_b: typing.List[float]) -> typing.List[typing.List[float]]

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

Parameters
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.

def habitat.core.simulator.Simulator.is_navigable(self, point: typing.List[float]) -> bool

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

Parameters
point the point to check.

def habitat.core.simulator.Simulator.previous_step_collided(self) -> bool

Whether or not the previous step resulted in a collision

Returns True if the previous step resulted in a collision, False otherwise

def habitat.core.simulator.Simulator.reset(self) -> Observations

resets the simulator and returns the initial observations.

Returns initial observations from simulator.

def habitat.core.simulator.Simulator.sample_navigable_point(self) -> typing.List[float]

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.

def habitat.core.simulator.Simulator.step(self, action, *args, **kwargs) -> Observations

Perform an action in the simulator and return observations.

Parameters
action action to be performed inside the simulator.
args
kwargs
Returns observations after taking action in simulator.