优化弱势交通预警
This commit is contained in:
@@ -34,6 +34,8 @@ adb shell am broadcast -a com.obu.test_trigger_recognized
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei lightLevel 1 --ei obuLevel 3 --ei obuType 0x2B09 --ei rtiType 0x2
|
||||
// 道路危险情况预警
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei obuLevel 3 --ei obuType 0x2B06 --ei rtiType 0x2
|
||||
// 弱势交通参与者
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei obuLevel 3 --ei obuType 0X2B02 --ei ptcInfo 0x1
|
||||
|
||||
|
||||
// (旧版本)使用命令行触发各种测试场景演示
|
||||
|
||||
@@ -82,13 +82,20 @@ enum class WarningTypeEnum(
|
||||
"后方存在特殊车辆,请安排避让",
|
||||
R.drawable.icon_warning_v2x_special_vehicle_access
|
||||
),
|
||||
TYPE_USECASE_ID_VRUCW(
|
||||
ObuConstants.USE_CASE_ID.VRUCW,
|
||||
TYPE_USECASE_ID_VRUCW_PERSON(
|
||||
0X2B0201,
|
||||
"弱势交通参与者碰撞预警",
|
||||
"%s碰撞预警",
|
||||
"%s碰撞预警",
|
||||
"行人碰撞预警",
|
||||
"行人碰撞预警",
|
||||
R.drawable.icon_warning_v2x_pedestrian_crossing
|
||||
),//行人/摩托车碰撞预警
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE(
|
||||
0X2B0202,
|
||||
"弱势交通参与者碰撞预警",
|
||||
"摩托车碰撞预警",
|
||||
"摩托车碰撞预警",
|
||||
R.drawable.icon_warning_v2x_motorcycle_collision
|
||||
),//摩托车碰撞预警
|
||||
TYPE_USECASE_ID_SLW(
|
||||
ObuConstants.USE_CASE_ID.SLW,
|
||||
"限速预警",
|
||||
@@ -243,7 +250,8 @@ enum class WarningTypeEnum(
|
||||
ObuConstants.USE_CASE_ID.BSW -> TYPE_USECASE_ID_BSW
|
||||
ObuConstants.USE_CASE_ID.LCW -> TYPE_USECASE_ID_LCW
|
||||
ObuConstants.USE_CASE_ID.EVW -> TYPE_USECASE_ID_EVW
|
||||
ObuConstants.USE_CASE_ID.VRUCW -> TYPE_USECASE_ID_VRUCW
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.useCaseId -> TYPE_USECASE_ID_VRUCW_PERSON
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.useCaseId -> TYPE_USECASE_ID_VRUCW_MOTORBIKE
|
||||
ObuConstants.USE_CASE_ID.SLW -> TYPE_USECASE_ID_SLW
|
||||
ObuConstants.USE_CASE_ID.LTA -> TYPE_USECASE_ID_LTA
|
||||
ObuConstants.USE_CASE_ID.HLW -> TYPE_USECASE_ID_HLW
|
||||
@@ -280,7 +288,8 @@ enum class WarningTypeEnum(
|
||||
ObuConstants.USE_CASE_ID.BSW -> TYPE_USECASE_ID_BSW.warningIconId
|
||||
ObuConstants.USE_CASE_ID.LCW -> TYPE_USECASE_ID_LCW.warningIconId
|
||||
ObuConstants.USE_CASE_ID.EVW -> TYPE_USECASE_ID_EVW.warningIconId
|
||||
ObuConstants.USE_CASE_ID.VRUCW -> TYPE_USECASE_ID_VRUCW.warningIconId
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.useCaseId -> TYPE_USECASE_ID_VRUCW_PERSON.warningIconId
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.useCaseId -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.warningIconId
|
||||
ObuConstants.USE_CASE_ID.SLW -> TYPE_USECASE_ID_SLW.warningIconId
|
||||
ObuConstants.USE_CASE_ID.LTA -> TYPE_USECASE_ID_LTA.warningIconId
|
||||
ObuConstants.USE_CASE_ID.HLW -> TYPE_USECASE_ID_HLW.warningIconId
|
||||
@@ -316,7 +325,8 @@ enum class WarningTypeEnum(
|
||||
ObuConstants.USE_CASE_ID.BSW -> TYPE_USECASE_ID_BSW.warningContent
|
||||
ObuConstants.USE_CASE_ID.LCW -> TYPE_USECASE_ID_LCW.warningContent
|
||||
ObuConstants.USE_CASE_ID.EVW -> TYPE_USECASE_ID_EVW.warningContent
|
||||
ObuConstants.USE_CASE_ID.VRUCW -> TYPE_USECASE_ID_VRUCW.warningContent
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.useCaseId -> TYPE_USECASE_ID_VRUCW_PERSON.warningContent
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.useCaseId -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.warningContent
|
||||
ObuConstants.USE_CASE_ID.SLW -> TYPE_USECASE_ID_SLW.warningContent
|
||||
ObuConstants.USE_CASE_ID.LTA -> TYPE_USECASE_ID_LTA.warningContent
|
||||
ObuConstants.USE_CASE_ID.HLW -> TYPE_USECASE_ID_HLW.warningContent
|
||||
@@ -352,7 +362,8 @@ enum class WarningTypeEnum(
|
||||
ObuConstants.USE_CASE_ID.BSW -> TYPE_USECASE_ID_BSW.warningTts
|
||||
ObuConstants.USE_CASE_ID.LCW -> TYPE_USECASE_ID_LCW.warningTts
|
||||
ObuConstants.USE_CASE_ID.EVW -> TYPE_USECASE_ID_EVW.warningTts
|
||||
ObuConstants.USE_CASE_ID.VRUCW -> TYPE_USECASE_ID_VRUCW.warningTts
|
||||
TYPE_USECASE_ID_VRUCW_PERSON.useCaseId -> TYPE_USECASE_ID_VRUCW_PERSON.warningTts
|
||||
TYPE_USECASE_ID_VRUCW_MOTORBIKE.useCaseId -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.warningTts
|
||||
ObuConstants.USE_CASE_ID.SLW -> TYPE_USECASE_ID_SLW.warningTts
|
||||
ObuConstants.USE_CASE_ID.LTA -> TYPE_USECASE_ID_LTA.warningTts
|
||||
ObuConstants.USE_CASE_ID.HLW -> TYPE_USECASE_ID_HLW.warningTts
|
||||
|
||||
@@ -258,47 +258,48 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// (5) 弱势交通参与者信息:CVX_PTC_INFO_IND
|
||||
override fun onCvxPtcInfoIndInfo(info: CvxPtcInfoIndInfo?) {
|
||||
// (2) 弱势交通参与者预警信息:CVX_PTC_THREAT_IND
|
||||
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
|
||||
info?.let {
|
||||
when (info.status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxPtcInfoIndInfo2TrafficData(info)?.let {
|
||||
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
|
||||
TrafficMarkerDrawer.updateITrafficInfo(it)
|
||||
}
|
||||
|
||||
var ttsContent = ""
|
||||
var alertContent = ""
|
||||
ttsContent = WarningTypeEnum.getWarningTts(ObuConstants.USE_CASE_ID.VRUCW)
|
||||
alertContent =
|
||||
WarningTypeEnum.getWarningContent(ObuConstants.USE_CASE_ID.VRUCW)
|
||||
var v2xType = 0
|
||||
if (info.ptc_type == 1) { //摩托车
|
||||
ttsContent = String.format(ttsContent, "摩托车")
|
||||
alertContent = String.format(alertContent, "摩托车")
|
||||
v2xType = WarningTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.useCaseId
|
||||
} else if (info.ptc_type == 2) { //行人
|
||||
ttsContent = String.format(ttsContent, "行人")
|
||||
alertContent = String.format(alertContent, "行人")
|
||||
v2xType = WarningTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.useCaseId
|
||||
}
|
||||
|
||||
val ttsContent = WarningTypeEnum.getWarningTts(v2xType)
|
||||
val alertContent = WarningTypeEnum.getWarningContent(v2xType)
|
||||
val direction = 1
|
||||
//getOtherObjDirection(if (info.ext_info != null) info.ext_info.target_classification else 7)
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
direction, "ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
ObuConstants.USE_CASE_ID.VRUCW,
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
ObuConstants.USE_CASE_ID.VRUCW.toString()
|
||||
v2xType.toString()
|
||||
)
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.id)
|
||||
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.ptc_id)
|
||||
mIMoGoWaringProvider?.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxPtcInfoIndInfo2TrafficData(info)?.let {
|
||||
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
|
||||
TrafficMarkerDrawer.updateITrafficInfo(it)
|
||||
}
|
||||
}
|
||||
@@ -327,28 +328,23 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* V2V预警信息:CVX_V2V_THREAT_IND
|
||||
* @see com.zhidao.support.obu.constants.ObuConstants.USE_CASE_ID
|
||||
*/
|
||||
// (1) V2V预警信息:CVX_V2V_THREAT_IND
|
||||
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
|
||||
info?.let {
|
||||
//预警信息,预警类型 threat_level 3
|
||||
info.threat_info?.let {
|
||||
//预警方位
|
||||
val direction = info.ext_info.target_classification
|
||||
val direction = getMessageDirection(info.ext_info.target_classification)
|
||||
//处理预警类型
|
||||
val appId = info.threat_info.app_id
|
||||
val level = info.threat_info.threat_level
|
||||
val status = info.status
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxV2vThreatIndInfo getMessageDirection(direction) = ${
|
||||
getMessageDirection(direction)
|
||||
} --- direction = $direction"
|
||||
"onCvxV2vThreatIndInfo getMessageDirection(direction) = $direction"
|
||||
)
|
||||
handleSdkObu(appId, getMessageDirection(direction), status, level, info)
|
||||
handleSdkObu(appId, direction, status, level, info)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -386,8 +382,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
return when (posClassification) {
|
||||
0x01 -> 0 //事件中
|
||||
0x02 -> 3 //左侧
|
||||
0x03 -> 4 //右侧
|
||||
0x04 -> 1 //前方
|
||||
0x03 -> 4 //右侧
|
||||
0x04 -> 1 //前方
|
||||
0x05 -> 2 //后方
|
||||
|
||||
else -> 7
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.module.obu.mogo.MogoPrivateObuManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxPtcInfoIndInfo
|
||||
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxSlwThreatIndInfo
|
||||
import com.zhidao.support.obu.model.advance.*
|
||||
@@ -78,16 +78,18 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
|
||||
|
||||
//弱势交通参与者碰撞预警,行人/摩托车碰撞预警
|
||||
ObuConstants.USE_CASE_ID.VRUCW -> {
|
||||
val cvxPtcIndInfo = CvxPtcInfoIndInfo(1, 1, 1)
|
||||
val cvxPtcIndInfo = CvxPtcThreatIndInfo(1, 1, 1)
|
||||
val position = Position(1, 399739429, 1164115207, 20)
|
||||
val movingObjectInfo = MovingObjectInfo(1, position, 1800, 6000)
|
||||
cvxPtcIndInfo.basic_info = movingObjectInfo
|
||||
cvxPtcIndInfo.id = "111"
|
||||
cvxPtcIndInfo.ptc_pos = position
|
||||
cvxPtcIndInfo.ptc_id = "111"
|
||||
cvxPtcIndInfo.ptc_type = pctType
|
||||
cvxPtcIndInfo.status = obuStatus
|
||||
|
||||
val v2vThreat = V2vThreat(1, obuType, null, 1000, obuLevel, 100)
|
||||
cvxPtcIndInfo.threat_info = v2vThreat
|
||||
|
||||
MogoPrivateObuManager.INSTANCE.getMogoObuListener()
|
||||
.onCvxPtcInfoIndInfo(cvxPtcIndInfo)
|
||||
.onCvxPtcThreatIndInfo(cvxPtcIndInfo)
|
||||
}
|
||||
|
||||
//道路危险情况, 车内标牌, 前方拥堵提醒
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.mogo.module.common.drawer.bean.TrafficData
|
||||
import com.mogo.module.common.enums.TrafficTypeEnum
|
||||
import com.mogo.module.common.enums.WarningTypeEnum
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxPtcInfoIndInfo
|
||||
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxRvInfoIndInfo
|
||||
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
|
||||
@@ -87,17 +87,17 @@ object TrafficDataConvertUtils {
|
||||
/**
|
||||
* OBU 弱势交通参与者信息 转换交通元素数据 TODO
|
||||
*/
|
||||
fun cvxPtcInfoIndInfo2TrafficData(info: CvxPtcInfoIndInfo): TrafficData? {
|
||||
if (info.basic_info == null || info.basic_info.position == null || info.threat_infos != null) {
|
||||
fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? {
|
||||
if (info.ptc_pos == null || info.threat_info == null) {
|
||||
return null
|
||||
}
|
||||
val trafficData = TrafficData()
|
||||
|
||||
trafficData.uuid = info.id
|
||||
trafficData.lat = info.basic_info.position.latitude
|
||||
trafficData.lon = info.basic_info.position.longitude
|
||||
trafficData.heading = info.basic_info.heading
|
||||
trafficData.speed = info.basic_info.speed
|
||||
trafficData.uuid = info.ptc_id
|
||||
trafficData.lat = info.ptc_pos.latitude
|
||||
trafficData.lon = info.ptc_pos.longitude
|
||||
// trafficData.heading = info.ptc_pos.heading
|
||||
// trafficData.speed = info.ptc_pos.speed
|
||||
|
||||
when (info.ptc_type) {
|
||||
// 未知
|
||||
@@ -106,7 +106,7 @@ object TrafficDataConvertUtils {
|
||||
}
|
||||
// 非机动车
|
||||
0x1 -> {
|
||||
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE
|
||||
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO
|
||||
}
|
||||
// 行人
|
||||
0x2 -> {
|
||||
@@ -115,8 +115,8 @@ object TrafficDataConvertUtils {
|
||||
}
|
||||
|
||||
// 判断车辆V2X预警级别,调整车辆颜色
|
||||
if (!info.threat_infos.isNullOrEmpty()) {
|
||||
trafficData.threatLevel = info.threat_infos.first().threat_level
|
||||
if (info.threat_info != null) {
|
||||
trafficData.threatLevel = info.threat_info.threat_level
|
||||
}
|
||||
|
||||
return trafficData
|
||||
|
||||
Reference in New Issue
Block a user