pyrcf.components.ctrl_loop_debuggers.pybullet_robot_state_debugger
Classes
This control loop debugger will create a dummy visual robot in pybullet which |
Module Contents
- class pyrcf.components.ctrl_loop_debuggers.pybullet_robot_state_debugger.PybulletRobotStateDebugger(urdf_path: str, rate: float = None, clock: pyrcf.utils.time_utils.ClockBase = PythonPerfClock(), cid: int = 0, enable_toggle_button: bool = True, **bullet_debug_robot_kwargs)
Bases:
pyrcf.components.ctrl_loop_debuggers.ctrl_loop_debugger_base.CtrlLoopDebuggerBaseThis control loop debugger will create a dummy visual robot in pybullet which will simply mimic the joint states and base pose read from the robot_state (after passing through the state estimator update). This class can be used to visualise the robot states being read when the robot is running outside pybullet (e.g. real robot or remote).
- _debugger_robot
- _toggler_button = None
- _run_once_impl(t: float, dt: float, robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, agent_outputs: List[Tuple[pyrcf.core.types.LocalMotionPlan, pyrcf.core.types.RobotCmd]], robot_cmd: pyrcf.core.types.RobotCmd)
The main method that will be run in every control loop. Should be overridden in the implemented child of CtrlLoopDebuggerBase.
This method will be called automatically if the timer is triggered, as long as the main run_once() method is called continuously in the control loop.
- Parameters:
t (float) – Current time in the control loop.
dt (float) – The current dt in the control loop.
robot_state (RobotState) – robot state after update from the state estimator in the control loop.
global_plan (GlobalMotionPlan) – The global plan output produced by the global planner.
agent_outputs (List[Tuple[LocalMotionPlan, RobotCmd]]) – The list of outputs from all agents in the control loop.
robot_cmd (RobotCmd) – The final command written to the robot.
- shutdown()
Cleanly shutdown the debugger. Override in child class if required. The base class implements an empty function.
- classmethod fromBulletRobotInstance(robot: pyrcf.components.robot_interfaces.simulation.pybullet_robot.PybulletRobot, rate: float = None, clock: pyrcf.utils.time_utils.ClockBase = PythonPerfClock(), enable_toggle_button: bool = True, **bullet_debug_robot_kwargs) PybulletRobotStateDebugger
Creates an instance of PybulletRobotStateDebugger using an existing PybulletRobot child class object.
- Parameters:
robot (PybulletRobot) – The robot instance (will not be modified).
rate (float, optional) – Rate at which this should be triggered. Defaults to None (i.e. use control loop rate).
clock (ClockBase, optional) – The clock to use for timer. Defaults to PythonPerfClock().
cid (int, optional) – The pybullet physics client ID to connect to. Defaults to 0.
enable_toggle_button (bool, optional) – If set to True, this will create a button in the pybullet GUI to enable/disable the VISUALISATION of this debugger. Defaults to True. NOTE: This only affects the visualisation! Does not disable the actual debugger. NOTE: There can be an overhead when the visualisation is toggled on and off.
**bullet_debug_robot_kwargs – Additional keyword arguments can be passed here. All keyword arguments to PybulletDebugRobot is allowed here (e.g. use rgba=[,,,] for setting the visualisation color of this debug robot)
- Returns:
- PybulletRobotStateDebugger instance created using the urdf and
cid from the passed robot object.
- Return type: