Repository navigation
feat(scenario): 新增对向车借道侵入本车道场景 - #141
Merged
donghaiwang merged 1 commit intoNov 18, 2026
Merged
Conversation
新增 oncoming_intrusion 模板(城市双向路)与语义路由; 修复播放器借道变道前瞻方向与城市车道识别。
donghaiwang
approved these changes
Nov 18, 2026
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.
依赖
本 PR 以 #139(前车切出遇静止车辆)的分支为基线,合并后会自动改指 main。
改动内容
新增城市场景模板
oncoming_intrusion:对向车道的来车借道超越慢车,越过中心线迎面驶入本车道;自车制动,来车在临近时退回原车道。
场景在 CARLA 内置城市地图
Town03的road 67、s0=174路段上布景。scenario_templates.pybuild_oncoming_intrusion:3 实体(ego / slow / oncoming)、7 条 behaviors、7 个 triggers。
oncoming在lc_delay后越线驶入本车道;自车在中心距小于
brake_gap时线性制动;oncoming在小于abort_gap时退回+1车道并减速到abort_speed。_BUILDERS与TEMPLATES,required_map=Town03;s0、lc_delay、abort_gap取固定值,保证退回动作晚于越线完成。+1与-1在 OpenDRIVE 中互为左邻车道,越线与退回都用delta=+1。scenario_intents.pyoncoming_intrusion别名(对向车借道、越过中心线、迎面占道、占了我的车道等)与组合加权(对向车+借道/占道、越过+中心线、占+车道)。
overtake_oncoming;_REQUIRED_MAP登记Town03。xosc_player.pylook_back:车辆沿目标车道反向行驶(借道、逆行)时用previous取点,否则目标落在车后,纯追踪转向量恒为 0。_lane_at:部分城市路段get_waypoint(location)会误判到相邻车道(实测
Town03 road 67的+1中心返回+2),改按(road, s)处各车道中心与车辆的实际距离判定,避免变道目标指回本车道。
验证
oncoming_intrusion为 3 实体 / 7 事件,unsupported=0。oncoming_intrusion(37.5);oncoming_intrusion(19.5);overtake_oncoming(19.35),未被抢走。Town03,road 67,960×540,ClearNoon):以及对向车未真正变道(车道识别误判);已分别通过固定
s0=174与_lane_at修正。