visualizer

Visualization utils for pyCub simulator

Author:

Lukas Rustler

class icub_pybullet.visualizer.Visualizer(client: pyCub)[source]

Bases: object

Class to help with custom rendering

Parameters:

client (pyCub) – pyCub instance

class EyeWindow(eye: str, parent: Visualizer)[source]

Bases: object

Class to handle windows for eye rendering

Parameters:
  • eye (str) – name of the eye

  • parent (Visualizer) – The parent class (Visualizer).

MENU_IDS = {'l_eye': [2, 3, 8], 'r_eye': [4, 5, 9]}
POSITIONS = {'l_eye': [320, 560], 'r_eye': [0, 560]}
get_depth_image() None[source]

Small function to get image from open3d

Returns:

Return type:

get_image() None[source]

Small function to get image from open3d

Returns:

Return type:

on_close() bool[source]

Small function to delete the window from the parent class

on_mouse(event: MouseEvent) int[source]

Small function to ignore mouse events

Parameters:

event (gui.MouseEvent) – Mouse event

save_depth_image(im: Image) None[source]

Callback to get images from open3d

Parameters:

im (o3d.geometry.Image) – the image to be saves

save_image(im: Image) None[source]

Callback to get images from open3d

Parameters:

im (o3d.geometry.Image) – the image to be saves

saveimages() None[source]

Function to save stream of images to file

unproject(u, v, d)[source]
class MenuCallback(menu_id: int, parent: Visualizer)[source]

Bases: object

Class to handle menu callbacks.

Initialize the MenuCallback class.

Parameters:
  • menu_id (int) – The id of the menu.

  • parent (pointer to the class of visualizer.Visualizer type) – The parent class (Visualizer).

input_completed(text: str | None = None)[source]

Callback for the dialog

Parameters:

text (str) – input text

Returns:

Return type:

save_image(im: Image, mode: int) None[source]

Save the image. It shows FileDialog to find path for image save. It saves it with the current resolution of the window.

Parameters:
  • im (o3d.geometry.Image) – The image to be saved.

  • mode (int) – The mode of the image. 0 for RGB, 1 for depth.

wait_for_dialog_completion() None[source]

Help function to keep the gui loop running

find_xyz_rpy(mesh_name: str, urdf_name: str | None = 'robot') Tuple[list, list, float, str][source]

Find the xyz, rpy and scales values.

Parameters:
  • mesh_name (str) – The name of the mesh.

  • urdf_name (str, optional, default="robot") – The name of the urdf.

Returns:

The xyz, rpy, and scales, link_name

Return type:

list, list, float, str

read_info(obj_id: int) int[source]

Read info from PyBullet

Parameters:

obj_id (int) – id of the object; given by pybullet

Returns:

0 for success

Return type:

int

render() None[source]

Render all the things

show_first(urdf_name: str | None = 'robot') None[source]

Show the first batch of meshes in the visualizer. It loads the meshes and saves the to dict for quicker use later

Parameters:

urdf_name (str, optional, default="robot") – The name of the urdf to be used.

show_mesh() None[source]

Function to parse info about meshes from PyBullet