habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer class

Support class for simple visual debugging of a Simulator instance. Assumes the default agent (0) is a camera (i.e. there exists an RGB sensor coincident with agent 0 transformation).

Available for visual debugging from PDB! Example: from habitat.sims.habitat_simulator.debug_visualizer import DebugVisualizer dbv = DebugVisualizer(sim) dbv.get_observation().show() dbv.translate(mn.Vector3(1,0,0), show=True) dbv.peek(my_object, peek_all_axis=True).show()

Methods

def _peek_bb(self, bb: _magnum.Range3D, world_transform: typing.Optional[_magnum.Matrix4] = None, cam_local_pos: typing.Optional[_magnum.Vector3] = None, peek_all_axis: bool = False, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> DebugObservation
Internal helper function to generate image(s) of any bb for contextual debugging purposes. Compute a camera placement to view the bb. Show/save an observation. Return the filepath.
def create_dbv_agent(self, resolution: typing.Tuple[int, int] = (500, 500)) -> None
Create an initialize a new DebugVisualizer agent with a color sensor.
def get_observation(self, look_at: typing.Optional[_magnum.Vector3] = None, look_from: typing.Optional[_magnum.Vector3] = None) -> DebugObservation
Render a debug observation of the current state and return it. Optionally configure the camera transform.
def look_at(self, look_at: _magnum.Vector3, look_from: typing.Optional[_magnum.Vector3] = None, look_up: typing.Optional[_magnum.Vector3] = None) -> None
Point the debug camera at a target. Standard look_at function syntax.
def make_debug_video(self, output_path: typing.Optional[str] = None, prefix: str = '', fps: int = 4, obs_cache: typing.Optional[typing.List[DebugObservation]] = None) -> None
Produce and save a video from a set of debug observations.
def peek(self, subject = …, cam_local_pos: typing.Optional[_magnum.Vector3] = None, peek_all_axis: bool = False, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> DebugObservation
Generic “peek” function generating a DebugObservation image or a set of images centered on a subject and taking as input all reasonable ways to define a subject to peek. Use this function to quickly “peek” at an object or the top-down view of the full scene.
def render_debug_circles(self, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> None
Draw a set of debug circles with accompanying colors.
def render_debug_frame(self, axis_length: float = 1.0, transformation: typing.Optional[_magnum.Matrix4] = None) -> None
Render a coordinate frame of the configured length given a transformation. XYZ->RGB.
def render_debug_lines(self, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None) -> None
Draw a set of debug lines with accompanying colors.
def rotate(self, angle: float, axis: typing.Optional[_magnum.Vector3] = None, local: bool = False, show: bool = True) -> typing.Optional[DebugObservation]
Rotate the debug sensor agent by ‘angle’ radians about ‘axis’.
def translate(self, vec: _magnum.Vector3, local: bool = False, show: bool = True) -> typing.Optional[DebugObservation]
Translate the debug sensor agent by a delta vector.

Special methods

def __init__(self, sim: habitat_sim.simulator.Simulator, output_path: str = 'visual_debug_output/', resolution: typing.Tuple[int, int] = (500, 500)) -> None
Initialize the debugger provided a Simulator and the uuid of the debug sensor. NOTE: Expects the debug sensor attached to and coincident with agent 0’s frame.

Method documentation

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer._peek_bb(self, bb: _magnum.Range3D, world_transform: typing.Optional[_magnum.Matrix4] = None, cam_local_pos: typing.Optional[_magnum.Vector3] = None, peek_all_axis: bool = False, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> DebugObservation

Internal helper function to generate image(s) of any bb for contextual debugging purposes. Compute a camera placement to view the bb. Show/save an observation. Return the filepath.

Parameters
bb The entity’s local bounding box (provided by consumer functions.)
world_transform The entity’s world transform provided by consumer functions, default identity.
cam_local_pos Optionally provide a camera location in location local coordinates. Otherwise offset along local -Z axis from the object.
peek_all_axis Optionally create a merged 3x2 matrix of images looking at the object from all angles.
debug_lines Optionally provide a list of debug line render tuples, each with a list of points and a color. These will be displayed in all peek images.
debug_circles Optionally provide a list of debug line render circle Tuples, each with (center, radius, normal, color). These will be displayed in all peek images.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.create_dbv_agent(self, resolution: typing.Tuple[int, int] = (500, 500)) -> None

Create an initialize a new DebugVisualizer agent with a color sensor.

Parameters
resolution The desired sensor resolution for the new debug agent.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.get_observation(self, look_at: typing.Optional[_magnum.Vector3] = None, look_from: typing.Optional[_magnum.Vector3] = None) -> DebugObservation

Render a debug observation of the current state and return it. Optionally configure the camera transform.

Parameters
look_at 3D global position to point the camera towards.
look_from 3D global position of the camera.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.look_at(self, look_at: _magnum.Vector3, look_from: typing.Optional[_magnum.Vector3] = None, look_up: typing.Optional[_magnum.Vector3] = None) -> None

Point the debug camera at a target. Standard look_at function syntax.

Parameters
look_at 3D global position to point the camera towards.
look_from 3D global position of the camera.
look_up 3D global “up” vector for aligning the camera roll.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.make_debug_video(self, output_path: typing.Optional[str] = None, prefix: str = '', fps: int = 4, obs_cache: typing.Optional[typing.List[DebugObservation]] = None) -> None

Produce and save a video from a set of debug observations.

Parameters
output_path Optional directory path for saving the video. Otherwise use self.output_path.
prefix Optional prefix for output filename. Filename format: “<output_path><prefix><timestamp>”
fps Framerate of the video. Defaults to 4FPS expecting disjoint still frames.
obs_cache Optioanlly provide an external observation cache datastructure in place of self.debug_obs.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.peek(self, subject = …, cam_local_pos: typing.Optional[_magnum.Vector3] = None, peek_all_axis: bool = False, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> DebugObservation

Generic “peek” function generating a DebugObservation image or a set of images centered on a subject and taking as input all reasonable ways to define a subject to peek. Use this function to quickly “peek” at an object or the top-down view of the full scene.

Parameters
subject The subject to visualize. One of: ManagedRigidObject, ManagedArticulatedObject, an object_id integer, a string “stage”, “scene”, or handle of an object instance.
cam_local_pos Optionally provide a camera location in location local coordinates. Otherwise offset along local -Z axis from the object.
peek_all_axis Optionally create a merged 3x2 matrix of images looking at the object from all angles.
debug_lines Optionally provide a list of debug line render tuples, each with a list of points and a color. These will be displayed in all peek images.
debug_circles Optionally provide a list of debug line render circle Tuples, each with (center, radius, normal, color). These will be displayed in all peek images.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.render_debug_circles(self, debug_circles: typing.Optional[typing.List[typing.Tuple[_magnum.Vector3, float, _magnum.Vector3, _magnum.Color4]]] = None) -> None

Draw a set of debug circles with accompanying colors.

Parameters
debug_circles A list of debug line render circle Tuples, each with (center, radius, normal, color).

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.render_debug_frame(self, axis_length: float = 1.0, transformation: typing.Optional[_magnum.Matrix4] = None) -> None

Render a coordinate frame of the configured length given a transformation. XYZ->RGB.

Parameters
axis_length The length of the axis lines.
transformation The optional transform matrix of the axis. Identity if not provided.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.render_debug_lines(self, debug_lines: typing.Optional[typing.List[typing.Tuple[typing.List[_magnum.Vector3], _magnum.Color4]]] = None) -> None

Draw a set of debug lines with accompanying colors.

Parameters
debug_lines A set of debug line strips with accompanying colors. Each list entry contains a list of points and a color.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.rotate(self, angle: float, axis: typing.Optional[_magnum.Vector3] = None, local: bool = False, show: bool = True) -> typing.Optional[DebugObservation]

Rotate the debug sensor agent by ‘angle’ radians about ‘axis’.

Parameters
angle The angle of rotation in radians.
axis The rotation axis. Default Y axis.
local If True, the delta vector is applied in local space.
show If True, show the image from the resulting state.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.translate(self, vec: _magnum.Vector3, local: bool = False, show: bool = True) -> typing.Optional[DebugObservation]

Translate the debug sensor agent by a delta vector.

Parameters
vec The delta vector to translate by.
local If True, the delta vector is applied in local space.
show If True, show the image from the resulting state.

def habitat.sims.habitat_simulator.debug_visualizer.DebugVisualizer.__init__(self, sim: habitat_sim.simulator.Simulator, output_path: str = 'visual_debug_output/', resolution: typing.Tuple[int, int] = (500, 500)) -> None

Initialize the debugger provided a Simulator and the uuid of the debug sensor. NOTE: Expects the debug sensor attached to and coincident with agent 0’s frame.

Parameters
sim Simulator instance must be provided for attachment.
output_path Directory path for saving debug images and videos.
resolution The desired sensor resolution for any new debug agent.