Merge branch 'dev_minibus-d_230425_3.2.0' into code_opt_3.3.0

This commit is contained in:
zhongchao
2023-06-01 19:57:23 +08:00
211 changed files with 321 additions and 17329 deletions

View File

@@ -11,7 +11,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.business.ai.net.AiCloudIdentifyNetWorkModel.Companion.aiCloudIdentifyNetWorkModel
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
@@ -50,7 +49,6 @@ class AiCloudIdentifyDataManager : IMogoMapListener,
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerPlanningRottingListenerManager.addListener(TAG,this)
CallerAutoPilotControlManager.getGlobalPath()
MogoAiCloudSocketManager.getInstance(mContext)
.registerOnMessageListener(
0x040003, //低频数据
@@ -163,8 +161,6 @@ class AiCloudIdentifyDataManager : IMogoMapListener,
super.onAutopilotRouteLineId(lineId)
if (lineId == 0L) {
updateRomaStyle(true)
}else{
CallerAutoPilotControlManager.getGlobalPath()
}
}

View File

@@ -0,0 +1,58 @@
package com.mogo.eagle.core.function.business.cachemap
import android.util.Log
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.map.hdcache.IHdCacheListener
object CacheHDMapManager: IMoGoChassisLocationWGS84Listener {
private const val TAG = "CacheHDMapManager"
@Volatile
private var location: MogoLocation? = null
fun scheduleGetLocation() {
if (!AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
ThreadUtils.getIoPool().execute {
if (!CallerMapUIServiceManager.isCityDataCached()) {
while (true) {
if (location != null) {
Log.d(TAG, "开始下载")
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
Log.d(TAG, "下载进度:${progress.toInt()}")
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {
Log.d(TAG, "下载失败")
}
}
}, location!!)
Log.d(TAG, "移除监听并关闭循环")
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
return@execute
}
try {
Log.d(TAG, "开始休眠...")
Thread.sleep(1500)
} catch (e: Exception) {}
}
} else {
Log.d(TAG, "高精地图缓存已下载!")
}
}
}
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
location = gnssInfo
}
}

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
import com.mogo.eagle.core.function.business.cachemap.CacheHDMapManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -73,6 +74,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
CallerLogger.d("$M_MAP$TAG", "executor: ${executor.get()?.hashCode() ?: 0}")
CacheHDMapManager.scheduleGetLocation()
}
override fun onDestroy() {

View File

@@ -130,16 +130,16 @@ object MarkerDrawerManager {
heading
) >= 90
) {
currentIndex = if (i < lastArrivedIndex) {
lastArrivedIndex
} else {
lastArrivedIndex = i
i
}
Log.d("MarkerDrawerManager", "已走过的点的索引为:$currentIndex")
currentIndex = i
}
}
}
Log.d("MarkerDrawerManager", "当次计算已走过的点的索引为:$currentIndex,存储的上次索引为:$lastArrivedIndex")
if (currentIndex < lastArrivedIndex) {
currentIndex = lastArrivedIndex
} else {
lastArrivedIndex = currentIndex
}
newPoints.addAll(routePoints)
newPoints.add(currentIndex + 1, LatLng(realLat, realLon))
return currentIndex + 1

View File

@@ -17,7 +17,6 @@ import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.getGlobalPath
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
@@ -296,10 +295,10 @@ class SmallMapView @JvmOverloads constructor(
endLatLng.latitude, endLatLng.longitude,
currentLatLng.latitude, currentLatLng.longitude
)
CallerLogger.d(
SceneConstant.M_MAP + TAG,
"calculateDistance=$calculateDistance"
)
// CallerLogger.d(
// SceneConstant.M_MAP + TAG,
// "calculateDistance=$calculateDistance"
// )
if (calculateDistance <= 5) {
CallerLogger.d(
SceneConstant.M_MAP + TAG, "onChassisLocationGCJ02 -----> calculateDistance <= 5 ")
@@ -325,8 +324,6 @@ class SmallMapView @JvmOverloads constructor(
UiThreadHandler.post {
clearPolyline()
}
} else if (tempStatus == 1 && autoPilotStatus == 0) {
getGlobalPath()
}
autoPilotStatus = tempStatus
}

View File

@@ -20,7 +20,6 @@ import com.amap.api.maps.CameraUpdate
import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps.TextureMapView
import com.amap.api.maps.model.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.v2x.Center
@@ -29,7 +28,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoV2XListener
import com.mogo.eagle.core.function.api.biz.IFuncBizProvider
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.getGlobalPath
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerV2XListenerManager
@@ -49,9 +47,12 @@ import com.mogo.eagle.core.function.smp.V2XMarkerView
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhidaoauto.map.sdk.open.tools.ThreadPoolUtils
import me.jessyan.autosize.utils.AutoSizeUtils
import mogo.telematics.pad.MessagePad
import mogo.v2x.MogoV2X
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import kotlin.math.pow
/**
@@ -126,6 +127,10 @@ class OverMapView @JvmOverloads constructor(
@Volatile
private var isInit = false
private val singlePool by lazy {
Executors.newSingleThreadExecutor()
}
companion object {
const val TAG = "OverMapView"
}
@@ -408,8 +413,6 @@ class OverMapView @JvmOverloads constructor(
}
})
CallerV2XListenerManager.addListener(TAG, this)
// 主动查一次全局路径规划的数据
getGlobalPath()
}
private fun setUpMap() {
@@ -468,38 +471,36 @@ class OverMapView @JvmOverloads constructor(
return
}
val list: List<MessagePad.Location> = locationList
ThreadUtils.getSinglePool().submit {
lastArrivedIndex = -1
// 转成高德坐标系并存储
updateRoutePoints(list, mContext!!)
val planningPointList: List<LatLng> = planningPoints
UiThreadHandler.post {
displayCustomOverView()
drawStartAndEndMarker(planningPointList)
if (geoHashInfMap.isNullOrEmpty()) {
UiThreadHandler.postDelayed({
drawInfrastructureMarkers(locationList)
}, 1000)
} else {
drawInfrastructureMarkers(locationList)
}
}
}
// 转成高德坐标系并存储
updateRoutePoints(list, mContext!!)
val planningPointList: List<LatLng> = planningPoints
UiThreadHandler.post ({
displayCustomOverView()
drawStartAndEndMarker(planningPointList)
}, UiThreadHandler.MODE.QUEUE)
if (!isInit) {
callback = object : MarkerDrawerManager.Callback {
override fun onLocationChanged(planningPoints: List<LatLng>, locIndex: Int) {
// 每1s刷新一下轨迹线
UiThreadHandler.post {
UiThreadHandler.post ({
if (planningPoints.isNotEmpty()) {
drawPolyline(planningPoints, locIndex)
}
}
}, UiThreadHandler.MODE.QUEUE)
}
}
startLoopCalCarLocation()
isInit = true
}
UiThreadHandler.post({
if (geoHashInfMap.isNullOrEmpty()) {
UiThreadHandler.postDelayed({
drawInfrastructureMarkers(locationList)
}, 1000, UiThreadHandler.MODE.QUEUE)
} else {
drawInfrastructureMarkers(locationList)
}
}, UiThreadHandler.MODE.QUEUE)
}
/**
@@ -884,7 +885,9 @@ class OverMapView @JvmOverloads constructor(
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
singlePool.execute {
handlePlanningData(it.wayPointsList)
}
}
}
@@ -948,8 +951,8 @@ class OverMapView @JvmOverloads constructor(
)
}
}
UiThreadHandler.post {
UiThreadHandler.post({
showV2XEventMarkers(list)
}
}, UiThreadHandler.MODE.QUEUE)
}
}