pyrcf.utils.gui_utils

Submodules

Classes

PybulletGUIButton

Create a button in Pybullet GUI, and check if it was pressed.

PybulletDebugPoints

Add 3D points to pybullet sim world gui.

PybulletDebugFrameViz

Draw a coordinate frame in pybullet as specified pose in the world.

PybulletGUISlider

Create a slider gui in pybullet.

PybulletText

Add text to pybullet sim world gui.

PybulletTextWithRateTrigger

Add text to pybullet sim world gui, that will only change at the

TkinterGUIButton

Create a button in Tkinter GUI, and check if it was pressed.

TkinterGUISlider

Create a slider gui in Tkinter.

TkinterWidgetMaster

Handles a Tk window (called 'master').

Package Contents

class pyrcf.utils.gui_utils.PybulletGUIButton(name: str, cid: int)

Create a button in Pybullet GUI, and check if it was pressed. Meant to be used in a loop.

cid
_id
_val = 1
reset()

Not really useful anymore (legacy)

was_pressed() bool

Checks if this button was pressed since the last time this method was called.

remove()

Remove the button from the gui.

class pyrcf.utils.gui_utils.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.

_lifetime = 0.0
_size = 1.0
_rgb = (1, 0, 0)
_cid = 0
_points_id = -1
_draw_points(point_positions: List[Vector3D])
update_point_positions(point_positions: List[Vector3D])

Update the positions of the debug points in pybullet.

Parameters:

point_positions (List[Vector3D]) – List of positions for the points in world.

remove()

Remove the debug points object from pybullet.

class pyrcf.utils.gui_utils.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.

_len = 0.2
_lw = 2
_duration = 0.0
_cid
_line_ids
_draw_lines(pos: Vector3D, ori: QuatType)
update_frame_pose(position: Vector3D, orientation: QuatType)

Update the pose of an existing frame viz in pybullet.

Parameters:
  • position (Vector3D) – Position of coordinate frame in world.

  • orientation (QuatType) – Orientation quaternion of the frame in the world.

remove()

Remove the frame viz from gui.

class pyrcf.utils.gui_utils.PybulletGUISlider(name: str, lower_lim: float, upper_lim: float, default_val: float, cid: int, mapping_function: Callable[[float], float] = lambda x: ...)

Create a slider gui in pybullet.

cid
_id
_mapping_function
_last_recorded_val = None
get_value() float

Read the value from the slider gui.

property last_read_value: float
value_changed() bool
remove()

Remove the slider from gui.

abstract set_value(value: float)
class pyrcf.utils.gui_utils.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.

cid = 0
_pos
_color = (0, 0, 0)
_size = 3.0
_t = 0.0
_id
update_text(text: str)

Update the text string for this debug object.

Parameters:

text (str) – The new text to replace with.

remove()

Remove text from pybullet.

class pyrcf.utils.gui_utils.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: 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.

_trigger
update_text(text: str)

Update the text string for this debug object. Will only be triggered if the specified rate is satisified (lower bound).

Parameters:

text (str) – The new text to replace with.

class pyrcf.utils.gui_utils.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.

tk_master = None
_prev_val = 0
_val = 0
button
_button_press_cb()
was_pressed() bool

Checks if this button was pressed since the last time this method was called.

remove(permanent: bool = True)

Remove the slider from gui.

class pyrcf.utils.gui_utils.TkinterGUISlider(name: str, lower_lim: float, upper_lim: float, default_val: float, tk_master: TkinterWidgetMaster = None, mapping_function: Callable[[float], float] = lambda x: ..., slider_resolution: float = 0.1)

Create a slider gui in Tkinter.

tk_master = None
slider
_mapping_function
get_value()

Read the value from the slider gui.

remove(permanent: bool = True)

Remove the slider from gui.

set_value(value: float)

Set the value of the slider to specified value.

Parameters:

value (float) – Value to set the slider to.

class pyrcf.utils.gui_utils.TkinterWidgetMaster(max_update_rate: float = 100, window_name: str = 'Default Tk Master')

Handles a Tk window (called ‘master’).

master_widget
trigger
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.