habitat.tasks.rearrange.utils module

Classes

class CacheHelper
class CollisionDetails
class IkHelper
class UsesArticulatedAgentInterface
For sensors or actions that are agent specific. Used to split actions and sensors between multiple agents.

Functions

def _get_robot_spawns(target_position: numpy.ndarray, rotation_perturbation_noise: float, distance_threshold: float, sim, num_spawn_attempts: int, filter_colliding_states: bool, agent: typing.Optional[articulated_agents.MobileManipulator] = None) -> typing.Tuple[_magnum.Vector3, float, bool]
Attempts to place the robot near the target position, facing towards it. This does NOT set the position or angle of the robot, even if a place is successful.
def _place_robot_at_closest_point(target_position: numpy.ndarray, sim, agent: typing.Optional[articulated_agents.MobileManipulator] = None)
Gets the agent’s position and orientation at the closest point to the target position. :return: The robot’s start position, rotation, and whether the placement was a failure (True for failure, False for success).
def add_perf_timing_func(name: typing.Optional[str] = None)
Function decorator for logging the speed of a method to the RearrangeSim. This must either be applied to methods from RearrangeSim or to methods from objects that contain self._sim so this decorator can access the underlying RearrangeSim instance to log the speed. This scopes the logging name so nested function calls will include the outer perf timing name separate by a “.”.
def angle_between(v1: typing.Tuple[_magnum.Vector3, numpy.ndarray, typing.List], v2: typing.Tuple[_magnum.Vector3, numpy.ndarray, typing.List]) -> float
Angle (in radians) between two vectors
def batch_transform_point(points: numpy.ndarray, transform_matrix: _magnum.Matrix4, dtype = <class 'numpy.float32'>) -> numpy.ndarray
def coll_name_matches(coll, name)
def convert_legacy_cfg(obj_list)
def euler_to_quat(rpy)
def general_sim_collision(sim: habitat_sim.simulator.Simulator, agent_embodiment: articulated_agents.MobileManipulator, ignore_object_ids: typing.Optional[typing.List[int]] = None) -> typing.Tuple[bool, CollisionDetails]
Proxy for “rearrange_collision()” which does not require a RearrangeSim.
def get_angle_to_pos(rel_pos: numpy.ndarray) -> float
Get the 1D orientation angle (around Y axis) for an agent with X axis forward to face toward a relative 3D position.
def get_camera_lookat_relative_to_vertial_line(agent) -> float
Get the camera looking angles to a vertical line to the ground
def get_camera_object_angle(cam_T: _magnum.Matrix4, obj_pos: typing.Tuple[_magnum.Vector3, numpy.ndarray, typing.List], center_cone_vector: typing.Tuple[_magnum.Vector3, numpy.ndarray, typing.List]) -> float
Calculates angle between camera line-of-sight and given global position
def get_camera_transform(cur_articulated_agent) -> _magnum.Matrix4
Get the camera transformation
def is_pb_installed() -> bool
def make_border_red(img)
def make_render_only(obj, sim)
def place_agent_at_dist_from_pos(target_position: numpy.ndarray, rotation_perturbation_noise: float, distance_threshold: float, sim, num_spawn_attempts: int, filter_colliding_states: bool, agent: typing.Optional[articulated_agents.MobileManipulator] = None, navmesh_offset: typing.Optional[typing.List[typing.Tuple[float, float]]] = None)
Places the robot at closest point if distance_threshold is -1.0 otherwise will place the robot at distance_threshold away.
def place_robot_at_closest_point_with_navmesh(target_position: numpy.ndarray, sim, navmesh_offset: typing.Optional[typing.List[typing.Tuple[float, float]]] = None, agent: typing.Optional[articulated_agents.MobileManipulator] = None)
Gets the agent’s position and orientation at the closest point to the target position. :return: The robot’s start position, rotation, and whether the placement was a failure (True for failure, False for success).
def rearrange_collision(sim: RearrangeSim, count_obj_colls: bool, verbose: bool = False, ignore_object_ids: typing.Optional[typing.List[int]] = None, ignore_base: bool = True, get_extra_coll_data: bool = False, agent_idx: typing.Optional[int] = None) -> typing.Tuple[bool, CollisionDetails]
Defines what counts as a collision for the Rearrange environment execution.
def set_agent_base_via_obj_trans(position: numpy.ndarray, rotation: float, agent)
Set the agent’s base position and rotation via object transformation
def write_gfx_replay(gfx_keyframe_str, task_config, ep_id)
Writes the all replay frames to a file for later replay. Filename is of the form ‘episodeX.replay.json’ where X is the episode ID.

Data

TYPE_CHECKING = False
p = None

Function documentation

def habitat.tasks.rearrange.utils._get_robot_spawns(target_position: numpy.ndarray, rotation_perturbation_noise: float, distance_threshold: float, sim, num_spawn_attempts: int, filter_colliding_states: bool, agent: typing.Optional[articulated_agents.MobileManipulator] = None) -> typing.Tuple[_magnum.Vector3, float, bool]

Attempts to place the robot near the target position, facing towards it. This does NOT set the position or angle of the robot, even if a place is successful.

Parameters
target_position The position of the target. This point is not necessarily on the navmesh.
rotation_perturbation_noise The amount of noise to add to the robot’s rotation.
distance_threshold The maximum distance from the target.
sim The RearrangeSimulator instance.
num_spawn_attempts The number of sample attempts for the distance threshold.
filter_colliding_states Whether or not to filter out states in which the robot is colliding with the scene. If True, runs discrete collision detection, otherwise returns the sampled state without checking.
agent The agent to get the state for. If not specified, defaults to the simulator’s articulated agent.

def habitat.tasks.rearrange.utils.add_perf_timing_func(name: typing.Optional[str] = None)

Function decorator for logging the speed of a method to the RearrangeSim. This must either be applied to methods from RearrangeSim or to methods from objects that contain self._sim so this decorator can access the underlying RearrangeSim instance to log the speed. This scopes the logging name so nested function calls will include the outer perf timing name separate by a “.”.

Parameters
name The name of the performance logging key. If unspecified, this defaults to “ModuleName[FuncName]”

def habitat.tasks.rearrange.utils.general_sim_collision(sim: habitat_sim.simulator.Simulator, agent_embodiment: articulated_agents.MobileManipulator, ignore_object_ids: typing.Optional[typing.List[int]] = None) -> typing.Tuple[bool, CollisionDetails]

Proxy for “rearrange_collision()” which does not require a RearrangeSim.

Used for testing functions which require a collision testing routine.

return:
boolean flag denoting collisions and a details struct (not complete)

def habitat.tasks.rearrange.utils.get_angle_to_pos(rel_pos: numpy.ndarray) -> float

Get the 1D orientation angle (around Y axis) for an agent with X axis forward to face toward a relative 3D position.

Parameters
rel_pos Relative 3D positive from the robot to the target like: target_pos - robot_pos.