新增了红绿灯检测机制,优化了奖励机制#3206
Merged
Merged
Conversation
Contributor
Author
|
越过停止线就视为闯红灯 |
donghaiwang
approved these changes
Dec 15, 2025
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.新增了红绿灯检测
检测方式为:首先遍历地图中所有交通灯 Actor(通过self.world.get_actors().filter('traffic.traffic_light')获取),仅筛选出车辆 10 米范围内的红绿灯(可通过traffic_light_trigger_distance调整),过滤远距离灯以减少无效计算,确保只检测车辆周边的有效红绿灯。
奖惩逻辑:将红绿灯的奖惩冷却时间设置为十秒,避免车速过慢时重复扣分,单次闯红灯 / 绿灯合规行为仅触发 1 次判定,10 秒内即使车辆仍处于红绿灯范围内,也不会重复判定,闯红灯扣10分,正确通过绿灯加五分。
2025-12-15.085127.mp4