Merge remote-tracking branch 'origin/dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_robotaxi-d-app-module_251_220125_2.5.1
This commit is contained in:
@@ -99,8 +99,8 @@ ext {
|
||||
videoprocessor : "com.zhidao.video:video-processor:1.0.2.1",
|
||||
livesdk : "com.tencent.liteavsdk:LiteAVSDK_Smart:7.4.9211",
|
||||
|
||||
coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3",
|
||||
coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3",
|
||||
coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2",
|
||||
coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2",
|
||||
|
||||
aspectj : "org.aspectj:aspectjrt:1.8.9",
|
||||
|
||||
@@ -147,6 +147,7 @@ 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}",
|
||||
modulemain : "com.mogo.module:module-main:${MOGO_MODULE_MAIN_VERSION}",
|
||||
|
||||
@@ -10,10 +10,12 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
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.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
@@ -30,7 +32,7 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
|
||||
class MoGoAutopilotProvider :
|
||||
IMoGoAutopilotProvider {
|
||||
IMoGoAutopilotProvider, IMoGoMapDataCollectProvider.OnMapCollectCmdListener {
|
||||
private val TAG = "MoGoAutoPilotProvider"
|
||||
private var mContext: Context? = null
|
||||
|
||||
@@ -60,6 +62,7 @@ class MoGoAutopilotProvider :
|
||||
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
|
||||
// 同步数据给工控机的服务
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,6 +92,16 @@ class MoGoAutopilotProvider :
|
||||
}, 1000, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
override fun onMapCollectStart(cmdId: Int, cmdTime: Long) {
|
||||
val result = recordPackage(2, cmdId)
|
||||
Logger.d(TAG, "开始记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun onMapCollectEnd(cmdId: Int, cmdTime: Long) {
|
||||
val result = stopRecord(2, cmdId)
|
||||
Logger.d(TAG, "结束记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
if (AdasManager.getInstance().isSocketConnect) {
|
||||
val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result)
|
||||
@@ -115,6 +128,18 @@ class MoGoAutopilotProvider :
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int, duration: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id, duration)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecord(type, id)
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
CupidLogUtils.setEnableLog(isEnableLog)
|
||||
}
|
||||
@@ -124,7 +149,7 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
|
||||
@@ -329,6 +329,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
// 推送模块
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
|
||||
|
||||
// 地图数据收集模块
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector"));
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager
|
||||
.getInstance().initManager(this);
|
||||
|
||||
@@ -51,7 +51,7 @@ dependencies {
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.adasHigh
|
||||
|
||||
implementation rootProject.ext.dependencies.mogocustommapoperational
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
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.eagle.core.data.constants.MogoServicePaths
|
||||
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.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhidaoauto.map.operational.MapCollectionTaskRecive
|
||||
import com.zhidaoauto.map.operational.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<MapCollectionTaskRecive?>(null)
|
||||
}
|
||||
|
||||
private val listeners by lazy {
|
||||
CopyOnWriteArrayList<IMoGoMapDataCollectProvider.OnMapCollectCmdListener>()
|
||||
}
|
||||
|
||||
private val map: MutableMap<Int, Status> by lazy {
|
||||
ConcurrentHashMap()
|
||||
}
|
||||
|
||||
override val functionName: String = TAG
|
||||
|
||||
override fun init(context: Context?) {
|
||||
CallerMapLocationListenerManager.addListener(functionName, this)
|
||||
executor.set(context?.let { MapCollectionTaskRecive(it) })
|
||||
executor.get()?.setOnTaskListener(this)
|
||||
val carSn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
if (!TextUtils.isEmpty(carSn)) {
|
||||
executor.get()?.setCarSn(carSn)
|
||||
}
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
Logger.d(TAG, "--------- init --------")
|
||||
Logger.d(TAG, "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
Logger.d(TAG, "--------- onDestroy --------")
|
||||
executor.get()?.let {
|
||||
it.setOnTaskListener(null)
|
||||
it.destory()
|
||||
}
|
||||
listeners.clear()
|
||||
map.clear()
|
||||
}
|
||||
|
||||
override fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(TAG, "--------- registerOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (listeners.contains(listener)) {
|
||||
return
|
||||
}
|
||||
listeners += listener
|
||||
}
|
||||
|
||||
override fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(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
|
||||
) {
|
||||
Logger.d(TAG, "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
try {
|
||||
if (isInValidStatus()) {
|
||||
Logger.w(TAG, "-- finish: 状态无效")
|
||||
return
|
||||
}
|
||||
if (!map.containsKey(id)) {
|
||||
Logger.w(TAG, "-- finish: 无相关指令")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "-- finish: 结束任务[$id]")
|
||||
executor.get()?.finishTask(id, state, gpsPath, videoPath, reason)
|
||||
} catch (e : Throwable) {
|
||||
e.printStackTrace()
|
||||
Logger.e(TAG, "-- finish:\n$e");
|
||||
} finally {
|
||||
map[id] = Status.FINISH
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskFinish(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
if (!map.containsKey(id) || map[id] == Status.FINISH) {
|
||||
Logger.w(TAG, "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
listeners.forEach {
|
||||
it.onMapCollectEnd(id, time)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskStart(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
map[id] = Status.INIT
|
||||
listeners.forEach {
|
||||
it.onMapCollectStart(id, time)
|
||||
}
|
||||
map[id] = Status.START
|
||||
}
|
||||
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?) {
|
||||
location ?: return
|
||||
executor.get()?.onMapChange(
|
||||
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?) {
|
||||
Logger.d(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() //完成状态
|
||||
}
|
||||
}
|
||||
@@ -268,4 +268,10 @@ public class MogoServicePaths {
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_DEVA_TOOLS = "/deva/tools";
|
||||
|
||||
/**
|
||||
* 地图数据更新输助类
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_MAP_DATA_COLLECT_PROVIDER = "/map_x/collect";
|
||||
}
|
||||
|
||||
@@ -41,6 +41,33 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
|
||||
*/
|
||||
fun recordPackage(): Boolean
|
||||
|
||||
/**
|
||||
* 开启域控制器录制bag包
|
||||
*
|
||||
* @return true-成功,false-失败
|
||||
* @param type 录制类型 1: badcase 2:map 3:rests
|
||||
* @param id 指令/任务 ID
|
||||
*/
|
||||
fun recordPackage(type: Int, id: Int): Boolean
|
||||
|
||||
/**
|
||||
* 开启域控制器录制bag包
|
||||
*
|
||||
* @return true-成功,false-失败
|
||||
* @param type 录制类型 1: badcase 2:map 3:rests
|
||||
* @param id 指令/任务 ID
|
||||
* @param duration 录制时长
|
||||
*/
|
||||
fun recordPackage(type: Int, id: Int, duration: Int): Boolean
|
||||
|
||||
/**
|
||||
* 结束录制
|
||||
* @param type 录制类型 1: badcase 2:map 3:rests
|
||||
* @param id 指令/任务 ID
|
||||
* @return true: 成功; false 失败
|
||||
*/
|
||||
fun stopRecord(type: Int, id: Int): Boolean
|
||||
|
||||
/**
|
||||
* Log 是否显示
|
||||
*
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
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 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,9 +1,12 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.os.SystemClock
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
*@author xiaoyuzhou
|
||||
@@ -60,7 +63,15 @@ object CallerAutoPilotManager {
|
||||
* 开启域控制器录制bag包
|
||||
*/
|
||||
fun recordPackage() {
|
||||
providerApi?.recordPackage()
|
||||
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt())
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int, id: Int) {
|
||||
providerApi?.recordPackage(type, id)
|
||||
}
|
||||
|
||||
fun recordPackage(type: Int, id: Int, duration: Int) {
|
||||
providerApi?.recordPackage(type, id, duration)
|
||||
}
|
||||
|
||||
fun setEnableLog(isEnableLog: Boolean) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@ MOGO_LOCATION_VERSION=1.3.18
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 自研地图
|
||||
MAP_SDK_VERSION=2.0.0.24
|
||||
MAP_SDK_OPERATION_VERSION=1.0.11
|
||||
# websocket
|
||||
WEBSOCKET_VERSION=1.1.7
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
|
||||
Reference in New Issue
Block a user