pyrcf.components.callback_handlers
Defines custom callbacks that can be run in the control loop (pre-step and post-step).
Submodules
Classes
Abstract base class for defining custom callbacks to be executed in the control loop. |
|
Execute multiple CustomCallbackBase callbacks at the same specified (max) frequency. |
|
Create a button in pybullet and specify the callback to apply the slider value to. |
|
Create a slider in pybullet and specify the callback to apply the slider value to. |
|
Draw a coordinate frame in pybullet that changes its pose based on the pose |
|
Visualise point(s)/sphere(s) in pybullet exposing a callback to change its position |
|
Create multiple sliders in pybullet and use values from all the sliders in a single |
|
Create a button in Tk and specify the callback to call when button is pressed. |
|
Create a slider in pybullet and specify the callback to apply the slider value to. |
|
Create multiple sliders and use values from all the sliders in a single callback. |
Package Contents
- class pyrcf.components.callback_handlers.CustomCallbackBase
Bases:
abc.ABCAbstract base class for defining custom callbacks to be executed in the control loop.
- abstract run_once() None
To be called in loop.
- cleanup() None
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.RateTriggeredMultiCallbacks(gui_callbacks: List[CustomCallbackBase], rate: float = None, clock: pyrcf.utils.time_utils.ClockBase = PythonPerfClock())
Bases:
CustomCallbackBaseExecute multiple CustomCallbackBase callbacks at the same specified (max) frequency.
- _callbacks: List[CustomCallbackBase] = []
- add_callback(gui_callback: CustomCallbackBase)
Add an instance of PbGUISliderCallback or PbMultiGUISliderSingleCallback to the same rate trigger.
- Parameters:
gui_callback (CustomCallbackBase) – The GUI callback instance to add.
- run_once()
This method has to be called for the slider callbacks to be executed. Will only execute if the trigger rate is met.
- cleanup()
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.PbGUIButtonCallback(button_name: str, callback: Callable[[], None], cid: int)
Bases:
PbGUICallbackCreate a button in pybullet and specify the callback to apply the slider value to.
- _button
- _callback
- run_once()
This method has to be called for checking button press and for the callback to be executed.
- cleanup()
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.PbGUISliderCallback(slider_name: str, slider_lower_lim: float, slider_upper_lim: float, slider_default_val: float, callback: Callable[[float], None], cid: int, run_only_if_value_changed: bool = True, mapping_function: Callable[[float], float] = lambda x: ...)
Bases:
PbGUICallbackCreate a slider in pybullet and specify the callback to apply the slider value to.
- _slider
- _check_first = True
- _callback
- run_once() None
This method has to be called for the callback to be executed.
- cleanup()
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.PbDebugFrameVizCallback(callback: Callable[[], Tuple[Vector3D, QuatType]], cid: int, line_length: float = 0.2, line_width: float = 2, duration: float = 0.0)
Bases:
PbGUICallbackDraw a coordinate frame in pybullet that changes its pose based on the pose returned by a callback function.
- _frame_viz
- _callback
- run_once()
This method has to be called for for getting the pose from the callback function and updating the frame visualiser’s pose.
- cleanup()
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.PbDebugPointsCallback(callback: Callable[[], List[Vector3D]], cid: int, point_positions: List[Vector3D] = None, point_size: float = 1.0, rgb: Tuple[float, float, float] = (1, 0, 0), lifetime: float = 0.0)
Bases:
PbGUICallbackVisualise point(s)/sphere(s) in pybullet exposing a callback to change its position in the world.
- _points_viz
- _callback
- run_once()
To be called in loop.
- cleanup()
Override if custom cleaning up/shutting down is required.
- class pyrcf.components.callback_handlers.PbMultiGUISliderSingleCallback(slider_names: List[str], slider_lower_lims: List[float], slider_upper_lims: List[float], slider_default_vals: List[float], callback: Callable[[List[float]], None], cid: int, run_only_if_value_changed: bool = True, mapping_functions: Callable[[float], float] | List[Callable[[float], float]] = lambda x: ...)
Bases:
PbGUICallbackCreate multiple sliders in pybullet and use values from all the sliders in a single callback.
- _sliders: List[pyrcf.utils.gui_utils.pb_gui_utils.PybulletGUISlider] = []
- _check_first = True
- _callback
- run_once()
This method has to be called for the callback to be executed.
- cleanup()
Override if custom cleaning up/shutting down is required.
- get_sliders() List[pyrcf.utils.gui_utils.pb_gui_utils.PybulletGUISlider]
Get a list of all slider objects.
- Returns:
List of slider objects.
- Return type:
List[PybulletGUISlider]
- class pyrcf.components.callback_handlers.TkGUIButtonCallback(button_name: str, callback: Callable[[], None], tk_master: pyrcf.utils.gui_utils.tkinter_gui_utils.TkinterWidgetMaster = None)
Bases:
TkGUICallbackCreate a button in Tk and specify the callback to call when button is pressed.
- _button
- _callback
- run_once()
This method has to be called for checking button press and for the callback to be executed.
- remove_gui_object()
- class pyrcf.components.callback_handlers.TkGUISliderCallback(slider_name: str, slider_lower_lim: float, slider_upper_lim: float, slider_default_val: float, callback: Callable[[float], None], tk_master: pyrcf.utils.gui_utils.tkinter_gui_utils.TkinterWidgetMaster = None, mapping_function: Callable[[float], float] = lambda x: ..., slider_resolution: float = 0.1)
Bases:
TkGUICallbackCreate a slider in pybullet and specify the callback to apply the slider value to.
- _slider
- _callback
- run_once() None
This method has to be called for the callback to be executed.
- remove_gui_object()
- class pyrcf.components.callback_handlers.TkMultiGUISliderSingleCallback(slider_names: List[str], slider_lower_lims: List[float], slider_upper_lims: List[float], slider_default_vals: List[float], callback: Callable[[List[float]], None], tk_master: pyrcf.utils.gui_utils.tkinter_gui_utils.TkinterWidgetMaster = None, mapping_functions: Callable[[float], float] | List[Callable[[float], float]] = lambda x: ..., slider_resolutions: List[float] | float = 0.1)
Bases:
TkGUICallbackCreate multiple sliders and use values from all the sliders in a single callback.
- _sliders: List[pyrcf.utils.gui_utils.tkinter_gui_utils.TkinterGUISlider] = []
- _callback
- run_once()
This method has to be called for the callback to be executed.
- remove_gui_object()
- get_sliders() List[pyrcf.utils.gui_utils.tkinter_gui_utils.TkinterGUISlider]