diff --git a/debug_execution.py b/debug_execution.py index 8edc4f9..8da6eca 100644 --- a/debug_execution.py +++ b/debug_execution.py @@ -117,8 +117,9 @@ def debug_path_execution(): # 设置插值位置 arm_controller.set_joint_positions(interpolated.tolist()) - # 执行仿真步进(关键修复:让PyBullet执行控制命令) - p.stepSimulation(physicsClientId=physics_client) + # 执行多次仿真步进让控制器充分收敛 + for _ in range(10): + p.stepSimulation(physicsClientId=physics_client) # 等待timestep时间(和主程序相同) time.sleep(timestep) @@ -150,7 +151,8 @@ def debug_path_execution(): break # 执行仿真步进让机械臂继续收敛 - p.stepSimulation(physicsClientId=physics_client) + for _ in range(10): + p.stepSimulation(physicsClientId=physics_client) time.sleep(timestep) # 记录最终实际位置