1- """DearPyGui teleop bridge: three sliders for ``(vx, vy, ωz)`` in a side window.
1+ """DearPyGui twist bridge: three sliders for ``(vx, vy, ωz)`` in a side window.
2+
3+ Drives a 3-component velocity-twist command term (``vx``, ``vy``, ``ωz``). Not
4+ a generic command bridge — the layout is hardcoded to that shape.
25
36Optional extra (``uv sync --extra teleop`` installs ``dearpygui``). Lazy import
47inside :py:meth:`on_build` so importing this module never crashes core when the
3437_logger = logging .getLogger (__name__ )
3538
3639
37- @dataclass
38- class DearPyGuiCommandBridgeCfg (BridgeCfg ):
39- """Configuration for :class:`DearPyGuiCommandBridge`."""
40+ @dataclass (kw_only = True )
41+ class DearPyGuiTwistBridgeCfg (BridgeCfg ):
42+ """Configuration for :class:`DearPyGuiTwistBridge`.
43+
44+ Range fields are required (no defaults): a teleop GUI cannot guess sensible
45+ slider limits for an unknown robot, so the caller must set them to the
46+ twist command term's actual range.
47+ """
48+
49+ vx_range : tuple [float , float ]
50+ """Slider min/max for ``vx`` (m/s). Set to your robot's twist command limits."""
51+
52+ vy_range : tuple [float , float ]
53+ """Slider min/max for ``vy`` (m/s). Set to your robot's twist command limits."""
54+
55+ wz_range : tuple [float , float ]
56+ """Slider min/max for ``ωz`` (rad/s). Set to your robot's twist command limits."""
4057
4158 command_name : str = "twist"
4259 """Name of the command term to drive."""
4360
44- vx_range : tuple [float , float ] = (- 2.0 , 2.0 )
45- vy_range : tuple [float , float ] = (- 1.0 , 1.0 )
46- wz_range : tuple [float , float ] = (- 1.5 , 1.5 )
47- """Slider min/max — defaults match the Unitree G1 velocity ranges."""
48-
4961 default_vx : float = 0.0
5062 default_vy : float = 0.0
5163 default_wz : float = 0.0
5264 """Initial slider values, also written into the command buffer at attach so
53- the very first obs the policy sees is in-distribution. Useful when the
54- trained policy is weak at sustained ``[0, 0, 0]`` — set ``default_vx=0.3``
55- to start the robot in a known-good forward-walk mode (e.g. Unitree G1's
56- forward-env training slice), then drag sliders down to test standing.
65+ the very first obs the policy sees is in-distribution. Defaults are zero
66+ (robot-agnostic safe state); override when the policy is weak at sustained
67+ ``[0, 0, 0]`` and you want to start in a known-good locomotion regime.
5768 """
5869
5970 title : str = "GeneLab Teleop"
@@ -62,15 +73,15 @@ class DearPyGuiCommandBridgeCfg(BridgeCfg):
6273
6374 def __post_init__ (self ) -> None :
6475 if self .class_type is None :
65- self .class_type = DearPyGuiCommandBridge
76+ self .class_type = DearPyGuiTwistBridge
6677
6778
68- class DearPyGuiCommandBridge :
79+ class DearPyGuiTwistBridge :
6980 """``Bridge`` impl that drives ``(vx, vy, ωz)`` from three DPG sliders."""
7081
71- cfg : DearPyGuiCommandBridgeCfg
82+ cfg : DearPyGuiTwistBridgeCfg
7283
73- def __init__ (self , cfg : DearPyGuiCommandBridgeCfg ) -> None :
84+ def __init__ (self , cfg : DearPyGuiTwistBridgeCfg ) -> None :
7485 self .cfg = cfg
7586 self ._lock = threading .Lock ()
7687 self ._vx : float = cfg .default_vx
0 commit comments