module
navmesh_utilsClasses
- class SimpleVelocityControlEnv
- A simple environment to control the velocity of the robot. Assumes x-forward in robot local space.
Functions
- def compute_turn(target: numpy.ndarray, turn_speed: float, robot_forward: numpy.ndarray) -> typing.List[float]
- Computes the constant speed angular velocity about the Y axis to turn the 2D robot_forward vector toward the provided 2D target direction in global coordinates.
- def embodied_unoccluded_navmesh_snap(target_position: _magnum.Vector3, height: float, sim: habitat_sim.simulator.Simulator, pathfinder: typing.Optional[habitat_sim._ext.habitat_sim_bindings.PathFinder] = None, target_object_ids: typing.Optional[typing.List[int]] = None, ignore_object_ids: typing.Optional[typing.List[int]] = None, ignore_object_collision_ids: typing.Optional[typing.List[int]] = None, island_id: int = -1, search_offset: float = 1.5, test_batch_size: int = 20, max_samples: int = 200, min_sample_dist: float = 0.5, embodiment_heuristic_offsets: typing.Optional[typing.List[_magnum.Vector2]] = None, agent_embodiment: typing.Optional[articulated_agents.MobileManipulator] = None, orientation_noise: float = 0, max_orientation_samples: int = 5, data_out: typing.Optional[typing.Dict[typing.Any, typing.Any]] = None) -> typing.Tuple[_magnum.Vector3, float, bool]
- Snap a robot embodiment close to a target point considering embodied constraints via the navmesh and raycasting for point visibility.
- def get_largest_island_index(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder, sim: habitat_sim.simulator.Simulator, allow_outdoor: bool = True) -> int
- Get the index of the largest NavMesh island. Optionally exclude outdoor islands.
- def is_accessible(sim: habitat_sim.simulator.Simulator, point: _magnum.Vector3, height: float, nav_to_min_distance: float, nav_island: int = -1, target_object_ids: typing.Optional[typing.List[int]] = None) -> bool
- Return True if the point is within a threshold distance (in XZ plane) of the nearest unoccluded navigable point on the selected island.
- def is_collision(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder, trans: _magnum.Matrix4, navmesh_offset: typing.List[typing.Tuple[float, float]], island_idx: int) -> bool
- Checks the given transform and navmesh offset points for navigability on the provided navmesh island. Returns True if any point is non-navigable.
- def is_outdoor(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder, sim: habitat_sim.simulator.Simulator, island_ix: int, num_samples: int = 100, indoor_ratio_threshold: float = 0.95, min_sample_dist: typing.Optional[float] = None, max_sample_attempts: int = 200) -> bool
- Heuristic to check if the specified NavMesh island is outdoor or indoor.
- def path_is_navigable_given_robot(sim: habitat_sim.simulator.Simulator, start_pos: _magnum.Vector3, goal_pos: _magnum.Vector3, robot_navmesh_offsets: typing.List[typing.Tuple[float, float]], collision_rate_threshold: float, selected_island: int = -1, angle_threshold: float = 0.05, angular_speed: float = 1.0, distance_threshold: float = 0.25, linear_speed: float = 1.0, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, render_debug_video: bool = False) -> bool
- Compute the ratio of time-steps for which there were collisions detected while the robot navigated from start_pos to goal_pos given the configuration of the sim navmesh.
- def record_robot_nav_debug_image(curr_path_points: typing.List[_magnum.Vector3], robot_transformation: _magnum.Matrix4, robot_navmesh_offsets: typing.List[typing.Tuple[float, float]], robot_navmesh_radius: float, in_collision: bool, dbv: sims.habitat_simulator.debug_visualizer.DebugVisualizer, obs_cache: typing.List[typing.Any]) -> None
- Render a single frame 3rd person view of the robot embodiment approximation following a path with DebugVizualizer and cache it in obs_cache.
- def snap_point_is_occluded(target: _magnum.Vector3, snap_point: _magnum.Vector3, height: float, sim: habitat_sim.simulator.Simulator, granularity: float = 0.2, target_object_ids: typing.Optional[typing.List[int]] = None, ignore_object_ids: typing.Optional[typing.List[int]] = None) -> bool
- Uses raycasting to check whether a target is occluded given a navmesh snap point.
- def unoccluded_navmesh_snap(pos: _magnum.Vector3, height: float, pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder, sim: habitat_sim.simulator.Simulator, target_object_ids: typing.Optional[typing.List[int]] = None, ignore_object_ids: typing.Optional[typing.List[int]] = None, island_id: int = -1, search_offset: float = 1.5, test_batch_size: int = 20, max_samples: int = 200, min_sample_dist: float = 0.5) -> typing.Optional[_magnum.Vector3]
- Snap a point to the navmesh considering point visibility via raycasting.
Function documentation
def habitat. datasets. rearrange. navmesh_utils. compute_turn(target: numpy.ndarray,
turn_speed: float,
robot_forward: numpy.ndarray) -> typing.List[float]
Computes the constant speed angular velocity about the Y axis to turn the 2D robot_forward vector toward the provided 2D target direction in global coordinates.
Parameters | |
---|---|
target | The 2D global target vector in XZ. |
turn_speed | The desired constant turn speed. |
robot_forward | The global 2D robot forward vector in XZ. |
def habitat. datasets. rearrange. navmesh_utils. get_largest_island_index(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder,
sim: habitat_sim.simulator.Simulator,
allow_outdoor: bool = True) -> int
Get the index of the largest NavMesh island. Optionally exclude outdoor islands.
NOTE: outdoor heuristic may need to be tuned, but parameters are default here.
If no islands exist satisfying the indoor constraints, then the entire navmesh -1 is returned.
def habitat. datasets. rearrange. navmesh_utils. is_accessible(sim: habitat_sim.simulator.Simulator,
point: _magnum.Vector3,
height: float,
nav_to_min_distance: float,
nav_island: int = -1,
target_object_ids: typing.Optional[typing.List[int]] = None) -> bool
Return True if the point is within a threshold distance (in XZ plane) of the nearest unoccluded navigable point on the selected island.
Parameters | |
---|---|
sim | Habitat Simulator instance. |
point | The query point. |
height | The height of the agent. Given navmesh snap point is grounded, the maximum height from which a visibility check should indicate non-occlusion. First check starts from this height. |
nav_to_min_distance | Minimum distance threshold. -1 opts out of the test and returns True (i.e. no minimum distance). |
nav_island | The NavMesh island on which to check accessibility. Default -1 is the full NavMesh. |
target_object_ids |
def habitat. datasets. rearrange. navmesh_utils. is_collision(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder,
trans: _magnum.Matrix4,
navmesh_offset: typing.List[typing.Tuple[float, float]],
island_idx: int) -> bool
Checks the given transform and navmesh offset points for navigability on the provided navmesh island. Returns True if any point is non-navigable.
Parameters | |
---|---|
pathfinder | The PathFinder instance defining the NavMesh. |
trans | The current agent transformation matrix. |
navmesh_offset | A list of 2D navmesh offset points to check. |
island_idx |
def habitat. datasets. rearrange. navmesh_utils. is_outdoor(pathfinder: habitat_sim._ext.habitat_sim_bindings.PathFinder,
sim: habitat_sim.simulator.Simulator,
island_ix: int,
num_samples: int = 100,
indoor_ratio_threshold: float = 0.95,
min_sample_dist: typing.Optional[float] = None,
max_sample_attempts: int = 200) -> bool
Heuristic to check if the specified NavMesh island is outdoor or indoor.
Parameters | |
---|---|
pathfinder | The NavMesh to check. |
sim | The Simulator instance. |
island_ix | The index of the island to check. -1 for all islands. |
num_samples | The number of samples to take. |
indoor_ratio_threshold | The percentage of samples classified as indoor necessary to pass the test. |
min_sample_dist | (optional) The minimum distance between samples. Default is no minimum distance. |
max_sample_attempts | The maximum number of sample to attempt to satisfy minimum distance. |
- Assumptions:
- The scene must have ceiling collision geometry covering all indoor areas.
- Indoor and outdoor spaces are separate navmeshes. Mixed interior/exterior navmeshes may be classified incorrectly and non-deterministically as the heuristic is based on sampling and thresholding.
def habitat. datasets. rearrange. navmesh_utils. snap_point_is_occluded(target: _magnum.Vector3,
snap_point: _magnum.Vector3,
height: float,
sim: habitat_sim.simulator.Simulator,
granularity: float = 0.2,
target_object_ids: typing.Optional[typing.List[int]] = None,
ignore_object_ids: typing.Optional[typing.List[int]] = None) -> bool
Uses raycasting to check whether a target is occluded given a navmesh snap point.
Parameters | |
---|---|
target | The 3D position which should be unoccluded from the snap point. |
snap_point | The navmesh snap point under consideration. |
height | The height of the agent above the navmesh. Assumes the navmesh snap point is on the ground. Should be the maximum relative distance from navmesh ground to which a visibility check should indicate non-occlusion. The first check starts from this height. (E.g. agent_eyes_y - agent_base_y) |
sim | The Simulator instance. |
granularity | The distance between raycast samples. Finer granularity is more accurate, but more expensive. |
target_object_ids | An optional set of object ids which indicate the target. If one of these objects is hit before any non-ignored object, the test is successful. |
ignore_object_ids | An optional set of object ids which should be ignored in occlusion check. |
NOTE: If agent’s eye height is known and only that height should be considered, provide eye height and granularity > height for fastest check.
- return:
- whether or not the target is considered occluded from the snap_point.