habitat.utils.visualizations.maps module

Functions

def calculate_meters_per_pixel(map_resolution: int, sim: typing.Optional[sims.habitat_simulator.habitat_simulator.HabitatSim] = None, pathfinder = None)
Calculate the meters_per_pixel for a given map resolution
def colorize_draw_agent_and_fit_to_height(topdown_map_info: typing.Dict[str, typing.Any], output_height: int)
Given the output of the TopDownMap measure, colorizes the map, draws the agent, and fits to a desired output height
def colorize_topdown_map(top_down_map: numpy.ndarray, fog_of_war_mask: typing.Optional[numpy.ndarray] = None, fog_of_war_desat_amount: float = 0.5) -> numpy.ndarray
def draw_agent(image: numpy.ndarray, agent_center_coord: typing.Tuple[int, int], agent_rotation: float, agent_radius_px: int = 5) -> numpy.ndarray
def draw_path(top_down_map: numpy.ndarray, path_points: typing.Sequence[typing.Tuple], color: int = 10, thickness: int = 2) -> None
def from_grid(grid_x: int, grid_y: int, grid_resolution: typing.Tuple[int, int], sim: typing.Optional[sims.habitat_simulator.habitat_simulator.HabitatSim] = None, pathfinder = None) -> typing.Tuple[float, float]
Inverse of _to_grid function. Return real world coordinate from gridworld assuming top-left corner is the origin. The real world coordinates of lower left corner are (coordinate_min, coordinate_min) and of top right corner are (coordinate_max, coordinate_max)
def get_topdown_map(pathfinder, height: float, map_resolution: int = 1024, draw_border: bool = True, meters_per_pixel: typing.Optional[float] = None) -> numpy.ndarray
Return a top-down occupancy map for a sim. Note, this only returns valid values for whatever floor the agent is currently on.
def get_topdown_map_from_sim(sim: sims.habitat_simulator.habitat_simulator.HabitatSim, map_resolution: int = 1024, draw_border: bool = True, meters_per_pixel: typing.Optional[float] = None, agent_id: int = 0) -> numpy.ndarray
Wrapper around get_topdown_map that retrieves that pathfinder and heigh from the current simulator
def pointnav_draw_target_birdseye_view(agent_position: numpy.ndarray, agent_heading: float, goal_position: numpy.ndarray, resolution_px: int = 800, goal_radius: float = 0.2, agent_radius_px: int = 20, target_band_radii: typing.Optional[typing.List[float]] = None, target_band_colors: typing.Optional[typing.List[typing.Tuple[int, int, int]]] = None) -> numpy.ndarray
Return an image of agent w.r.t. centered target location for pointnav tasks.
def to_grid(realworld_x: float, realworld_y: float, grid_resolution: typing.Tuple[int, int], sim: typing.Optional[sims.habitat_simulator.habitat_simulator.HabitatSim] = None, pathfinder = None) -> typing.Tuple[int, int]
Return gridworld index of realworld coordinates assuming top-left corner is the origin. The real world coordinates of lower left corner are (coordinate_min, coordinate_min) and of top right corner are (coordinate_max, coordinate_max)

Data

AGENT_SPRITE = …
MAP_BORDER_INDICATOR = 2
MAP_INVALID_POINT = 0
MAP_SHORTEST_PATH_COLOR = 7
MAP_SOURCE_POINT_INDICATOR = 4
MAP_TARGET_BOUNDING_BOX = 9
MAP_TARGET_POINT_INDICATOR = 6
MAP_VALID_POINT = 1
MAP_VIEW_POINT_INDICATOR = 8
TOP_DOWN_MAP_COLORS = …

Function documentation

def habitat.utils.visualizations.maps.colorize_draw_agent_and_fit_to_height(topdown_map_info: typing.Dict[str, typing.Any], output_height: int)

Given the output of the TopDownMap measure, colorizes the map, draws the agent, and fits to a desired output height

Parameters
topdown_map_info The output of the TopDownMap measure
output_height The desired output height

def habitat.utils.visualizations.maps.get_topdown_map(pathfinder, height: float, map_resolution: int = 1024, draw_border: bool = True, meters_per_pixel: typing.Optional[float] = None) -> numpy.ndarray

Return a top-down occupancy map for a sim. Note, this only returns valid values for whatever floor the agent is currently on.

Parameters
pathfinder A habitat-sim pathfinder instances to get the map from
height The height in the environment to make the topdown map
map_resolution Length of the longest side of the map. Used to calculate meters_per_pixel
draw_border Whether or not to draw a border
meters_per_pixel Overrides map_resolution an

def habitat.utils.visualizations.maps.get_topdown_map_from_sim(sim: sims.habitat_simulator.habitat_simulator.HabitatSim, map_resolution: int = 1024, draw_border: bool = True, meters_per_pixel: typing.Optional[float] = None, agent_id: int = 0) -> numpy.ndarray

Wrapper around get_topdown_map that retrieves that pathfinder and heigh from the current simulator

Parameters
sim Simulator instance.
map_resolution
draw_border
meters_per_pixel
agent_id The agent ID