robosuite.renderers.nvisii package#

Submodules#

robosuite.renderers.nvisii.nvisii_renderer module#

class robosuite.renderers.nvisii.nvisii_renderer.NVISIIRenderer(env, img_path='images/', width=500, height=500, spp=256, use_noise=False, debug_mode=False, video_mode=False, video_path='videos/', video_name='robosuite_video_0.mp4', video_fps=60, verbose=1, vision_modalities=None)#

Bases: robosuite.renderers.base.Renderer

close()#

Deinitializes the nvisii rendering environment

get_pixel_obs()#

Get the pixel observations from the given renderer

Returns

numpy array representing pixels of renderer

Return type

numpyarr

randomize_colors(N, bright=True)#

Modified from https://github.com/matterport/Mask_RCNN/blob/master/mrcnn/visualize.py#L59 Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB.

render(render_type='png')#

Renders an image of the NVISII renderer

Parameters

render_type (string, optional) – Type of file to save as. Defaults to ‘png’

render_data_to_file(img_file)#
render_segmentation_data(img_file)#
render_to_file(img_file)#
reset()#

Reset the renderer with initial states for environment

segmentation_to_rgb(seg_im, random_colors=False)#

Helper function to visualize segmentations as RGB frames. NOTE: assumes that geom IDs go up to 255 at most - if not, multiple geoms might be assigned to the same color.

set_camera_pos_quat(pos, quat)#
tag_in_name(name)#

Checks if one of the tags in body tags in the name

Parameters

name (string) – Name of component

update()#

Updates the states for the wrapper given a certain action

Parameters

action (np-array) – The action the robot should take

robosuite.renderers.nvisii.nvisii_utils module#

robosuite.renderers.nvisii.nvisii_utils.load_object(geom, geom_name, geom_type, geom_quat, geom_pos, geom_size, geom_scale, geom_rgba, geom_tex_name, geom_tex_file, class_id, meshes)#

Function that initializes the meshes in the memory.

Parameters
  • geom (XML element) – Object in XML file to load

  • geom_name (str) – Name for the object.

  • geom_type (str) – Type of the object. Types include “box”, “cylinder”, or “mesh”.

  • geom_quat (array) – Quaternion (wxyz) of the object.

  • geom_pos (array) – Position of the object.

  • geom_size (array) – Size of the object.

  • geom_scale (array) – Scale of the object.

  • geom_rgba (array) – Color of the object. This is only used if the geom type is not a mesh and there is no specified material.

  • geom_tex_name (str) – Name of the texture for the object

  • geom_tex_file (str) – File of the texture for the object

  • class_id (int) – Class id for the component

  • meshes (dict) – Meshes for the object

robosuite.renderers.nvisii.parser module#

class robosuite.renderers.nvisii.parser.Components(obj, geom_index, element_id, parent_body_name, geom_pos, geom_quat, dynamic)#

Bases: tuple

dynamic#

Alias for field number 6

element_id#

Alias for field number 2

geom_index#

Alias for field number 1

geom_pos#

Alias for field number 4

geom_quat#

Alias for field number 5

obj#

Alias for field number 0

parent_body_name#

Alias for field number 3

class robosuite.renderers.nvisii.parser.Parser(renderer, env, segmentation_type)#

Bases: robosuite.renderers.base_parser.BaseParser

create_class_mapping()#

Create class name to index mapping for both semantic and instance segmentation.

get_class_id(geom_index, element_id)#

Given index of the geom object get the class id based on self.segmentation type.

parse_geometries()#

Iterate through each goemetry and load it in the NVISII renderer.

parse_materials()#

Parse all materials and use texture mapping to initialize materials

parse_meshes()#

Create mapping of meshes.

parse_textures()#

Parse and load all textures and store them

tag_in_name(name, tags)#

Checks if one of the tags in body tags in the name

Parameters
  • name (str) – Name of geom element.

  • tags (array) – List of keywords to check from.

Module contents#