pyrcf.utils.gui_utils ===================== .. py:module:: pyrcf.utils.gui_utils Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/pyrcf/utils/gui_utils/pb_gui_utils/index /autoapi/pyrcf/utils/gui_utils/tkinter_gui_utils/index Classes ------- .. autoapisummary:: pyrcf.utils.gui_utils.PybulletGUIButton pyrcf.utils.gui_utils.PybulletDebugPoints pyrcf.utils.gui_utils.PybulletDebugFrameViz pyrcf.utils.gui_utils.PybulletGUISlider pyrcf.utils.gui_utils.PybulletText pyrcf.utils.gui_utils.PybulletTextWithRateTrigger pyrcf.utils.gui_utils.TkinterGUIButton pyrcf.utils.gui_utils.TkinterGUISlider pyrcf.utils.gui_utils.TkinterWidgetMaster Package Contents ---------------- .. py:class:: PybulletGUIButton(name: str, cid: int) Create a button in Pybullet GUI, and check if it was pressed. Meant to be used in a loop. .. py:attribute:: cid .. py:attribute:: _id .. py:attribute:: _val :value: 1 .. py:method:: reset() Not really useful anymore (legacy) .. py:method:: was_pressed() -> bool Checks if this button was pressed since the last time this method was called. .. py:method:: remove() Remove the button from the gui. .. py:class:: PybulletDebugPoints(point_positions: List[Vector3D] = None, point_size: float = 1.0, rgb: Tuple[float, float, float] = (1, 0, 0), lifetime: float = 0.0, cid: int = 0) Add 3D points to pybullet sim world gui. .. py:attribute:: _lifetime :value: 0.0 .. py:attribute:: _size :value: 1.0 .. py:attribute:: _rgb :value: (1, 0, 0) .. py:attribute:: _cid :value: 0 .. py:attribute:: _points_id :value: -1 .. py:method:: _draw_points(point_positions: List[Vector3D]) .. py:method:: update_point_positions(point_positions: List[Vector3D]) Update the positions of the debug points in pybullet. :param point_positions: List of positions for the points in world. :type point_positions: List[Vector3D] .. py:method:: remove() Remove the debug points object from pybullet. .. py:class:: PybulletDebugFrameViz(cid: int, position: Vector3D = None, orientation: QuatType = np.array([0, 0, 0, 1]), line_length: float = 0.2, line_width: float = 2, duration: float = 0.0, draw_at_init: bool = True) Draw a coordinate frame in pybullet as specified pose in the world. .. py:attribute:: _len :value: 0.2 .. py:attribute:: _lw :value: 2 .. py:attribute:: _duration :value: 0.0 .. py:attribute:: _cid .. py:attribute:: _line_ids .. py:method:: _draw_lines(pos: Vector3D, ori: QuatType) .. py:method:: update_frame_pose(position: Vector3D, orientation: QuatType) Update the pose of an existing frame viz in pybullet. :param position: Position of coordinate frame in world. :type position: Vector3D :param orientation: Orientation quaternion of the frame in the world. :type orientation: QuatType .. py:method:: remove() Remove the frame viz from gui. .. py:class:: PybulletGUISlider(name: str, lower_lim: float, upper_lim: float, default_val: float, cid: int, mapping_function: Callable[[float], float] = lambda x: x) Create a slider gui in pybullet. .. py:attribute:: cid .. py:attribute:: _id .. py:attribute:: _mapping_function .. py:attribute:: _last_recorded_val :value: None .. py:method:: get_value() -> float Read the value from the slider gui. .. py:property:: last_read_value :type: float .. py:method:: value_changed() -> bool .. py:method:: remove() Remove the slider from gui. .. py:method:: set_value(value: float) :abstractmethod: .. py:class:: PybulletText(text_position: Tuple[float, float, float], default_text: str = '', text_color: Tuple[float, float, float] = (0, 0, 0), text_size: float = 3.0, lifetime: float = 0.0, cid: int = 0) Add text to pybullet sim world gui. .. py:attribute:: cid :value: 0 .. py:attribute:: _pos .. py:attribute:: _color :value: (0, 0, 0) .. py:attribute:: _size :value: 3.0 .. py:attribute:: _t :value: 0.0 .. py:attribute:: _id .. py:method:: update_text(text: str) Update the text string for this debug object. :param text: The new text to replace with. :type text: str .. py:method:: remove() Remove text from pybullet. .. py:class:: PybulletTextWithRateTrigger(text_position: Tuple[float, float, float], rate: float = 1, default_text: str = '', text_color: Tuple[float, float, float] = (0, 0, 0), text_size: float = 3.0, lifetime: float = 0.0, cid: int = 0) Bases: :py:obj:`PybulletText` Add text to pybullet sim world gui, that will only change at the specified rate (even if `update_text` is called at a higher frequency). This is useful if this method is called in a high frequency loop such as a control loop, and text has to be rendered only at a lower frequency. .. py:attribute:: _trigger .. py:method:: update_text(text: str) Update the text string for this debug object. Will only be triggered if the specified rate is satisified (lower bound). :param text: The new text to replace with. :type text: str .. py:class:: TkinterGUIButton(name: str, tk_master: TkinterWidgetMaster = None) Create a button in Tkinter GUI, and check if it was pressed. Meant to be used in a loop. .. py:attribute:: tk_master :value: None .. py:attribute:: _prev_val :value: 0 .. py:attribute:: _val :value: 0 .. py:attribute:: button .. py:method:: _button_press_cb() .. py:method:: was_pressed() -> bool Checks if this button was pressed since the last time this method was called. .. py:method:: remove(permanent: bool = True) Remove the slider from gui. .. py:class:: TkinterGUISlider(name: str, lower_lim: float, upper_lim: float, default_val: float, tk_master: TkinterWidgetMaster = None, mapping_function: Callable[[float], float] = lambda x: x, slider_resolution: float = 0.1) Create a slider gui in Tkinter. .. py:attribute:: tk_master :value: None .. py:attribute:: slider .. py:attribute:: _mapping_function .. py:method:: get_value() Read the value from the slider gui. .. py:method:: remove(permanent: bool = True) Remove the slider from gui. .. py:method:: set_value(value: float) Set the value of the slider to specified value. :param value: Value to set the slider to. :type value: float .. py:class:: TkinterWidgetMaster(max_update_rate: float = 100, window_name: str = 'Default Tk Master') Handles a Tk window (called 'master'). .. py:attribute:: master_widget .. py:attribute:: trigger .. py:method:: update() The update method to be called in a loop to refresh all the widgets attached to this window. This will call the master update only if the rate specified during construction is met.