[2.13.2] add func of debugsetting btn to control v2n from car

This commit is contained in:
zhongchao
2022-12-22 14:20:27 +08:00
parent 68a77465b8
commit 6be3d44526
8 changed files with 82 additions and 50 deletions

View File

@@ -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()

View File

@@ -242,6 +242,18 @@
android:textOn="关闭感知优化模式"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbV2NFromCar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启车端V2N预警"
android:textOn="关闭车端V2N预警"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbMojie"
android:layout_width="match_parent"

View File

@@ -16,6 +16,7 @@ import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeHelper
import com.mogo.commons.network.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
@@ -444,6 +445,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
handleWarningTargetEvent(event.data)
}
is V2XEvent.RoadAI -> {
if(FunctionBuildConfig.isV2NFromCar){
return
}
handleRoadMarkerEvent(event.data.toRoadMarker())
}
}
@@ -460,6 +464,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
)
override fun onAutopilotIdentifyPlanningObj(planningObjects: List<MessagePad.PlanningObject>?) {
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<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING

View File

@@ -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<V2XRoadEventEntity>()
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<V2XRoadEventEntity>()

View File

@@ -32,7 +32,8 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
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);

View File

@@ -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<MessagePad.Location>()
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<String, List<Pair<Double, Double>>>().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<V2XMarkerExploreWay>? = this.exploreWay
if(!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()){
if (!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()) {
for (markerExploreWay in exploreWayList) {
if (isRoadEvent(markerExploreWay.poiType)) {
val markerLocation = markerExploreWay.location