Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Safe_navigation/run_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def _init_log_file(self):
"""初始化日志文件"""
try:
self.log_file = open(f"{self.data_dir}/simulation_log.txt", "w")

except Exception as e:
print(f"无法创建日志文件: {e}")
self.log_file = None
Expand Down Expand Up @@ -262,7 +263,7 @@ def get_vehicle_state(self):

# 限制历史记录长度
if len(self.path_history) > 1000:
self.path_history.pop(0)



state_info = {
Expand Down Expand Up @@ -496,6 +497,7 @@ def execute_collision_recovery_improved(self, current_state):
current_yaw = state['yaw']
collision_detected = state['collision']


# 1. 碰撞恢复处理(最高优先级)
if self.collision_recovery_mode:
recovery_controls = self.execute_collision_recovery_improved(state)
Expand Down Expand Up @@ -523,8 +525,6 @@ def execute_collision_recovery_improved(self, current_state):
continue

# 4. 正常行驶防碰撞控制
absolute_offset = self.calculate_lateral_offset(current_position)
offset_history.append(absolute_offset)

if absolute_offset > max_right_offset:
max_right_offset = absolute_offset
Expand Down
Loading