[MapDataCollect]高精车采需求相关代码移除
[MapDataCollect]高精车采需求相关代码移除
This commit is contained in:
@@ -144,7 +144,6 @@ ext {
|
||||
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
|
||||
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
|
||||
mogocustommap : "com.zhidaoauto.machine:map:${MAP_SDK_VERSION}",
|
||||
mogocustommapoperational : "com.zhidaoauto.map:operational:${MAP_SDK_OPERATION_VERSION}",
|
||||
|
||||
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
|
||||
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
|
||||
|
||||
@@ -14,13 +14,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
@@ -48,7 +46,7 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
|
||||
class MoGoAutopilotProvider :
|
||||
IMoGoAutopilotProvider, IMoGoMapDataCollectProvider.OnMapCollectCmdListener {
|
||||
IMoGoAutopilotProvider {
|
||||
private val TAG = "MoGoAutoPilotProvider"
|
||||
private var mContext: Context? = null
|
||||
|
||||
@@ -63,8 +61,6 @@ class MoGoAutopilotProvider :
|
||||
CupidLogUtils.setEnableLog(false)
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机
|
||||
// 注册地图采集功能
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
// "192.168.1.102"
|
||||
val options = AdasOptions.Builder()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
@@ -210,16 +206,6 @@ class MoGoAutopilotProvider :
|
||||
}, 1000, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
override fun onMapCollectStart(cmdId: Int, cmdTime: Long) {
|
||||
val result = recordPackage(2, cmdId)
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "开始记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun onMapCollectEnd(cmdId: Int, cmdTime: Long) {
|
||||
val result = stopRecord(2, cmdId)
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "结束记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
|
||||
@@ -276,7 +262,6 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.WaringConst
|
||||
@@ -151,14 +150,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun onAutopilotRecordResult(record: RecordPanelOuterClass.RecordPanel) {
|
||||
record ?: return
|
||||
if (HmiBuildConfig.isShowBadCaseView && record.type == 1 && record.stat == 100) {
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(record)
|
||||
}
|
||||
if (record.type == 2 && (record.stat == 101 || record.stat == 100)) {
|
||||
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.filename
|
||||
?: "", record.note ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
||||
@@ -342,12 +342,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
// 绑定车辆
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_BINDING_CAR, "IMoGoBindingcarProvider"));
|
||||
|
||||
// 司机身份专属模块
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 地图数据收集模块
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector"));
|
||||
}
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager
|
||||
.getInstance().initManager(this);
|
||||
|
||||
@@ -51,8 +51,6 @@ dependencies {
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
//implementation rootProject.ext.dependencies.adasHigh
|
||||
implementation rootProject.ext.dependencies.mogocustommapoperational
|
||||
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation rootProject.ext.dependencies.amaplocation
|
||||
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.collect
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.zhidaoauto.map.operational.open.GatherApi
|
||||
import com.zhidaoauto.map.operational.open.GatherParams
|
||||
import com.zhidaoauto.map.operational.open.abs.OnTaskListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER)
|
||||
class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, IMoGoMapLocationListener, IMoGoTokenCallback {
|
||||
|
||||
companion object {
|
||||
const val TAG = "MoGoMapDataCollect"
|
||||
}
|
||||
|
||||
private val executor by lazy {
|
||||
AtomicReference<GatherApi>(null)
|
||||
}
|
||||
|
||||
private val listeners by lazy {
|
||||
CopyOnWriteArrayList<IMoGoMapDataCollectProvider.OnMapCollectCmdListener>()
|
||||
}
|
||||
|
||||
private val map: MutableMap<Int, Status> by lazy {
|
||||
ConcurrentHashMap()
|
||||
}
|
||||
|
||||
override val functionName: String = "$M_MAP$TAG"
|
||||
|
||||
@Volatile
|
||||
private var hasInit = false
|
||||
|
||||
override fun init(context: Context?) {
|
||||
CallerMapLocationListenerManager.addListener(functionName, this)
|
||||
executor.set(context?.let {
|
||||
GatherApi.also { itx ->
|
||||
itx.init(it,
|
||||
GatherParams.init()
|
||||
.setDebugMode(DebugConfig.isDebug())
|
||||
.setCoordinateType(GatherParams.COORDINATETYPE_GCJ02))
|
||||
} })
|
||||
executor.get()?.setOnTaskListener(this)
|
||||
val carSn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
if (!TextUtils.isEmpty(carSn)) {
|
||||
executor.get()?.setCarSn(carSn)
|
||||
}
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
|
||||
executor.get()?.setOnTaskListener(null)
|
||||
listeners.clear()
|
||||
map.clear()
|
||||
}
|
||||
|
||||
override fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- registerOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (listeners.contains(listener)) {
|
||||
return
|
||||
}
|
||||
listeners += listener
|
||||
}
|
||||
|
||||
override fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- unRegisterOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (!listeners.contains(listener)) {
|
||||
return
|
||||
}
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
override fun finish(
|
||||
id: Int,
|
||||
state: Int,
|
||||
gpsPath: String,
|
||||
videoPath: String,
|
||||
reason: String
|
||||
) {
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
try {
|
||||
if (isInValidStatus()) {
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 状态无效")
|
||||
return
|
||||
}
|
||||
if (!map.containsKey(id)) {
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 无相关指令")
|
||||
return
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish: 结束任务[$id]")
|
||||
executor.get()?.finishTask(id, state, gpsPath, videoPath, reason)
|
||||
} catch (e : Throwable) {
|
||||
e.printStackTrace()
|
||||
CallerLogger.e("$M_MAP$TAG", "-- finish:\n$e")
|
||||
} finally {
|
||||
map[id] = Status.FINISH
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskFinish(id: Int, time: Long) {
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
if (!map.containsKey(id) || map[id] == Status.FINISH) {
|
||||
CallerLogger.w("$M_MAP$TAG", "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
return
|
||||
}
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
listeners.forEach {
|
||||
it.onMapCollectEnd(id, time)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskStart(id: Int, time: Long) {
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
map[id] = Status.INIT
|
||||
listeners.forEach {
|
||||
it.onMapCollectStart(id, time)
|
||||
}
|
||||
map[id] = Status.START
|
||||
}
|
||||
|
||||
override fun setIsInit() {
|
||||
if (!hasInit) {
|
||||
executor.get()?.also {
|
||||
hasInit = true
|
||||
CallerLogger.d("$M_MAP$TAG", "告之地图sdk,定义数据可以用了")
|
||||
it.setIsInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?) {
|
||||
location ?: return
|
||||
executor.get()?.updateLocation(
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.bearing,
|
||||
location.speed,
|
||||
location.provider == "GPS_SELF")
|
||||
}
|
||||
|
||||
|
||||
private fun isInValidStatus(): Boolean {
|
||||
if (map.isEmpty()) {
|
||||
return true
|
||||
}
|
||||
val iterator = map.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val next = iterator.next()
|
||||
if (next.value == Status.FINISH) {
|
||||
iterator.remove()
|
||||
}
|
||||
}
|
||||
if (map.filter { it.value == Status.START }.isEmpty()) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onTokenGot(token: String?, sn: String?) {
|
||||
CallerLogger.d("$M_MAP$TAG", "-- onTokenGot --> $sn")
|
||||
sn?.let {
|
||||
executor.get()?.setCarSn(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(code: Int, msg: String?) = Unit
|
||||
|
||||
private sealed class Status {
|
||||
object INIT : Status() //初始状态
|
||||
object START : Status() //开始状态
|
||||
object FINISH : Status() //完成状态
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.mogo.eagle.core.function.api.map.collect
|
||||
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
|
||||
/**
|
||||
* @author renwj
|
||||
* @date 2021/11/10 10:00 上午
|
||||
* 此类主要用来同步自动驾驶定位信息给各业务方
|
||||
*/
|
||||
interface IMoGoMapDataCollectProvider: IMoGoFunctionServerProvider {
|
||||
|
||||
/**
|
||||
* 注册地图组下发收集数据任务指令监听,通知自动驾驶模块开始数据采集
|
||||
*/
|
||||
fun registerOnMapCollectTaskListener(listener: OnMapCollectCmdListener?)
|
||||
|
||||
/**
|
||||
* 移除任务指令监听
|
||||
*/
|
||||
fun unRegisterOnMapCollectTaskListener(listener: OnMapCollectCmdListener?)
|
||||
|
||||
/**
|
||||
* 此接口用于定位准确的时候回调
|
||||
*/
|
||||
fun setIsInit()
|
||||
|
||||
/**
|
||||
* 此接口是自动驾驶模块使用,用于把自动驾驶模块收集的数据给地图组
|
||||
*/
|
||||
fun finish(id: Int, state: Int, gpsPath: String, videoPath: String, reason: String)
|
||||
|
||||
interface OnMapCollectCmdListener {
|
||||
|
||||
/**
|
||||
* 地图组下发地图数据收集开始指令
|
||||
* @param cmdId 指令ID
|
||||
* @param cmdTime 指令下发时间
|
||||
*/
|
||||
fun onMapCollectStart(cmdId: Int, cmdTime: Long)
|
||||
|
||||
/**
|
||||
* 地图组下发地图数据收集结束指令
|
||||
* @param cmdId 指令ID
|
||||
* @param cmdTime 指令下发时间
|
||||
*/
|
||||
fun onMapCollectEnd(cmdId: Int, cmdTime: Long)
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.map
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* @author renwj
|
||||
* @date 2021/11/10 10:30 上午
|
||||
* 此类主要提供给各业务方使用,便于业务层管理数据收集
|
||||
*/
|
||||
object CallerMapDataCollectorManager {
|
||||
|
||||
private val provider: IMoGoMapDataCollectProvider? by lazy {
|
||||
CallerBase.getApiInstance(IMoGoMapDataCollectProvider::class.java, PATH_MAP_DATA_COLLECT_PROVIDER)
|
||||
}
|
||||
|
||||
fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
provider?.registerOnMapCollectTaskListener(listener)
|
||||
}
|
||||
|
||||
fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
provider?.unRegisterOnMapCollectTaskListener(listener)
|
||||
}
|
||||
|
||||
fun finish(id: Int, state: Int, gpsPath: String, videoPath: String, reason: String) {
|
||||
provider?.finish(id, state, gpsPath, videoPath, reason)
|
||||
}
|
||||
|
||||
fun setIsInit() {
|
||||
provider?.setIsInit()
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
|
||||
@@ -1008,7 +1007,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
// 使用外部定位数据修改自车位置
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
|
||||
CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(bean);
|
||||
CallerMapDataCollectorManager.INSTANCE.setIsInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1032,7 +1030,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
// 使用外部定位数据修改自车位置
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
|
||||
CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(bean);
|
||||
CallerMapDataCollectorManager.INSTANCE.setIsInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user