From 6be3d44526b8402b50d90a2bf98ace1c6edcef95 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 22 Dec 2022 14:20:27 +0800 Subject: [PATCH] [2.13.2] add func of debugsetting btn to control v2n from car --- .../hmi/ui/setting/DebugSettingView.kt | 9 +++ .../main/res/layout/view_debug_setting.xml | 12 ++++ .../function/v2x/events/V2XEventManager.kt | 10 ++- .../receiver/TestPanelBroadcastReceiver.kt | 70 ++++++++----------- .../scene/road/V2XRoadEventMarker.java | 3 +- .../function/v2x/events/utils/EntityUtils.kt | 18 +++-- .../core/data/config/FunctionBuildConfig.kt | 8 +++ gradle.properties | 2 +- 8 files changed, 82 insertions(+), 50 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index d29227f462..6641f6f935 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -624,6 +624,15 @@ class DebugSettingView @JvmOverloads constructor( } } + tbV2NFromCar.isChecked = FunctionBuildConfig.isV2NFromCar + //v2n车端预警 + tbV2NFromCar.setOnCheckedChangeListener { _, isChecked -> + FunctionBuildConfig.isV2NFromCar = isChecked + if (!FunctionBuildConfig.isV2NFromCar) { + tbV2NFromCar.isChecked = false + } + } + //重启工控机所有节点 btnIpcReboot.onClick { CallerAutoPilotManager.sendIpcReboot() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 7a32567b16..1f5110d444 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -242,6 +242,18 @@ android:textOn="关闭感知优化模式" android:textSize="@dimen/dp_24" /> + + { + if(FunctionBuildConfig.isV2NFromCar){ + return + } handleRoadMarkerEvent(event.data.toRoadMarker()) } } @@ -460,6 +464,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb ) override fun onAutopilotIdentifyPlanningObj(planningObjects: List?) { super.onAutopilotIdentifyPlanningObj(planningObjects) + if(!FunctionBuildConfig.isV2NFromCar){ + return + } planningObjects?.let { if (it.isNotEmpty()) { val first = it.stream() @@ -473,7 +480,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb EventTypeEnum.AI_ROAD_WORK.poiType } 1007 -> { //三角牌 - EventTypeEnum.FOURS_ACCIDENT.poiType + EventTypeEnum.FOURS_ACCIDENT_04.poiType } else -> { return @@ -483,6 +490,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb val trackedObj = CallerMapIdentifyManager.getIdentifyObj(first.get().uuid.toString()) trackedObj?.let { t -> + CallerLogger.d("$M_V2X$TAG", "polygon size : ${(t.polygonList.size)}") TrackUtils.trackV2xRoadProduceEvent(1) val v2XMessageEntity = V2XMessageEntity() v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt index ae4d340a99..eedf86e930 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt @@ -151,32 +151,22 @@ class TestPanelBroadcastReceiver : BroadcastReceiver() { val trackedObj = MessagePad.TrackedObject.newBuilder().setLatitude(26.819352799999997) .setLongitude(112.575119).setType(13).setSatelliteTime(1671094475.0523846) .setSystemTime(1671528008.4332187).setUuid(89295).setHeading(90.0) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819359199999997) - .setLongitude(112.5751322).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.8191217).setLongitude(112.5752108) - .build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819182899999998) - .setLongitude(112.5751816).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819275899999997) - .setLongitude(112.5751375).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.8193457) - .setLongitude(112.57510409999999).build() - ) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819359203460486).setLongitude(112.57513221567056).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819276703460478).setLongitude(112.57517171567059).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819183903460488).setLongitude(112.57521561567059).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81912310346047).setLongitude(112.57524471567059).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81911710346047).setLongitude(112.57524771567061).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819090803460476).setLongitude(112.5752602156706).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81907760346048).setLongitude(112.5752320156706).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819152103460482).setLongitude(112.57519621567059).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819269603460477).setLongitude(112.5751405156706).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819345603460498).setLongitude(112.57510421567056).build()) .build() TrackUtils.trackV2xRoadProduceEvent(1) val v2XMessageEntity = V2XMessageEntity() v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING v2XMessageEntity.content = - trackedObj.toRoadMarker(EventTypeEnum.FOURS_ACCIDENT.poiType).toV2XRoadEventEntity() + trackedObj.toRoadMarker(EventTypeEnum.FOURS_ACCIDENT_04.poiType).toV2XRoadEventEntity() v2XMessageEntity.isShowState = true V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity) } @@ -186,26 +176,24 @@ class TestPanelBroadcastReceiver : BroadcastReceiver() { val trackedObj = MessagePad.TrackedObject.newBuilder().setLatitude(26.819352799999997) .setLongitude(112.575119).setType(502).setSatelliteTime(1671094475.0523846) .setSystemTime(1671528008.4332187).setUuid(89295).setHeading(90.0) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819359199999997) - .setLongitude(112.5751322).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.8191217).setLongitude(112.5752108) - .build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819182899999998) - .setLongitude(112.5751816).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.819275899999997) - .setLongitude(112.5751375).build() - ) - .addPolygon( - MessagePad.Location.newBuilder().setLatitude(26.8193457) - .setLongitude(112.57510409999999).build() - ) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819444703460505).setLongitude(112.57508961567058).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819444703460505).setLongitude(112.57509051567057).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81944450346051).setLongitude(112.57509111567056).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.8194439034605).setLongitude(112.57509181567058).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819443503460505).setLongitude(112.57509201567058).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819443203460512).setLongitude(112.57509211567056).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819442303460505).setLongitude(112.57509201567058).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819441703460495).setLongitude(112.57509161567056).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819441203460503).setLongitude(112.57509081567055).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819433303460496).setLongitude(112.57505681567058).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819433403460494).setLongitude(112.57505581567055).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81943390346051).setLongitude(112.57505501567057).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819434503460496).setLongitude(112.57505461567055).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819435403460503).setLongitude(112.57505451567057).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.81943590346049).setLongitude(112.57505471567056).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819436603460503).setLongitude(112.57505531567055).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819436903460495).setLongitude(112.57505601567057).build()) + .addPolygon(MessagePad.Location.newBuilder().setLatitude(26.819444703460505).setLongitude(112.57508961567058).build()) .build() TrackUtils.trackV2xRoadProduceEvent(1) val v2XMessageEntity = V2XMessageEntity() diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java index 7b0637ba7e..bb7d2c4c06 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java @@ -32,7 +32,8 @@ public class V2XRoadEventMarker implements IV2XMarker { if (marker != null) { marker.clearAlarmPOI(); if (entity != null) { - if (!Objects.equals(entity.getPoiType(), EventTypeEnum.AI_ROAD_WORK.getPoiType())) { + if (!Objects.equals(entity.getPoiType(), EventTypeEnum.AI_ROAD_WORK.getPoiType()) + && !Objects.equals(entity.getPoiType(), EventTypeEnum.FOURS_ACCIDENT_04.getPoiType())) { AiRoadMarker.Marker prev = mMarker; if (prev != null) { AiRoadMarker.INSTANCE.unMarker(prev); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt index 174512bae7..a82521c497 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt @@ -1,18 +1,18 @@ package com.mogo.eagle.core.function.v2x.events.utils +import android.util.Log import androidx.core.util.Pair import com.mogo.cloud.commons.utils.CoordinateUtils -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeEnum.Companion.isRoadEvent import com.mogo.eagle.core.data.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerLocation import com.mogo.eagle.core.data.map.entity.MarkerUserInfo import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity -import com.mogo.eagle.core.function.v2x.events.manager.impl.MoGoV2XMarkerManager import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker import com.mogo.v2x.data.* import mogo.telematics.pad.MessagePad import roadwork.Road +import kotlin.math.abs fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? = @@ -108,11 +108,17 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult = ) } -fun MessagePad.TrackedObject.toRoadMarker(poiType:String): V2XMarkerCardResult = +fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult = V2XMarkerCardResult().also { l1 -> + Log.i("emArrow", "polygonList size : " + polygonList.size + " , step : ${abs(polygonList.size / 5)}") this.polygonList?.takeIf { it.isNotEmpty() }?.also { old -> + val list = mutableListOf() + for (i in 0 until old.size - 1 step abs(old.size / 5)) { + list.add(old[i]) + } + Log.i("emArrow", "road marker list filter size : " + list.size) l1.extras = HashMap>>().also { extra -> - extra["polygon"] = old.map { d -> Pair(d.longitude, d.latitude) } + extra["polygon"] = list.map { d -> Pair(d.longitude, d.latitude) } extra["gps_location"] = listOf(Pair(this.longitude, this.latitude)) } } @@ -130,10 +136,10 @@ fun MessagePad.TrackedObject.toRoadMarker(poiType:String): V2XMarkerCardResult = } } -fun V2XMarkerCardResult.toV2XRoadEventEntity():V2XRoadEventEntity = +fun V2XMarkerCardResult.toV2XRoadEventEntity(): V2XRoadEventEntity = V2XRoadEventEntity().also { l1 -> val exploreWayList: List? = this.exploreWay - if(!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()){ + if (!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()) { for (markerExploreWay in exploreWayList) { if (isRoadEvent(markerExploreWay.poiType)) { val markerLocation = markerExploreWay.location diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt index 690adf88a0..b4acd5176e 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt @@ -45,6 +45,14 @@ object FunctionBuildConfig { @JvmField var detouringSpeed = 3 + /** + * 是否从车端融合过来的v2n事件 + * 默认关闭,开启后接收车端融合预警,关闭云端长链V2N + */ + @Volatile + @JvmField + var isV2NFromCar = false + /** * 是否是感知优化模式 * 默认开启 diff --git a/gradle.properties b/gradle.properties index e9147f7489..bb09a7f807 100644 --- a/gradle.properties +++ b/gradle.properties @@ -63,7 +63,7 @@ BIZCONFIG_VERSION=1.3.2 SERVICE_BIZ_VERSION=1.2.4 ################ 外部依赖引用 ################ # loglib -LOGLIB_VERSION=1.5.8 +LOGLIB_VERSION=1.5.9 ######## MogoAiCloudSDK Version ######## # 网络请求LOGLIB_VERSION MOGO_NETWORK_VERSION=1.4.3.27