Repository navigation
Conversation
donghaiwang
reviewed
Dec 21, 2025
| def draw_car(x, y, angle): | ||
| """绘制带方向的无人车(三角形+矩形,直观显示朝向)""" | ||
| # 保存当前坐标系 | ||
| pygame.draw.rect(screen, GRAY, (0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改概述:
修改的详细描述
1.新增基于 Pygame 的无人车键盘控制可视化仿真功能,实现虚拟车辆前进 / 后退 / 左转 / 右转 / 停止的交互控制,可直接运行生成效果图
2.实现道路场景渲染(灰色背景 + 白色网格)、带朝向的车辆绘制(红色车身 + 黑色车头标识),补充实时状态显示(位置、朝向角度、控制提示)
3.增加 60 帧帧率控制、边界检测(防止车辆驶出窗口)及 Q 键退出 / 空格停止功能,优化交互流畅度与使用体验
代码结构清晰,支持参数灵活调整(移动速度、转向灵敏度、车辆颜色),预留障碍物绘制、轨迹记录等扩展空间
经过了什么样的测试?
运行效果
动图、视频、截图等

