From d83fecfcee2a3b6d1b65183917754688fb8f8d1c Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 5 Sep 2022 19:05:15 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20A=E3=80=81=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=92=88=E5=AF=B9260=E4=B9=8B=E5=89=8D=E7=9A=84Docker=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=8D=E5=81=9A=E7=82=B9=E4=BA=91=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../function/map/MapPointCloudSubscriber.kt | 61 ++++++++++++++++--- .../IMoGoAutopilotPointCloudListener.kt | 5 -- ...allerAutopilotPointCloudListenerManager.kt | 12 ---- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt index 77c13167a1..e851f1debb 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt @@ -1,13 +1,14 @@ package com.mogo.eagle.core.function.map +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPointCloudListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.base.IMoGoSubscriber +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.zhidaoauto.map.sdk.open.business.PointCloudHelper -import mogo.telematics.pad.MessagePad -import rule_segement.MogoPointCloudOuterClass import java.math.BigDecimal /** @@ -16,12 +17,15 @@ import java.math.BigDecimal * * @author donghongyu */ -class MapPointCloudSubscriber private constructor() : IMoGoSubscriber, IMoGoAutopilotPointCloudListener { +class MapPointCloudSubscriber private constructor() + : IMoGoSubscriber, IMoGoAutopilotPointCloudListener, IMoGoAutopilotStatusListener { private val TAG = "MapPointCloudSubscriber" private var isDrawPointCloud = false + private var mAutoPilotStatusInfo: AutopilotStatusInfo? = null + init { onCrate() } @@ -34,16 +38,18 @@ class MapPointCloudSubscriber private constructor() : IMoGoSubscriber, IMoGoAuto override fun onCrate() { CallerAutopilotPointCloudListenerManager.addListener(TAG, this) - + // 添加 ADAS状态 监听 + CallerAutoPilotStatusListenerManager.addListener(TAG, this) } override fun onDestroy() { CallerAutopilotPointCloudListenerManager.removeListener(TAG) + CallerAutoPilotStatusListenerManager.removeListener(TAG) } override fun onAutopilotPointCloudDataUpdate(pointCloud: ByteArray?) { try {// 根据配置动态控制点云是否绘制 - if (FunctionBuildConfig.isDrawPointCloudData) { + if (FunctionBuildConfig.isDrawPointCloudData && isDrawCloudPointDockerVersion()) { if (!isDrawPointCloud) { Logger.d(TAG, "====开启点云渲染====") isDrawPointCloud = true @@ -74,13 +80,48 @@ class MapPointCloudSubscriber private constructor() : IMoGoSubscriber, IMoGoAuto } } - override fun onAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: MogoPointCloudOuterClass.MogoPointCloud?) { -// Logger.d(TAG, "数据对比:" -// + "\n自车定位:自车的 satelliteTime==${getPrettyNumber(CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().satelliteTime.toString())} 经纬度:${CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().locationLat},${CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().locationLon}" -// + "\n点云数据:点云的 header?.timestamp==${getPrettyNumber(header?.timestamp.toString())} 经纬度:${pointCloud?.selfLatitude},${pointCloud?.selfLongitude} 点云数量:addDataCount==${pointCloud?.addDataCount} delDataCount===${pointCloud?.delDataCount} " -// ) + override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { + mAutoPilotStatusInfo = autoPilotStatusInfo } + /** + * 判断是否是260之后但版本 + */ + fun isDrawCloudPointDockerVersion(): Boolean { + // 由于Docker命名规则不统一,但核心版本是统一但,采用"."分割,如下 + // MAP-taxi_RoboTaxi_Default_2.2.0_badcasetest_20220215_dev + val dockerVersionName = mAutoPilotStatusInfo?.dockVersion + // "." 分割,取前两位 + val dockerVersionNameArray = dockerVersionName?.split(".") + + var dockerVersionCode = "" + dockerVersionNameArray?.let { + if (it.size > 3) { + for (index in 0 until 3) { + dockerVersionCode += + when (index) { + 0 -> { + it[index].substring(it[index].lastIndex) + } + it.size - 1 -> { + it[index].substring(0, 1) + } + else -> { + it[index] + } + } + } + } + } + val dockerVersion = dockerVersionCode.toInt() + + if (dockerVersion >= 260) { + return true + } + return false + } + + fun getPrettyNumber(number: String): String { return BigDecimal.valueOf(number.toDouble()) .stripTrailingZeros().toPlainString() diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt index 8c4e0776a0..2cc349f35a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt @@ -18,9 +18,4 @@ interface IMoGoAutopilotPointCloudListener { */ fun onAutopilotPointCloudDataUpdate(pointCloud: ByteArray?) - /** - * - */ - fun onAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: MogoPointCloudOuterClass.MogoPointCloud?) - } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt index 798aba4b33..d95ada7645 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt @@ -68,16 +68,4 @@ object CallerAutopilotPointCloudListenerManager : CallerBase() { } } - /** - * 点云数据 回调 - */ - @Synchronized - fun invokeAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: MogoPointCloudOuterClass.MogoPointCloud?) { - M_POINT_CLOUD_LISTENERS.forEach { - val tag = it.key - val listener = it.value - listener.onAutopilotPointCloudDataUpdate(header, pointCloud) - } - } - } \ No newline at end of file