[6.5.0][道路事件] 修复qa发现的问题

This commit is contained in:
renwj
2024-07-09 19:21:02 +08:00
parent b0e216657f
commit 647fd8aa46
22 changed files with 351 additions and 118 deletions

View File

@@ -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<Double, Double, Double>, end: kotlin.Pair<Double, Double>): 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))
}
}

View File

@@ -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<MogoLatLng>()
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<Pair<Double, Double>>? = null,
var farthestPoint: Pair<Double, Double>? = null,
var entity: V2XRoadEventEntity? = null
var entity: V2XRoadEventEntity? = null,
) {
override fun equals(other: Any?): Boolean {

View File

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

View File

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

View File

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

View File

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