[2.13.0 优化obu显示]

This commit is contained in:
lixiaopeng
2022-12-05 19:38:42 +08:00
parent cea43608dc
commit 32ca3026d0
4 changed files with 131 additions and 115 deletions

View File

@@ -4,24 +4,19 @@ import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig.isShowObuLimitSpeedView
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.EventTypeEnumWeaknessTraffic
import com.mogo.eagle.core.data.enums.V2iEventTypeEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showLimitingVelocity
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager.invokeOnLimitingVelocityChange
import com.mogo.eagle.core.function.obu.mogo.MogoObuConst.TAG_MOGO_OBU
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -577,7 +572,7 @@ class MogoPrivateObuNewManager private constructor() {
}
/**
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道 TODO
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData?) {
super.onMogoObuMapMath(data)
@@ -615,7 +610,7 @@ class MogoPrivateObuNewManager private constructor() {
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification")
// CallerLogger.d("$M_OBU${TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification")
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
@@ -844,75 +839,68 @@ class MogoPrivateObuNewManager private constructor() {
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"$M_OBU${TAG_MOGO_OBU}",
"currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId"
)
// 闯红灯预警
// 闯红灯预警,绿波通行和闯红灯是互斥的
when (appId) {
0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
}
0x1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT TODO 需要约束一个红灯周期只显示一次
// CallerHmiManager.disableWarningV2X(appId.toString())
// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}","changeTrafficLightStatus 闯红灯 --------> ")
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
// CallerHmiManager.warningV2X(
// appId.toString(), alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
// appId.toString(), null, true, 5000L, MsgBoxType.OBU
// )
// CallerHmiManager.disableWarningV2X(0x2.toString())
// CallerLogger.d("$M_OBU${TAG_MOGO_OBU}","changeTrafficLightStatus 闯红灯 --------> ")
// ttsContent = EventTypeEnumTrafficLight.getWarningTts(appId.toString())
// alertContent = EventTypeEnumTrafficLight.getWarningContent(appId.toString())
// CallerHmiManager.warningV2X(
// appId.toString(), alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
// appId.toString(), null, true, 5000L)
}
0x2 -> {//绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION TODO 需要约束一个绿灯周期只显示一次
ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
appId.toString(),
alertContent,
ttsContent
)
)
)
CallerHmiManager.warningV2X(
appId.toString(), alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(), null, true, 3000L
)
// 拼接建议速度
// CallerLogger.d(
// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
// "绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
// )
// val adviceSpeed =
// "${currentLight.suggestMinSpeed*3.6} - ${currentLight.suggestMaxSpeed*3.6}"
// val adviceSpeedTts =
// "${currentLight.suggestMinSpeed*3.6}到${currentLight.suggestMaxSpeed*3.6}"
// ttsContent =
// String.format(
// EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
// adviceSpeedTts
// )
// alertContent =
// String.format(
// EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
// adviceSpeed
// )
// val maxSpeed = currentLight.suggestMaxSpeed*3.6
// if (maxSpeed > 0) {
// CallerHmiManager.warningV2X(
// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
// alertContent,
// ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
// appId.toString(),
// null,
// true,
// 5000L,
// MsgBoxType.OBU
// )
// }
0x2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION TODO 需要约束一个绿灯周期只显示一次
// CallerHmiManager.disableWarningV2X(0x1.toString())
// CallerLogger.d(
// "$M_OBU${TAG_MOGO_OBU}",
// "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
// )
// val adviceSpeed =
// "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}"
// val adviceSpeedTts =
// "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}"
// ttsContent =
// String.format(
// EventTypeEnumTrafficLight.getWarningTts(appId.toString()),
// adviceSpeedTts
// )
// alertContent =
// String.format(
// EventTypeEnumTrafficLight.getWarningContent(appId.toString()),
// adviceSpeed
// )
//
// val maxSpeed = currentLight.suggestMaxSpeed
// if (maxSpeed > 0) {
// CallerMsgBoxManager.saveMsgBox(
// MsgBoxBean(
// MsgBoxType.OBU,
// V2XMsg(
// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
// alertContent,
// ttsContent
// )
// )
// )
//
// CallerHmiManager.warningV2X(
// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
// alertContent,
// ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
// appId.toString(),
// null,
// true,
// 5000L
// )
// }
}
}
@@ -933,6 +921,7 @@ class MogoPrivateObuNewManager private constructor() {
val red = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownRed(red)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
@@ -943,52 +932,8 @@ class MogoPrivateObuNewManager private constructor() {
CallerHmiManager.showWarningTrafficLight(3, 2)
val green = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownGreen(green)
//防止数据出现问题的容错
CallerHmiManager.changeCountdownRed(0)
CallerHmiManager.changeCountdownYellow(0)
// 拼接建议速度
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
)
val adviceSpeed =
"${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}"
val adviceSpeedTts =
"${currentLight.suggestMinSpeed}${currentLight.suggestMaxSpeed}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
3000L
)
}
}
// 黄灯
7, 8 -> {
CallerHmiManager.disableWarningV2X(appId.toString())