From 0f3b0fd1f5ca45e387460aeaae17c1a7d6a8272d Mon Sep 17 00:00:00 2001 From: Giovanni Date: Fri, 30 Jan 2026 10:22:28 +0100 Subject: [PATCH] Added a small delay between self.piper.ArmParamEnquiryAndConfig(0x02, 0x00, 0x00, 0x00, 0x03) and self.piper.GetCrashProtectionLevelFeedback() to let piper_sdk thread update its internal variable __feedback_crash_protection_level in time, to avoid the first query to the collision protection levels being returned as all zeros --- src/piper_control/piper_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/piper_control/piper_interface.py b/src/piper_control/piper_interface.py index 1d4f00d..6cedf13 100644 --- a/src/piper_control/piper_interface.py +++ b/src/piper_control/piper_interface.py @@ -934,9 +934,9 @@ def get_collision_protection(self) -> list[int]: - 1-8: Increasing detection thresholds """ self.piper.ArmParamEnquiryAndConfig(0x02, 0x00, 0x00, 0x00, 0x03) + time.sleep(0.01) # Add a small delay to let piper_sdk thread update the variable __feedback_crash_protection_level feedback = self.piper.GetCrashProtectionLevelFeedback() rating = feedback.crash_protection_level_feedback - return [ rating.joint_1_protection_level, rating.joint_2_protection_level,