diff --git a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/image_plot.py b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/image_plot.py index 0101723f5d..9dcb9f7588 100644 --- a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/image_plot.py +++ b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/image_plot.py @@ -26,11 +26,11 @@ def __init__( Pressing down the mouse gives the x and y values of each function at an x coordinate. Args: - image (np.ndarray): Image to display - label (str): Short descriptive text to the left of the plot - widget_height (int): Height of the plot in pixels - show_min_max (bool): Whether to show the min and max values of the image - unit (tuple): Tuple of (scale, name) for the unit of the image + image: Image to display + label: Short descriptive text to the left of the plot + widget_height: Height of the plot in pixels + show_min_max: Whether to show the min and max values of the image + unit: Tuple of (scale, name) for the unit of the image """ self._show_min_max = show_min_max diff --git a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/line_plot.py b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/line_plot.py index 08f3613360..9d23d25409 100644 --- a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/line_plot.py +++ b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/line_plot.py @@ -64,16 +64,13 @@ def __init__( """Create a new LiveLinePlot widget. Args: - y_data (list[list[float]]): A list of lists of floats containing the data to plot. Each list of floats - represents a series in the plot. - y_min (float, optional): The minimum y value to display. Defaults to -10. - y_max (float, optional): The maximum y value to display. Defaults to 10. - plot_height (int, optional): The height of the plot in pixels. Defaults to 150. - show_legend (bool, optional): Whether to display the legend. Defaults to True. - legends (list[str], optional): A list of strings containing the legend labels for each series. If None, - the default labels are "Series_0", "Series_1", etc. Defaults to None. - max_datapoints (int, optional): The maximum number of data points to display. If the number of data points - exceeds this value, the oldest data points are removed. Defaults to 200. + y_data: A list of lists of floats containing the data to plot. Each list of floats represents a series in the plot. + y_min: The minimum y value to display. Defaults to -10. + y_max: The maximum y value to display. Defaults to 10. + plot_height: The height of the plot in pixels. Defaults to 150. + show_legend: Whether to display the legend. Defaults to True. + legends: A list of strings containing the legend labels for each series. If None, the default labels are "Series_0", "Series_1", etc. Defaults to None. + max_datapoints: The maximum number of data points to display. If the number of data points exceeds this value, the oldest data points are removed. Defaults to 200. """ super().__init__(self._create_ui_widget()) self.plot_height = plot_height @@ -144,10 +141,10 @@ def add_datapoint(self, y_coords: list[float]): The data point is added to the end of the plot. If the number of data points exceeds the maximum number of data points, the oldest data point is removed. - y_coords is assumed to be a list of floats with the same length as the number of series in the plot. + ``y_coords`` is assumed to be a list of floats with the same length as the number of series in the plot. Args: - y_coords (List[float]): A list of floats containing the y coordinates of the new data points. + y_coords: A list of floats containing the y coordinates of the new data points. """ for idx, y_coord in enumerate(y_coords): @@ -215,7 +212,7 @@ def _build_stacked_plots(self, grid: bool = True): Args: - grid (bool, optional): Whether to display grid lines. Defaults to True. + grid: Whether to display grid lines. Defaults to True. """ # Reset lists which are populated in the build function @@ -229,8 +226,8 @@ def _build_single_plot(y_data: list[float], color: int, plot_idx: int): should only be called from within the build function of a frame. Args: - y_data (list[float]): The data to plot. - color (int): The color of the plot. + y_data: The data to plot. + color: The color of the plot. """ plot = ui.Plot( ui.Type.LINE, @@ -329,13 +326,6 @@ def _build_single_plot(y_data: list[float], color: int, plot_idx: int): ) self._tooltip_frame.set_mouse_pressed_fn(self._mouse_moved_on_plot) - # self._tooltip_frame.set_mouse_released_fn(self._on_mouse_released) - # self._tooltip_frame.set_computed_content_size_changed_fn( - # lambda *args: [plot.rebuild() for plot in self._plots] - # ) - - # Make the tooltip invisible - # self._on_mouse_released() # Create top label for the y-axis with ui.Placer(offset_x=-20, offset_y=-8): diff --git a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/ui_visualizer_base.py b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/ui_visualizer_base.py index 8697867dbd..0fb0c8d943 100644 --- a/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/ui_visualizer_base.py +++ b/source/extensions/omni.isaac.lab/omni/isaac/lab/ui/widgets/ui_visualizer_base.py @@ -12,7 +12,9 @@ class UiVisualizerBase: """Base Class for components that support debug visualizations that requires access to some UI elements. This class provides a set of functions that can be used to assign ui interfaces. + The following functions are provided: + * :func:`set_debug_vis`: Assigns a debug visualization interface. This function is called by the main UI when the checkbox for debug visualization is toggled. * :func:`set_vis_frame`: Assigns a small frame within the isaac lab tab that can be used to visualize debug @@ -59,9 +61,12 @@ def has_env_selection_implementation(self) -> bool: def set_env_selection(self, env_selection: int) -> bool: """Sets the selected environment id. + This function is called by the main UI when the user selects a different environment. + Args: env_selection: The currently selected environment id. + Returns: Whether the environment selection was successfully set. False if the component does not support environment selection. @@ -75,10 +80,13 @@ def set_env_selection(self, env_selection: int) -> bool: def set_window(self, window: Window) -> bool: """Sets the current main ui window. + This function is called by the main UI when the window is created. It allows the component to add custom UI elements to the window or to control the window and its elements. + Args: window: The ui window. + Returns: Whether the window was successfully set. False if the component does not support this functionality. @@ -92,10 +100,13 @@ def set_window(self, window: Window) -> bool: def set_vis_frame(self, vis_frame: Frame) -> bool: """Sets the debug visualization frame. + This function is called by the main UI when the window is created. It allows the component to modify a small frame within the orbit tab that can be used to visualize debug information. + Args: vis_frame: The debug visualization frame. + Returns: Whether the debug visualization frame was successfully set. False if the component does not support debug visualization. @@ -125,6 +136,7 @@ def _set_debug_vis_impl(self, debug_vis: bool): def _set_vis_frame_impl(self, vis_frame: Frame): """Set debug visualization into visualization objects. + This function is responsible for creating the visualization objects if they don't exist and input ``debug_vis`` is True. If the visualization objects exist, the function should set their visibility into the stage.