diff --git a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml index 6da350cadf..ba88783b21 100644 --- a/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml +++ b/OCH/bus/driver/src/main/res/layout/bus_base_fragment.xml @@ -107,6 +107,16 @@ app:layout_goneMarginEnd="40dp" app:layout_goneMarginTop="@dimen/dp_236" /> + + + + + + + + + + +,. + + 0) { delay(millis) } - var location = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() - val distance = arguments.getString("distance", "0").toDouble() - var newPoint = DrivingDirectionUtils.calculateNewPoint(location.longitude, location.latitude, location.heading, distance) - var crossInfo = MapDataWrapper.getCrossRoad(newPoint.first, newPoint.second, location.heading) - while (crossInfo == null || TextUtils.isEmpty(crossInfo.cross_id) || TextUtils.isEmpty(crossInfo.cross_id_end)) { - Log.d(TAG, "获取到的路口数据无效, 5秒后重试") - delay(TimeUnit.SECONDS.toMillis(5)) - Log.d(TAG, "5秒时间到,开始计算新的路口数据") - location = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() - newPoint = DrivingDirectionUtils.calculateNewPoint(location.longitude, location.latitude, location.heading, distance) - crossInfo = MapDataWrapper.getCrossRoad(newPoint.first, newPoint.second, location.heading) + val targetX = arguments.getString("lon", "0").toDouble() + val targetY = arguments.getString("lat", "0").toDouble() + val targetDistance = arguments.getString("distance", "0").toDouble() + var car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + var distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY) + Log.d(TAG, "target_distance: $targetDistance, current distance: $distance") + while (distance > targetDistance) { + delay(2000) + car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY) + Log.d(TAG, "target_distance: $targetDistance, current distance: $distance") } - Log.d(TAG, "获取到路口数据...") + Log.d(TAG, "开始获取路口数据...") + var crossInfo = MapDataWrapper.getCrossRoad(car.longitude, car.latitude, car.heading) + while (crossInfo == null || TextUtils.isEmpty(crossInfo.cross_id) || TextUtils.isEmpty(crossInfo.cross_id_end)) { + Log.d(TAG, "获取到的路口数据无效, 1秒后重试") + delay(TimeUnit.SECONDS.toMillis(1)) + Log.d(TAG, "1秒时间到,开始计算新的路口数据") + car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + crossInfo = MapDataWrapper.getCrossRoad(car.longitude, car.latitude, car.heading) + } + val newPoint = DrivingDirectionUtils.calculateNewPoint(car.longitude, car.latitude, car.heading , 200.0) + Log.d(TAG, "获取到路口数据..., 自车:[${car.longitude}, ${car.latitude}]前方200米外的点: [${newPoint.first}, ${newPoint.second}]") FunctionBuildConfig.isNewV2NData = true FunctionBuildConfig.v2nMainSwitch = true - CallerV2nNioEventListenerManager.invokeV2nNioGreenWavePassageEvent( - V2nCrossSpeed.getDefaultInstance().toBuilder() - .setSpeedLeftMin(0) - .setSpeedLeftMax(0) - .setSpeedRightMin(0) - .setSpeedRightMax(0) - .setSpeedStraightMin(30) - .setSpeedStraightMax(54) - .setMaxSpeed(0) - .setMaxStatus(0) - .setLng(newPoint.first) - .setLat(newPoint.second) - .build()) + runCatching { + val map = HashMap().also { + it["f1"] = FunctionBuildConfig.v2nMainSwitch + it["f2"] = FunctionBuildConfig.isNewV2NData + } + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_NEW_LINK_SWITCH, GsonUtils.toJson(map).toByteArray()) + } + delay(2000) + val data = V2nCrossSpeed.getDefaultInstance().toBuilder().setSpeedLeftMin(0).setSpeedLeftMax(0).setSpeedRightMin(0).setSpeedRightMax(0).setSpeedStraightMin(30).setSpeedStraightMax(54).setMaxSpeed(0).setMaxStatus(0).setLng(newPoint.first).setLat(newPoint.second).build() + CallerV2nNioEventListenerManager.invokeV2nNioGreenWavePassageEvent(data) + while (!CallerTelematicManager.getServerStarted()) { + Log.d(TAG , "乘客屏未连接, 2秒后重试...") + delay(2000) + } + Log.d(TAG, "乘客屏已连接, 将数据发送给乘客屏...") + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_AI_ROAD_GREEN_WAVE, data.toByteArray()) delay(TimeUnit.MINUTES.toMillis(10)) } @@ -103,21 +120,67 @@ class V2NTest { Log.d(TAG, "location:[x:${targetX}, y:${targetY}, new_location:[x:${newPoint.first}, y:${newPoint.second}]") FunctionBuildConfig.isNewV2NData = true FunctionBuildConfig.v2nMainSwitch = true + runCatching { + val map = HashMap().also { + it["f1"] = FunctionBuildConfig.v2nMainSwitch + it["f2"] = FunctionBuildConfig.isNewV2NData + } + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_NEW_LINK_SWITCH, GsonUtils.toJson(map).toByteArray()) + } + + delay(2000) val eventId = "xxxxxxxxxxxxx" for (i in 0 until 500) { - CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent( - MessagePad.Event.getDefaultInstance().toBuilder() - .setLongitude(newPoint.first) - .setLatitude(newPoint.second) - .setEventId(eventId) - .setTimestamp(System.currentTimeMillis()) - .addAllTargetIds(emptyList()) - .addTargetIdsBytes(ByteString.EMPTY) - .addTargetIds("0") - .setExts("{ \"cameraIp\": \"172.18.7.40\" }") - .build()) + val data = MessagePad.Event.getDefaultInstance().toBuilder().setLongitude(newPoint.first).setLatitude(newPoint.second).setEventId(eventId).setTimestamp(System.currentTimeMillis()).addAllTargetIds(emptyList()).addTargetIdsBytes(ByteString.EMPTY).addTargetIds("0").setExts("{ \"cameraIp\": \"172.18.7.40\",\"eventExtUnits\":[{\"heading\":266.5414733886719,\"uuid\":\"e440951e-5eb6-4091-8560-72a5d8aaf229\"}] }").build() + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_AI_ROAD_PEOPLE_CROSS, data.toByteArray()) + CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent(data) delay(50) - newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, 0.5) + newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, 1.0) + } + delay(TimeUnit.MINUTES.toMillis(10)) + } + + @Test + fun testOtherRetrogradeVehicle(): Unit = runBlocking { + val arguments = InstrumentationRegistry.getArguments() + val millis = arguments.getString("delay", "0").toLong() + if (millis > 0) { + delay(millis) + } + val targetX = arguments.getString("lon", "0").toDouble() + val targetY = arguments.getString("lat", "0").toDouble() + val targetHeading = arguments.getString("angle", "0").toDouble() + val targetDistance = arguments.getString("distance", "0").toDouble() + var car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + var distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY) + Log.d(TAG, "target_distance: $targetDistance, current distance: $distance") + while (distance > targetDistance) { + delay(2000) + car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() + distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY) + } + Log.d(TAG, "2 -- > target_distance: $targetDistance, current distance: $distance") + var newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, targetDistance) + Log.d(TAG, "location:[x:${targetX}, y:${targetY}, new_location:[x:${newPoint.first}, y:${newPoint.second}]") + FunctionBuildConfig.isNewV2NData = true + FunctionBuildConfig.v2nMainSwitch = true + FunctionBuildConfig.isNewV2NData = true + FunctionBuildConfig.v2nMainSwitch = true + runCatching { + val map = HashMap().also { + it["f1"] = FunctionBuildConfig.v2nMainSwitch + it["f2"] = FunctionBuildConfig.isNewV2NData + } + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_NEW_LINK_SWITCH, GsonUtils.toJson(map).toByteArray()) + } + delay(2000) + val eventId = "xxxxxxxxxxxxx" + for (i in 0 until 500) { + val data = MessagePad.Event.getDefaultInstance().toBuilder().setLongitude(newPoint.first).setLatitude(newPoint.second).setEventId(eventId).setTimestamp(System.currentTimeMillis()).addAllTargetIds(emptyList()).addTargetIdsBytes(ByteString.EMPTY).addTargetIds("0").setExts("{ \"cameraIp\": \"172.18.7.40\",\"eventExtUnits\":[{\"heading\":266.5414733886719,\"uuid\":\"e440951e-5eb6-4091-8560-72a5d8aaf229\"}] }").build() + CallerTelematicManager.sendMsgToAllClients(TelematicConstant.V2N_AI_ROAD_OTHER_RETROGRADE_VEHICLE, data.toByteArray()) + CallerV2nNioEventListenerManager.invokeV2nNioOtherRetrogradeEvent(data) + delay(50) + newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, 1.0) } delay(TimeUnit.MINUTES.toMillis(10)) } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt index 5faa3a9f0f..9e0b56a6fd 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt @@ -6,6 +6,8 @@ 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 @@ -197,7 +199,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { } } val alert = sb.toString() - CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude) + CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.detectStartTime, EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude) } } //消息埋点 @@ -210,7 +212,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { } } else if (msg.what == MSG_WHAT_DRAW_YONGDU) { Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 1 ---") - val events = msg.obj as? List<*> +/* val events = msg.obj as? List<*> if (events == null || events.isEmpty()) { Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 1 filter is empty ---") V2XBizTrace.onAck(TAG, mapOf("yongDu" to ""), true) @@ -313,7 +315,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { ) } }.receive() - } + }*/ } else if (msg.what == MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE) { val event = msg.obj as? MessagePad.Event if (event == null) { @@ -321,6 +323,24 @@ internal object V2NIdentifyDrawer: IEventDismissListener { V2XBizTrace.onAck(TAG, mapOf("other_retrograde_vehicle" to "event == null"), true) return@Callback true } + val body = runCatching { GsonUtils.fromJson(event.exts, Map::class.java) }.getOrNull() + val cameraIp = body?.get("cameraIp") as? String ?: "" + val array = (body?.get("eventExtUnits") as? JsonArray) + var heading = 0.0 + var uuid = "" + if (array != null && array.size() > 0) { + for (e in array) { + if (e is JsonObject) { + if (e.has("heading")) { + heading = runCatching { e.asDouble }.getOrNull() ?: 0.0 + } + if (e.has("uuid")) { + uuid = runCatching { e.asString }.getOrNull() ?: "" + } + } + } + } + Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid") val newEventId = "other_retrograde_vehicle_${event.eventId}" AiRoadMarker.aiMakers.getOrPut(newEventId) { val eventLocation = when (event.gnssType) { @@ -335,8 +355,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener { return@Callback true } val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) - val cameraIp = if(TextUtils.isEmpty(event.exts)) "" - else (GsonUtils.fromJson(event.exts, Map::class.java)["cameraIp"])?:"" // 弹事件框 CallerRoadV2NEventWindowListenerManager.showLiveVideo( newEventId, @@ -387,6 +405,24 @@ internal object V2NIdentifyDrawer: IEventDismissListener { } else if (msg.what == MSG_WHAT_DRAW_PEOPLE_CROSS) { Logger.i(TAG, "people cross -- 1 --") val data = msg.obj as? MessagePad.Event ?: return@Callback true + val body = runCatching { GsonUtils.fromJson(data.exts, Map::class.java) }.getOrNull() + val cameraIp = body?.get("cameraIp") as? String ?: "" + val array = (body?.get("eventExtUnits") as? JsonArray) + var heading = 0.0 + var uuid = "" + if (array != null && array.size() > 0) { + for (e in array) { + if (e is JsonObject) { + if (e.has("heading")) { + heading = runCatching { e.asDouble }.getOrNull() ?: 0.0 + } + if (e.has("uuid")) { + uuid = runCatching { e.asString }.getOrNull() ?: "" + } + } + } + } + Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid") AiRoadMarker.aiMakers.getOrPut(data.eventId) { Logger.i(TAG, "people cross -- 2 --") val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) @@ -398,22 +434,19 @@ internal object V2NIdentifyDrawer: IEventDismissListener { return@Callback true } Logger.i(TAG, "people cross -- 3 --") - val cameraIp = if(TextUtils.isEmpty(data.exts)) "" - else (GsonUtils.fromJson(data.exts, Map::class.java)["cameraIp"])?:"" // 弹事件框 CallerRoadV2NEventWindowListenerManager.showLiveVideo( data.eventId, data.timestamp, EventTypeEnumNew.getUpdateIconRes(EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType), String.format(EventTypeEnumNew.getAlarmContent(EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType), distance.toInt()), - isDriver, - cameraIp.toString(), + isDriver, cameraIp, data.longitude, data.latitude) AiRoadMarker() }.also { Logger.i(TAG, "people cross -- 4 --") - it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, 0.0), drawMarker = true, false, isHighFrequency = true) + it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, heading), drawMarker = true, false, isHighFrequency = true) }.receive() } true @@ -457,7 +490,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { var best = Int.MIN_VALUE var delta = Int.MAX_VALUE for (lane in freeLanes) { - val abs = kotlin.math.abs(lane.id - laneId) + val abs = abs(lane.id - laneId) if (abs < delta && lane.id != laneId) { best = lane.id delta = abs @@ -488,7 +521,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { private fun computeCrossCountBetween(start: Triple, end: kotlin.Pair): Int { val points = V2NUtils.generateIntermediatePoints(kotlin.Pair(start.first, start.second), end, 50.0 * 1e-7) V2XBizTrace.onAck(points, "computeCrossCountBetween", true) - var crossId = MapDataWrapper.getCrossRoad(start.first, start.second, start.third)?.cross_id_end + var crossId = MapDataWrapper.getCrossRoad(start.first, start.second, start.third)?.cross_id val angle = start.third var count = 1 for (p in points) { @@ -605,6 +638,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener { private fun drawPeopleCross(event: MessagePad.Event) { Log.d("V2NIdentifyDrawer", "---drawPeopleCross---: $event, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]") if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) { + handler.removeMessages(MSG_WHAT_DRAW_PEOPLE_CROSS) handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_PEOPLE_CROSS, event)) } } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt index 27bff08653..c5a8a3a94b 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/scenario/scene/airoad/AiRoadMarker.kt @@ -11,6 +11,7 @@ import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +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.utilcode.mogo.logger.Logger @@ -101,6 +102,7 @@ class AiRoadMarker { fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false, isHighFrequency:Boolean = false) { val markerId = marker.id if (isHighFrequency && drawMarker) { + this.marker.set(marker) Logger.d(TAG, "marker --->poiType: $marker, ${EventTypeEnumNew.getMarker3DRes(marker.poiType)}") val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER) builder @@ -108,6 +110,9 @@ class AiRoadMarker { .isUseGps(true) .icon3DRes(EventTypeEnumNew.getMarker3DRes(marker.poiType)) .anchorColor("#D65D5AFF") + .controlAngle(true) + .anchor(0.5f, 0.5f) + .rotate(marker.poi_angle.toFloat()) .longitude(marker.poi_lon) .latitude(marker.poi_lat) CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(builder.build())?.let { p -> @@ -119,10 +124,13 @@ class AiRoadMarker { } val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance) wrapper.onRemoved = { - Logger.d(TAG, "222 -> marker --->poiType: $marker, ${EventTypeEnumNew.getMarker3DRes(marker.poiType)}") - CallerRoadV2NEventWindowListenerManager.dismiss(markerId) builders.remove(markerId) markerIds.remove(p.id) + if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) { + CallerHmiManager.dismissGreenWave() + } else { + CallerRoadV2NEventWindowListenerManager.dismiss(marker.id) + } } wrapper.addPoint(p) MarkerRemoveManager.addMarker(wrapper) @@ -222,22 +230,7 @@ class AiRoadMarker { V2XBizTrace.onAck("$TAG -marker-4-l2:", l2) val points = LinkedList() if (l2.points.isNotEmpty()) { - points.addAll(l2.points.reversed()/*.filter { - val location = V2XEventManager.getFirstLocationInCross() - Log.d(TAG, "l2: location -> $location") - if (location != null) { - val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84() - if (DrivingDirectionUtils.getDegreeOfCar2Poi2(carLocation.longitude, carLocation.latitude, location.longitude, location.latitude, carLocation.heading) > 90) { - //处理同一个路口不同车道调头,这种极端情况 - true - } else { - val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(location.longitude, location.latitude, it.longitude, it.latitude, location.heading) - angle <= 90 - } - } else { - true - } - }.*/.map { + points.addAll(l2.points.reversed().map { MogoLatLng(it.latitude, it.longitude) }) } @@ -330,7 +323,11 @@ class AiRoadMarker { roadMarker.removeMarkers() handler.removeCallbacks(checkExpiredTask) aiMakers.remove(marker.id) - CallerRoadV2NEventWindowListenerManager.dismiss("${marker.poi_lon}-${marker.poi_lat}") + if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) { + CallerHmiManager.dismissGreenWave() + } else { + CallerRoadV2NEventWindowListenerManager.dismiss(marker.id) + } } } @@ -373,7 +370,7 @@ class AiRoadMarker { val poi_angle: Double, val polygon: List>? = null, var farthestPoint: Pair? = null, - var entity: V2XRoadEventEntity? = null + var entity: V2XRoadEventEntity? = null, ) { override fun equals(other: Any?): Boolean { diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt index ccc80aa15f..2d58dfb4d9 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt @@ -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.CallerV2nNioEventListenerManager import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager @@ -78,6 +79,30 @@ class TeleMsgHandler : IMsgHandler { return } + if (it.protocolType == TelematicConstant.V2N_AI_ROAD_PEOPLE_CROSS) { + runCatching { + Log.d(TAG, "乘客屏收到司机屏转发云端下发的行人/非机动车横穿事件 --- 1 ---") + CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent(MessagePad.Event.parseFrom(msg.body)) + Log.d(TAG, "乘客屏收到司机屏转发云端下发的行人/非机动车横穿事件 --- 2 ---") + } + return + } + if (it.protocolType == TelematicConstant.V2N_AI_ROAD_GREEN_WAVE) { + runCatching { + Log.d(TAG, "乘客屏收到司机屏转发云端下发的绿波通行 --- 1 ---") + CallerV2nNioEventListenerManager.invokeV2nNioGreenWavePassageEvent(MessagePad.V2nCrossSpeed.parseFrom(msg.body)) + Log.d(TAG, "乘客屏收到司机屏转发云端下发的绿波通行 --- 2 ---") + } + return + } + if (it.protocolType == TelematicConstant.V2N_AI_ROAD_OTHER_RETROGRADE_VEHICLE) { + runCatching { + Log.d(TAG, "乘客屏收到司机屏转发云端下发的他车逆行 --- 1 ---") + CallerV2nNioEventListenerManager.invokeV2nNioOtherRetrogradeEvent(MessagePad.Event.parseFrom(msg.body)) + Log.d(TAG, "乘客屏收到司机屏转发云端下发的他车逆行 --- 2 ---") + } + return + } if (it.protocolType == TelematicConstant.V2N_NEW_LINK_SWITCH) { try { Log.d(TAG, "乘客屏收到司机屏转发的新链路开关 --- 1 ---") diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt index e3d7d7fdb9..7e2d5611c6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiProvider.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.hmi.ui import android.content.Context +import android.telecom.Call import android.text.TextUtils import android.view.Gravity import android.view.ViewGroup @@ -86,9 +87,6 @@ class MoGoHmiProvider : IMoGoHmiProvider { private val xiaozhi by lazy { XiaoZhiStateManager() } - private val greenWave by lazy { AtomicReference() } - - override fun init(context: Context?) { this.context = context } @@ -410,39 +408,10 @@ class MoGoHmiProvider : IMoGoHmiProvider { } override fun showGreenWave(min: Int, max: Int, cross: Int) { - val activity = AppStateManager.currentActivity() ?: return - activity.lifeCycleScope.launch { - greenWave.get()?.hide() - val content = GreenWaveView(activity) - MoGoPopWindow.Builder() - .contentView(content) - .width(WindowManager.LayoutParams.WRAP_CONTENT) - .height(WindowManager.LayoutParams.WRAP_CONTENT) - .attachToActivity(activity) - .draggable(true) - .gravityInActivity(Gravity.CENTER) - .also { - if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { - it.offsetX(960) - it.offsetY(445) - } else { - it.offsetX(980) - it.offsetY(-324) - } - } - .onDismissed { - greenWave.set(null) - } - .onShowed { - content.bind(min, max, cross) - } - .build().also { - greenWave.set(it) - }.show() - } + CallerHmiViewControlListenerManager.invokeGreenWaveVisible(min, max, cross) } override fun dismissGreenWave() { - greenWave.get()?.hide() + CallerHmiViewControlListenerManager.invokeGreenWaveDismiss() } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/greenwave/GreenWaveView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/greenwave/GreenWaveView.kt index 77d3c1dd99..a405df4e2f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/greenwave/GreenWaveView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/greenwave/GreenWaveView.kt @@ -4,6 +4,7 @@ import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater import android.view.MotionEvent +import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.LinearLayout @@ -13,7 +14,9 @@ import androidx.recyclerview.widget.RecyclerView import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener +import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.kotlin.scope import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils @@ -32,7 +35,7 @@ import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recomme import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.recommend_cross as passenger_recommend_cross import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recommend_cross as driver_recommend_cross -class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerView.OnItemTouchListener, Runnable { +class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerView.OnItemTouchListener, Runnable, IViewControlListener { companion object { private const val TAG = "GreenWaveView" @@ -86,15 +89,7 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi override fun onAttachedToWindow() { super.onAttachedToWindow() CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, this) - val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv - rv?.addItemDecoration(CommonDividerItemDecoration.Builder() - .spanCountTBCare(false) - .horizontalInnerSpace(SizeUtils.dp2px(10f)) - .build()) - rv?.addOnItemTouchListener(this) - rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true) - rv?.adapter = WaveAdapter() - startAutoScroll() + CallerHmiViewControlListenerManager.addListener(TAG, this) } private fun startAutoScroll() { @@ -123,6 +118,7 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi override fun onDetachedFromWindow() { super.onDetachedFromWindow() CallerChassisLocationGCJ02ListenerManager.removeListener(TAG) + CallerHmiViewControlListenerManager.removeListener(this) val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv rv?.removeOnItemTouchListener(this) stopAutoScroll() @@ -146,8 +142,18 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi } } - fun bind(minSpeed: Int, maxSpeed: Int, cross: Int) { + private fun show(minSpeed: Int, maxSpeed: Int, cross: Int) { scope.launch { + this@GreenWaveView.visibility = View.VISIBLE + val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv + rv?.addItemDecoration(CommonDividerItemDecoration.Builder() + .spanCountTBCare(false) + .horizontalInnerSpace(SizeUtils.dp2px(10f)) + .build()) + rv?.addOnItemTouchListener(this@GreenWaveView) + rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true) + rv?.adapter = WaveAdapter() + startAutoScroll() if (isDriver) { driver_recommend_speed?.text = "建议车速${minSpeed}-${maxSpeed}km/h" driver_recommend_cross?.text = "可丝滑通过${cross}个路口" @@ -157,4 +163,19 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi } } } + + private fun hide() { + scope.launch { + visibility = View.GONE + } + } + + override fun onGreenWaveViewDismiss() { + hide() + } + + override fun onGreenWaveViewVisible(min: Int, max: Int, cross: Int) { + super.onGreenWaveViewVisible(min, max, cross) + show(min, max, cross) + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt index a50848f4c4..fff66464ca 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt @@ -3,13 +3,14 @@ package com.mogo.eagle.core.function.angle.scenes import com.mogo.eagle.core.function.api.map.angle.Scene import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS +import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS_NEW /** * 十字路口 */ class CrossRoad(private val delayTime: Long): Scene { override val angle: VisualAngleMode - get() = MAP_STYLE_VR_ANGLE_CROSS + get() = MAP_STYLE_VR_ANGLE_CROSS_NEW override val priority: Int = 0 override val displayThreshold: Long diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index 89366b3d52..8da5cdbe45 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -830,7 +830,7 @@ enum class EventTypeEnumNew( } TYPE_SOCKET_ROAD_CONGESTION.poiType -> R.raw.v2x_yongdu TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType -> if (FunctionBuildConfig.skinMode != 0) TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE.traffic3DIconId else TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE.traffic3DNightIconId - TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType -> if (FunctionBuildConfig.skinMode != 0) TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE.traffic3DIconId else TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE.traffic3DNightIconId + TYPE_SOCKET_ROAD_OTHER_RETROGRADE_VEHICLE.poiType -> R.raw.tachexiaoche_collision else -> 0 } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/multidisplay/TelematicConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/multidisplay/TelematicConstant.kt index 8204e91eab..8d5d056f79 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/multidisplay/TelematicConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/multidisplay/TelematicConstant.kt @@ -17,8 +17,12 @@ class TelematicConstant { const val OBU_RUNREDLIGHT_WARNING = 200 //闯红灯预警开关 const val OBU_GREENWAVE_WARNING = 201 //绿波通行开关 - const val V2N_NEW_LINK_SWITCH = 202 // FunctionBuildConfig#v2nMainSwitch & FunctionBuildConfig#isNewV2NData + const val V2N_AI_ROAD_PEOPLE_CROSS = 203 + + const val V2N_AI_ROAD_GREEN_WAVE = 204 + + const val V2N_AI_ROAD_OTHER_RETROGRADE_VEHICLE = 205 } } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewControlListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewControlListener.kt index e7fd6caaf7..bd06018d0a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewControlListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewControlListener.kt @@ -48,4 +48,14 @@ interface IViewControlListener { */ fun updateFuncMode(tag:String, boolean: Boolean){} + /** + * 绿波通行控件展示 + */ + fun onGreenWaveViewVisible(min: Int, max: Int, cross: Int) {} + + + /** + * 绿波通行控件隐藏 + */ + fun onGreenWaveViewDismiss() {} } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiViewControlListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiViewControlListenerManager.kt index b6f905ec74..e1f0b3a2b2 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiViewControlListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiViewControlListenerManager.kt @@ -31,6 +31,20 @@ object CallerHmiViewControlListenerManager : CallerBase() } } + fun invokeGreenWaveVisible(min: Int, max: Int, cross: Int) { + M_LISTENERS.forEach { + val listener = it.value + listener.onGreenWaveViewVisible(min, max, cross) + } + } + + fun invokeGreenWaveDismiss() { + M_LISTENERS.forEach { + val listener = it.value + listener.onGreenWaveViewDismiss() + } + } + fun updateStatusBarRightView( tag: String, insert: Boolean, diff --git a/core/mogo-core-res/src/main/res/raw/tachexiaoche_collision.nt3d b/core/mogo-core-res/src/main/res/raw/tachexiaoche_collision.nt3d new file mode 100644 index 0000000000..6b71c1402e Binary files /dev/null and b/core/mogo-core-res/src/main/res/raw/tachexiaoche_collision.nt3d differ diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt index d2d7d0f69c..332a4e3d3d 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt @@ -44,6 +44,19 @@ object ConstantExt { //无人机视角-缩放值 const val MAP_STYLE_VR_ZOOM_VAL_DRONE = 2.9f + //新路口视角 + const val MAP_STYLE_VR_ANGLE_ROAD_CROSS_NEW = 12 + + //新路口视角-摄像机高度 + const val MAP_STYLE_VR_EYE_HEIGHT_ROAD_CROSS_NEW = 59.3f + + //新路口视角-摄像机角度 + const val MAP_STYLE_VR_OVER_LOOK_ROAD_CROSS_NEW = 36.3f + + //新路口视角-缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_ROAD_CROSS_NEW = 2.9f + + //漫游距离1公里 const val ROAM_DIS_1KM = 1000f //漫游距离3公里 diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt index b75b51fb0e..36b495f9d7 100644 --- a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt @@ -1558,6 +1558,15 @@ class MapController(private var context: Context?, private val mMapView: IMapVie -1 ) } + ConstantExt.MAP_STYLE_VR_ANGLE_ROAD_CROSS_NEW -> { + disableSkyboxAndInterpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_ROAD_CROSS_NEW, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ROAD_CROSS_NEW, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_ROAD_CROSS_NEW, + ConstantExt.MAP_STYLE_VR_ANGLE_ROAD_CROSS_NEW, + -1 + ) + } } if(type != ConstantExt.MAP_STYLE_VR_ROAM) { mEventController?.dispatchMapViewVisualAngleChangeListener(type) diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/VisualAngleMode.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/VisualAngleMode.kt index 9f09a1647e..1917ad497b 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/VisualAngleMode.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/VisualAngleMode.kt @@ -54,10 +54,16 @@ enum class VisualAngleMode(val code: Int) : IMogoMapVisualAngle { */ MAP_STYLE_VR_SKY_BOX(10), + /** * 无人机模式 */ - MAP_STYLE_VR_DRONE(11); + MAP_STYLE_VR_DRONE(11), + + /** + * 十字路口视角-新版 + */ + MAP_STYLE_VR_ANGLE_CROSS_NEW(12); override val isLongSight: Boolean get() = code == MODE_LONG_SIGHT.code