From 45566bc94f7886cc23f24c2e49e7532ba69c35f6 Mon Sep 17 00:00:00 2001 From: Madan Kumar Date: Tue, 25 Aug 2026 16:36:48 +0530 Subject: [PATCH] Fix RecurrentThread no-interval loop referencing wrong attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RecurrentThread.__LoopFunc_0 (used when interval is None or <= 0) called self.__loopTarget(*self.__args, **self.__kwargs). Because of name mangling those resolve to _RecurrentThread__args / _RecurrentThread__kwargs, which are never set — the constructor stores the loop parameters as __loopArgs and __loopKwargs. Every iteration raised AttributeError (swallowed by the bare except), so the target never ran and the thread spun in a hot error loop. Use __loopArgs / __loopKwargs, matching the timer-based __LoopFunc. --- unitree_sdk2py/utils/thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unitree_sdk2py/utils/thread.py b/unitree_sdk2py/utils/thread.py index f17cf4e8..bfd7495b 100644 --- a/unitree_sdk2py/utils/thread.py +++ b/unitree_sdk2py/utils/thread.py @@ -76,7 +76,7 @@ def __LoopFunc(self): def __LoopFunc_0(self): while not self.__quit: try: - self.__loopTarget(*self.__args, **self.__kwargs) + self.__loopTarget(*self.__loopArgs, **self.__loopKwargs) except: info = sys.exc_info() print(f"[RecurrentThread] target func raise exception: name={info[0].__name__}, args={str(info[1].args)}")