[6.5.0][道路事件] 统一处理上车数据的坐标类型判断逻辑;添加道路施工和道路事故的单元测试
This commit is contained in:
@@ -6,36 +6,26 @@ import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import androidx.core.util.Pair
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.CommunicationType
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum.ALERT_WARNING_TOP
|
||||
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.V2XRoadEventEntity
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType.V2X
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.angle.scenes.Default
|
||||
import com.mogo.eagle.core.function.angle.scenes.RoadEvent
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2nNioEventListener
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.event.V2N
|
||||
import com.mogo.eagle.core.function.api.hmi.xiaozhi.state.State
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager.V2NCarTypeCheck
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
||||
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.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -144,7 +134,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
it.location = e.location
|
||||
it.polygon = polygon
|
||||
}
|
||||
}), true, isDrawRoadLine(poiType)
|
||||
}, isUseGps = true), true, isDrawRoadLine(poiType)
|
||||
)
|
||||
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
@@ -168,6 +158,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
)
|
||||
)
|
||||
if (polygon.isNotEmpty()) {
|
||||
|
||||
val decision = V2NUtils.computeOccupyLanesInfo(Triple(car.longitude, car.latitude, car.heading.toFloat()), Triple(itx.longitude, itx.latitude, itx.heading.toFloat()), polygon.map { kotlin.Pair(it.first, it.second) })
|
||||
if (decision != null) {
|
||||
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
@@ -330,12 +321,10 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
}
|
||||
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
|
||||
val newEventId = "other_retrograde_vehicle_${event.eventId}"
|
||||
val isUseGps = event.gnssType != 0
|
||||
val eventLocation = if (isUseGps) arrayOf(event.longitude, event.latitude) else CoordinateTransform.GCJ02ToWGS84(event.longitude, event.latitude)
|
||||
val carLocation = if (isUseGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
AiRoadMarker.aiMakers.getOrPut(newEventId) {
|
||||
val eventLocation = when (event.gnssType) {
|
||||
0 -> CoordinateTransform.GCJ02ToWGS84(event.longitude, event.latitude)
|
||||
else -> arrayOf(event.longitude, event.latitude)
|
||||
}
|
||||
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, eventLocation[0], eventLocation[1])
|
||||
if (distance > 150) {
|
||||
Logger.i(TAG, "other_retrograde_vehicle --> distance > 150")
|
||||
@@ -352,11 +341,11 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
isDriver,
|
||||
String.format(EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType), distance.toInt()),
|
||||
cameraIp.toString(),
|
||||
event.longitude,
|
||||
event.latitude)
|
||||
eventLocation[0],
|
||||
eventLocation[1])
|
||||
AiRoadMarker()
|
||||
}.also {
|
||||
it.marker(Marker(newEventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType, event.longitude, event.latitude, 0.0), drawMarker = true, false, isHighFrequency = true)
|
||||
it.marker(Marker(newEventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType, eventLocation[0], eventLocation[1], heading, isUseGps = isUseGps), drawMarker = true, false, isHighFrequency = true)
|
||||
}.receive()
|
||||
} else if (msg.what == MSG_WHAT_DRAW_GREEN_WAVE) {
|
||||
val data = msg.obj as? V2nCrossSpeed ?: return@Callback true
|
||||
@@ -406,17 +395,19 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
|
||||
val isUseGps = data.gnssType != 0
|
||||
val eventLocation = if (isUseGps) arrayOf(data.longitude, data.latitude) else CoordinateTransform.GCJ02ToWGS84(data.longitude, data.latitude)
|
||||
val carLocation = if (isUseGps) CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() else CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, eventLocation[0], eventLocation[1])
|
||||
AiRoadMarker.aiMakers.getOrPut(data.eventId) {
|
||||
Logger.i(TAG, "people cross -- 2 --")
|
||||
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, data.longitude, data.latitude)
|
||||
if (distance > 150) {
|
||||
Logger.i(TAG, "people cross --> distance > 150")
|
||||
V2XBizTrace.onAck(TAG, mapOf("people cross" to "distance > 150"), true)
|
||||
return@Callback true
|
||||
}
|
||||
Logger.i(TAG, "people cross -- 3 --")
|
||||
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
|
||||
// 弹事件框
|
||||
CallerRoadV2NEventWindowListenerManager.showLiveVideo(
|
||||
data.eventId,
|
||||
@@ -426,12 +417,12 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
||||
isDriver,
|
||||
String.format(EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType), distance.toInt()),
|
||||
cameraIp.toString(),
|
||||
data.longitude,
|
||||
data.latitude)
|
||||
eventLocation[0],
|
||||
eventLocation[1])
|
||||
AiRoadMarker()
|
||||
}.also {
|
||||
Logger.i(TAG, "people cross -- 4 --")
|
||||
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, heading), drawMarker = true, false, isHighFrequency = true)
|
||||
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, eventLocation[0], eventLocation[1], heading, isUseGps = isUseGps), drawMarker = true, false, isHighFrequency = true)
|
||||
}.receive()
|
||||
}
|
||||
true
|
||||
|
||||
@@ -107,7 +107,7 @@ class AiRoadMarker {
|
||||
val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER)
|
||||
builder
|
||||
.set3DMode(true)
|
||||
.isUseGps(true)
|
||||
.isUseGps(marker.isUseGps)
|
||||
.icon3DRes(EventTypeEnumNew.getMarker3DRes(marker.poiType))
|
||||
.anchorColor("#D65D5AFF")
|
||||
.controlAngle(true)
|
||||
@@ -122,7 +122,7 @@ class AiRoadMarker {
|
||||
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType) {
|
||||
distance = 100
|
||||
}
|
||||
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance)
|
||||
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, if (marker.isUseGps) 1 else 0, elapsedDistance = distance)
|
||||
wrapper.onRemoved = {
|
||||
builders.remove(markerId)
|
||||
markerIds.remove(p.id)
|
||||
@@ -153,7 +153,7 @@ class AiRoadMarker {
|
||||
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) {
|
||||
elapsedDuration = TimeUnit.SECONDS.toMillis(3)
|
||||
}
|
||||
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = elapsedDistance, elapsedDuration = elapsedDuration)
|
||||
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, if (marker.isUseGps) 1 else 0, elapsedDistance = elapsedDistance, elapsedDuration = elapsedDuration)
|
||||
if (drawMarker) {
|
||||
marker.entity?.apply { roadMarker.drawMarkers(this, wrapper) }
|
||||
}
|
||||
@@ -371,6 +371,7 @@ class AiRoadMarker {
|
||||
val polygon: List<Pair<Double, Double>>? = null,
|
||||
var farthestPoint: Pair<Double, Double>? = null,
|
||||
var entity: V2XRoadEventEntity? = null,
|
||||
var isUseGps: Boolean = false
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
List<Pair<Double, Double>> polygons = noveltyInfo.getPolygon();
|
||||
if (gpsLocation != null && polygons != null) {
|
||||
MarkerLocation location = noveltyInfo.getLocation();
|
||||
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
|
||||
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity, false);
|
||||
AiRoadMarker aiMarker = new AiRoadMarker();
|
||||
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()), false);
|
||||
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.v2x.V2XEvent.RoadEventX
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
@@ -37,7 +38,9 @@ import io.netty.channel.Channel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import java.nio.charset.Charset
|
||||
import java.util.Collections
|
||||
|
||||
class TeleMsgHandler : IMsgHandler {
|
||||
|
||||
@@ -103,6 +106,22 @@ class TeleMsgHandler : IMsgHandler {
|
||||
}
|
||||
return
|
||||
}
|
||||
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_SHI_GONG) {
|
||||
runCatching {
|
||||
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路施工 --- 1 ---")
|
||||
CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate(Collections.singletonList(TrackedObject.parseFrom(msg.body)))
|
||||
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路施工 --- 2 ---")
|
||||
}
|
||||
return
|
||||
}
|
||||
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_SHI_GU) {
|
||||
runCatching {
|
||||
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路事故 --- 1 ---")
|
||||
CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate(Collections.singletonList(TrackedObject.parseFrom(msg.body)))
|
||||
Log.d(TAG, "乘客屏收到司机屏转发云端下发的道路事故 --- 2 ---")
|
||||
}
|
||||
return
|
||||
}
|
||||
if (it.protocolType == TelematicConstant.V2N_NEW_LINK_SWITCH) {
|
||||
try {
|
||||
Log.d(TAG, "乘客屏收到司机屏转发的新链路开关 --- 1 ---")
|
||||
|
||||
Reference in New Issue
Block a user