Merge remote-tracking branch 'origin/dev_robotaxi-d_240705_6.5.0' into dev_robotaxi-d_240705_6.5.0

This commit is contained in:
xuxinchao
2024-07-16 19:46:35 +08:00
4 changed files with 103 additions and 127 deletions

View File

@@ -81,7 +81,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
Log.d("V2NIdentifyDrawer", "---callback -- drawShiGu --- 1 ---")
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val filtered = events.filterIsInstance<TrackedObject>().filter { itx ->
var filtered = events.filterIsInstance<TrackedObject>().filter { itx ->
DrivingDirectionUtils.getDegreeOfCar2Poi(
car.longitude,
car.latitude,
@@ -104,8 +104,17 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
} else {
Log.d("V2NIdentifyDrawer", "---callback -- drawShiGu --- 2 ---")
}
val data = filtered
filtered = filtered.filter { itx ->
val trackedSourceList = itx.trackedSourceList
trackedSourceList.isNotEmpty() && trackedSourceList.find { it.source != 1 } != null
}
if (filtered.isEmpty()) {
V2XBizTrace.onAck(data, mapOf("shiGong-shiGu-filter-2" to "数据来源不对"), true)
return@Callback true
}
filtered.forEach { itx ->
val id = itx.uuid.toString()
val id = itx.v2XUuid.ifEmpty { itx.uuid.toString() }
V2XBizTrace.onAck(itx, "filtered -> ${itx.type}")
Log.d("V2NIdentifyDrawer", "---callback --- id: $id ---")
AiRoadMarker.aiMakers.getOrPut(id) {
@@ -197,110 +206,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
}
} else if (msg.what == MSG_WHAT_DRAW_YONGDU) {
Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 1 ---")
/* 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)
return@Callback true
}
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val filtered = events.filterIsInstance<RTEData_PB>().filter { itx ->
val eventLon =
itx.eventPos?.offsetLL?.positionLatLon?.lon?.let { it * 1.0 / 10_000_000 }
?: 0.0
val eventLat =
itx.eventPos?.offsetLL?.positionLatLon?.lat?.let { it * 1.0 / 10_000_000 }
?: 0.0
DrivingDirectionUtils.getDegreeOfCar2Poi(
car.longitude,
car.latitude,
eventLon,
eventLat,
car.heading.toInt()
) < 90 && CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, eventLon, eventLat) <= 300
}
if (filtered.isEmpty()) {
Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 2 filter is empty ---")
V2XBizTrace.onAck(TAG, mapOf("yongDu-filter" to ""), true)
return@Callback true
}
Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 2 ---")
filtered.forEach { itx ->
val id = itx.rteId.toString()
val lon = itx.eventPos?.offsetLL?.positionLatLon?.lon?.let { it * 1.0 / 10_000_000 }
?: 0.0
val lat = itx.eventPos?.offsetLL?.positionLatLon?.lat?.let { it * 1.0 / 10_000_000 }
?: 0.0
Log.d("V2NIdentifyDrawer", "---callback -- id: $id---")
AiRoadMarker.aiMakers.getOrPut(id) {
AiRoadMarker().apply {
val poiType = getPoiType(itx.eventType).poiType
marker(Marker(id, poiType, lon, lat, car.heading, null, null,
V2XRoadEventEntity().also { e ->
e.poiType = poiType
e.location = MarkerLocation().also { l ->
val p = CoordinateTransform.WGS84ToGCJ02(lon, lat)
l.lon = p[0]
l.lat = p[1]
l.angle = car.heading
}
e.noveltyInfo = MarkerExploreWay().also {
it.poiType = poiType
it.location = e.location
it.polygon = emptyList()
}
}), true, isDrawRoadLine(poiType)
)
val distance = CoordinateUtils.calculateLineDistance(
lon,
lat,
car.longitude,
car.latitude
)
val alertContent = getAlertContent(poiType, distance.toDouble())
val ttsContent = getTtsContent(poiType, distance.toDouble())
V2XBizTrace.onAck(TAG, "绘制poi事件:$poiType")
saveMsgBox(
MsgBoxBean(
V2X,
V2XMsg(
poiType,
alertContent,
ttsContent,
CommunicationType.V2N.name
)
)
)
CallerHmiManager.warningV2X(
poiType,
alertContent,
ttsContent,
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.START) }
CallerVisualAngleManager.changeScene(RoadEvent(2, SECONDS))
}
override fun onDismiss() {
super.onDismiss()
runCatching { CallerHmiManager.notifyXiaoZhiStatusChanged(V2N(EventTypeEnumNew.getEnumType(poiType)), State.STOP) }
CallerVisualAngleManager.changeScene(Default())
}
},
ALERT_WARNING_TOP,
10000,
false
)
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent(
poiType, alertContent, ttsContent,
DataSourceType.AICLOUD, CommunicationType.V2N
)
}
}.receive()
}*/
} else if (msg.what == MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE) {
val event = msg.obj as? MessagePad.Event
if (event == null) {

View File

@@ -115,7 +115,7 @@ class AiRoadMarker {
.longitude(marker.poi_lon)
.latitude(marker.poi_lat)
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType) {
builder.anchorColor("#FFE1BA9A")
builder.anchorColor("#D6E1BA9A")
}
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(builder.build())?.let { p ->
if (!markerIds.contains(markerId)) {

View File

@@ -12,11 +12,15 @@ import com.bumptech.glide.request.transition.Transition
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.data.road.RoadCameraLive
import com.mogo.eagle.core.function.business.roadcross.net.BATCH_LIVE
import com.mogo.eagle.core.function.business.roadcross.net.INDERoadCameraApiService
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.cancel
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.core.utilcode.util.LocationUtils
@@ -26,6 +30,15 @@ import java.util.Locale
class TravelRealityModel private constructor() {
@Volatile
private var eventKey = ""
@Volatile
private var deviceKey = ""
@Volatile
private var trackKey = ""
@Volatile
private var liveKey = ""
companion object {
val travelNetWorkModel by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
TravelRealityModel()
@@ -42,7 +55,8 @@ class TravelRealityModel private constructor() {
*/
fun getEventsWithTrajRequest(reqData: EventReqEntity,
onSuccess: ((List<EventBean>) -> Unit), onError: ((String) -> Unit)){
request<Response<List<EventBean>?>>{
eventKey = "getEvents_${System.currentTimeMillis()}"
request<Response<List<EventBean>?>>(eventKey) {
loader {
apiResponseCall{
val time = System.currentTimeMillis().toString()
@@ -63,7 +77,8 @@ class TravelRealityModel private constructor() {
* 查询路口设备
*/
fun getCrossDevice(onSuccess: ((List<CrossDeviceBean>) -> Unit), onError: ((String) -> Unit)) {
request<BaseResponse<List<CrossDeviceBean>?>>{
deviceKey = "getDevice_${System.currentTimeMillis()}"
request<BaseResponse<List<CrossDeviceBean>?>>(deviceKey) {
loader {
apiCall{
val time = System.currentTimeMillis().toString()
@@ -82,6 +97,21 @@ class TravelRealityModel private constructor() {
}
}
fun cancelAllRequest() {
if (eventKey.isNotEmpty()) {
cancel(eventKey)
}
if (deviceKey.isNotEmpty()) {
cancel(deviceKey)
}
if (trackKey.isNotEmpty()) {
cancel(trackKey)
}
if (liveKey.isNotEmpty()) {
cancel(liveKey)
}
}
/**
* 智慧路口路网范围
*/
@@ -109,7 +139,8 @@ class TravelRealityModel private constructor() {
* 智慧道路轨迹
*/
fun getCityRoadTrack(onSuccess: ((List<List<List<Double>?>?>?) -> Unit), onError: ((String) -> Unit)) {
request<BaseResponse<List<List<List<Double>?>?>?>>{
trackKey = "getTrack_${System.currentTimeMillis()}"
request<BaseResponse<List<List<List<Double>?>?>?>>(trackKey) {
loader {
apiCall{
val time = System.currentTimeMillis().toString()
@@ -128,6 +159,37 @@ class TravelRealityModel private constructor() {
}
}
fun batchRequestCrossLive(
list: MutableList<String>, onSuccess: ((List<RoadCameraLive>) -> Unit),
onError: ((String) -> Unit)
) {
liveKey = "batchLive_${System.currentTimeMillis()}"
request<BaseResponse<List<RoadCameraLive>>>(liveKey) {
loader {
apiCall {
val time = System.currentTimeMillis().toString()
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val cityCode = CallerMapUIServiceManager.getCityCode() ?: "0734"
val map = mutableMapOf(
"lon" to loc.longitude,
"lat" to loc.latitude,
"ipList" to list,
"cityCode" to cityCode
)
val md5String = "/${BATCH_LIVE.uppercase(Locale.getDefault())}$time"
MoGoRetrofitFactory.getInstanceNoCallAdapter(HostConst.getNDEHost())
.create(INDERoadCameraApiService::class.java).cameraLiveBatchRequest(Md5Util.getMD5Result(md5String), time, map)
}
}
onSuccess {
onSuccess.invoke(it.result)
}
onError {
onError.invoke(it.message.toString())
}
}
}
fun downloadImage(context: Context, url: String?,
latLng: LatLng,
onSuccess: ((Bitmap, LatLng) -> Unit),

View File

@@ -27,10 +27,10 @@ import com.amap.api.maps.model.Marker
import com.amap.api.maps.model.MarkerOptions
import com.amap.api.maps.model.Polyline
import com.amap.api.maps.model.PolylineOptions
import com.google.gson.reflect.TypeToken
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.business.roadcross.net.NDERoadCameraNetWorkModel.Companion.ndeRoadCameraNetWorkModel
import com.mogo.eagle.core.function.business.travelreality.CrossDeviceBean
import com.mogo.eagle.core.function.business.travelreality.DeviceInfoBean
import com.mogo.eagle.core.function.business.travelreality.EventBean
@@ -482,9 +482,9 @@ class TravelRealityView @JvmOverloads constructor(
}
}
}
Log.d(TAG, "过滤掉的事件个数为:${eventList.size - eventOptionsList.size}")
// 事件不足3个则用路口设备补齐
completeQuantity()
Log.d(TAG, "过滤掉的事件个数为:${eventList.size - eventOptionsList.size}")
// 绘制道路事件
drawMarkers(DRAW_ROAD_EVENT, eventOptionsList)
}
@@ -492,10 +492,12 @@ class TravelRealityView @JvmOverloads constructor(
private fun completeQuantity() {
ipPointMap.clear()
// 全部展示事件,事件数不足则用路口设备补齐
Log.d(TAG, "待绘制的道路事件的个数为:${roadEventList.size}")
if (roadEventList.size >= 3) {
val ipList = mutableListOf<String>()
roadEventList[0].let {
it.ip?.let { ip ->
it.ip?.also { ip ->
if (ip.isEmpty()) return@also
ipPointMap[ip] = VideoMarkerEntity(
coordinateConverterWgsToGcj(it.lat, it.lon),
it.title,
@@ -505,7 +507,8 @@ class TravelRealityView @JvmOverloads constructor(
}
}
roadEventList[(roadEventList.size - 1) / 2].let {
it.ip?.let { ip ->
it.ip?.also { ip ->
if (ip.isEmpty()) return@also
ipPointMap[ip] = VideoMarkerEntity(
coordinateConverterWgsToGcj(it.lat, it.lon),
it.title,
@@ -515,7 +518,8 @@ class TravelRealityView @JvmOverloads constructor(
}
}
roadEventList[roadEventList.size - 1].let {
it.ip?.let { ip ->
it.ip?.also { ip ->
if (ip.isEmpty()) return@also
ipPointMap[ip] = VideoMarkerEntity(
coordinateConverterWgsToGcj(it.lat, it.lon),
it.title,
@@ -568,14 +572,14 @@ class TravelRealityView @JvmOverloads constructor(
}
}
"800006" -> {// 拥堵
eventOptionsList.add(MarkerOptions().apply {
position(coordinateConverterWgsToGcj(eventBean.lat, eventBean.lon))
anchor(0.5f, 0.5f)
zIndex(0.8f)
icon(BitmapDescriptorFactory.fromResource(R.drawable.mogo_yongdu_nor))
})
}
// "800006" -> {// 拥堵
// eventOptionsList.add(MarkerOptions().apply {
// position(coordinateConverterWgsToGcj(eventBean.lat, eventBean.lon))
// anchor(0.5f, 0.5f)
// zIndex(0.8f)
// icon(BitmapDescriptorFactory.fromResource(R.drawable.mogo_yongdu_nor))
// })
// }
"800004" -> {// 静止事件
eventOptionsList.add(MarkerOptions().apply {
@@ -617,6 +621,7 @@ class TravelRealityView @JvmOverloads constructor(
val ipList = mutableListOf<String>()
roadEventList.forEach {
it.ip?.let { ip ->
if (ip.isEmpty()) return@let
ipPointMap[ip] = VideoMarkerEntity(
coordinateConverterWgsToGcj(it.lat, it.lon),
it.title,
@@ -663,7 +668,7 @@ class TravelRealityView @JvmOverloads constructor(
private fun reqCrossLive(ipList: MutableList<String>) {
Log.d(TAG, "请求获取缩略图!")
ndeRoadCameraNetWorkModel.batchRequestCrossLive(ipList, onSuccess = {
travelNetWorkModel.batchRequestCrossLive(ipList, onSuccess = {
val liveOptionsList = ArrayList<MarkerOptions>()
var markerOption: MarkerOptions
var pair: Pair<Float, Float>
@@ -686,12 +691,13 @@ class TravelRealityView @JvmOverloads constructor(
"绘制时位置为:${ipPointMap[ip]?.latLng},标题为:${ipPointMap[ip]!!.title},方向为:${ipPointMap[ip]!!.orientation},锚点为:${pair}"
)
markerOption.anchor(pair.first, pair.second)
view.setPlaceHolder()
markerOption.icon(BitmapDescriptorFactory.fromView(view))
} else {
return@let
}
view.setPlaceHolder()
markerOption.icon(BitmapDescriptorFactory.fromView(view))
} else {
// 需要下载缩略图
markerOption.icon(null)
markerOption.position(ipPointMap[ip]?.latLng)
pair = travelNetWorkModel.calculateAnchor(ipPointMap[ip]?.orientation ?: 0)
@@ -765,6 +771,7 @@ class TravelRealityView @JvmOverloads constructor(
)
}
deviceInPathList = arrayListOf(CrossDeviceBean("", 0.0, "", 0.0, deviceInPaths))
Log.d(TAG, "待绘制的全息路口的个数为:${crossOptionsList.size}")
// 绘制路口设备
drawMarkers(DRAW_CROSS_DEVICE, crossOptionsList)
}
@@ -1071,6 +1078,9 @@ class TravelRealityView @JvmOverloads constructor(
lastTime = System.currentTimeMillis()
}
globalPathResp?.let { globalPath ->
nonFrequentHandler?.removeCallbacksAndMessages(null)
travelNetWorkModel.cancelAllRequest()
val pointList = ArrayList<Point>()
globalPath.wayPointsList.forEach { loc ->
pointList.add(Point(loc.longitude, loc.latitude))
@@ -1171,7 +1181,6 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_LIVE_DETAIL -> {
removeMessages(DRAW_LIVE_DETAIL)
removeMessages(UPDATE_VIDEO_MARKER)
(msg.obj as ArrayList<MarkerOptions>).apply {
realDrawLiveMarkers(this)
}