4 车道推荐信息
功能介绍
车道推荐信息通过 AlertEventListener.onLaneGuidanceInfoUpdated 推送,载荷为 LaneGuidanceInfo。SDK 在存在车道级地图数据且车辆已匹配到路线时,提供前方路口车道推荐信息、车道变化等,供 HMI 绘制车道线面板。
前置条件:
- Alert 组件已开启(未
disableAlert()),见 概述
alertManager.enableLaneGuidanceDetection(true) — 车道检测 默认关闭,必须显式开启
- 车辆已匹配到路线;导航偏航或 free drive off-road 时 不通知
勿使用 AlertEvent.laneGuidanceInfo(已废弃),应使用本回调。
回调接口
| fun onLaneGuidanceInfoUpdated(laneGuidanceInfo: LaneGuidanceInfo)
|
| 参数 |
说明 |
laneGuidanceInfo |
车道推荐信息,含按距离排序的通知列表 |
LaneGuidanceInfo
| 字段 |
说明 |
notifications |
前方车道引导通知列表(List<LaneGuidanceNotification>),按与车辆距离升序排列 |
LaneGuidanceNotification
| 字段 |
说明 |
laneGuidanceType |
车道引导类型(LaneGuidanceType,如路口车道信息,车道变化等) |
distance |
到该引导点的沿路距离(米) |
prevLanes |
变化点之前的各车道信息(List<LaneInfo>);LaneInfo 字段见 导航状态信息 · LaneInfo |
nextLanes |
变化点之后的各车道信息 |
connectivity |
前后车道连通关系(List<LaneConnectivity>,from/to 车道索引) |
prevLaneTurnReliabilities |
前序车道转向可信度 |
richJunctionInfo |
复杂路口信息(类型为 junction 时可用) |
mergeType |
合流类型(LaneMergeType,合流场景) |
forkType |
分流类型(LaneForkType,分流场景) |
routeEdgeInfo |
对应路线边索引(AGV 模式下可用) |
prevLanesHasLaneLevelData |
前序车道是否含完整车道级数据;为 false 时可能为推断/降级数据 |
HMI 通常根据 prevLanes、nextLanes 与 connectivity 绘制推荐车道高亮;复杂分合流可结合 mergeType / forkType 或 connectivity 细化展示。
开启车道检测
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 | val navigationService = NavigationService.Factory.createInstance()
// 默认 false,集成车道面板时必须开启
navigationService.alertManager.enableLaneGuidanceDetection(true)
navigationService.eventHub.addAlertEventListener(object : AlertEventListener {
override fun onAlertEventUpdated(alertEvent: AlertEvent) {}
override fun onHighwayInfoUpdated(highwayInfo: HighwayInfo) {}
override fun onLaneGuidanceInfoUpdated(laneGuidanceInfo: LaneGuidanceInfo) {
for (notification in laneGuidanceInfo.notifications) {
val distance = notification.distance
val prev = notification.prevLanes
val next = notification.nextLanes
val links = notification.connectivity
// 更新车道推荐 UI
}
}
})
|
注意事项
- 默认关闭: 未调用
enableLaneGuidanceDetection(true) 时不会收到任何车道推荐回调。
- 偏航或 off-road 时不更新;与 地图匹配 中路线匹配状态相关。
prevLanesHasLaneLevelData == false 时,prevLanes 可能仅为简化推断结果,UI 宜做降级展示。
- 无车道级数据的路段不会生成有效
notifications,属正常现象。
- 关闭检测:
enableLaneGuidanceDetection(false) 可停止车道推荐推送,不影响一般道路与高速信息(若对应检测仍开启)。