fix: 修复配置更新后路径规划组件未重新初始化的问题

问题描述:
- 修改配置文件后运行路径规划报错"Joint index out-of-range"
- CollisionChecker持有无效的robot_id引用

解决方案:
- 在on_config_applied方法中重新初始化路径规划组件
- 确保路径规划组件使用新的arm_controller实例

影响文件:
- src/gui/main_window.py: 添加_initialize_planning_components()调用
- CLAUDE.md: 更新已知问题文档

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-13 08:22:40 +08:00
parent f050cec6aa
commit 32bbd5c44c
3 changed files with 21 additions and 4 deletions

View File

@ -144,6 +144,20 @@ wall_position = [2.0, 0.0, 1.0] # 错误!
## 已知问题
### 配置更新后路径规划组件未重新初始化2025-09-13✅ 已解决
**现象**:修改配置文件后运行路径规划,报错"Joint index out-of-range"。
**根本原因**
- `on_config_applied`方法重新创建了`ArmController`但未重新初始化路径规划组件
- `CollisionChecker`仍持有旧的`arm_controller`引用,其`robot_id`已无效
- 使用无效的`robot_id`调用`p.resetJointState`导致索引越界错误
**解决方案**
- 在重新创建`ArmController`后立即调用`_initialize_planning_components()`
- 确保路径规划组件使用新的`arm_controller`实例
**修复文件**`src/gui/main_window.py`第282行
### KDL逆运动学崩溃2025-09-11✅ 已解决
**现象**:点击"Test Reachability"按钮后程序直接退出,无错误信息。

View File

@ -65,9 +65,9 @@
},
"transport_object": {
"initial_position": [
1.0,
0.6,
0.5,
0.7
0.5
],
"dimensions": {
"width": 0.1,
@ -98,7 +98,7 @@
"path_planning": {
"collision": {
"check_resolution": 0.05,
"safety_margin": 0.01
"safety_margin": 0.05
},
"execution": {
"velocity_scaling": 1.0,
@ -106,4 +106,4 @@
"motor_max_force": 150.0
}
}
}
}

View File

@ -278,6 +278,9 @@ class MainWindow:
# Recreate arm controller
self.arm_controller = create_arm_controller(self.config_loader, self.physics_client)
# Reinitialize path planning components with new arm controller
self._initialize_planning_components()
# Restore robot state if available
if robot_state:
try: