From 5f160b0688796f05700d45e59b601a4a8ecbaf5c Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 23 May 2022 12:49:09 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=8CChange=E3=80=8D=20=E7=82=B9=E4=BA=91?= =?UTF-8?q?=E9=AB=98=E7=B2=BE=E5=9C=B0=E5=9B=BE=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 6 +- .../eagle/core/function/map/MapFragment.java | 1 + .../function/map/MapPointCloudSubscriber.kt | 48 ++++++++++++ .../IMoGoAutopilotPointCloudListener.kt | 20 +++++ ...allerAutopilotPointCloudListenerManager.kt | 73 +++++++++++++++++++ gradle.properties | 2 +- 6 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index 58b6a19d99..1ab3f18cc3 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.autopilot.adapter import chassis.VehicleStateOuterClass import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HdMapBuildConfig -import com.mogo.eagle.core.data.deva.chain.ChainConstant import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD @@ -33,10 +32,11 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListe import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.zhidao.support.adas.high.AdasManager @@ -241,6 +241,8 @@ class MoGoAdasListenerImpl : OnAdasListener { override fun onPointCloud(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) { //点云数据透传 + //Logger.d("pointCloud","pointCloud"+pointCloud); + CallerAutopilotPointCloudListenerManager.invokeAutopilotPointCloudDataUpdate(header,pointCloud) } override fun onBasicInfoReq( diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java index d236338a9f..a4dce21da3 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.java @@ -172,6 +172,7 @@ public class MapFragment extends MvpFragment // TODO 临时初始化地图监听工控机、OBU等数据监听器,用于感知元素绘制 MapIdentifySubscriber.Companion.getInstance(); + MapPointCloudSubscriber.Companion.getInstance(); } @Override 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 new file mode 100644 index 0000000000..df873ea8ed --- /dev/null +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapPointCloudSubscriber.kt @@ -0,0 +1,48 @@ +package com.mogo.eagle.core.function.map + +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPointCloudListener +import com.mogo.eagle.core.function.api.base.IMoGoSubscriber +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.zhidao.support.adas.high.common.PointCloudDecoder +import com.zhidaoauto.map.sdk.open.business.PointCloudHelper +import mogo.telematics.pad.MessagePad +import rule_segement.PointCloud + +/** + * 订阅点云数据 + * 数据来源:工控机、OBU、云端下发 + * + * @author donghongyu + */ +class MapPointCloudSubscriber private constructor() : IMoGoSubscriber, IMoGoAutopilotPointCloudListener { + + private val TAG = "MapPointCloudSubscriber" + + init { + onCrate() + } + + companion object { + val instance: MapPointCloudSubscriber by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { + MapPointCloudSubscriber() + } + } + + override fun onCrate() { + CallerAutopilotPointCloudListenerManager.addListener(TAG, this) + + } + + override fun onDestroy() { + CallerAutopilotPointCloudListenerManager.removeListener(TAG) + + } + + + override fun onAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) { + val data = PointCloudDecoder.decode(header, pointCloud) + val result = PointCloudHelper.updatePointCloudData(data, false, true, true) + //Logger.d(TAG, "result=$result") + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..9437bad03a --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotPointCloudListener.kt @@ -0,0 +1,20 @@ +package com.mogo.eagle.core.function.api.autopilot + +import mogo.telematics.pad.MessagePad +import rule_segement.PointCloud + +/** + * @author xiaoyuzhou + * @date 2021/11/1 5:57 下午 + * 感知识别回调 + */ +interface IMoGoAutopilotPointCloudListener { + + /** + * 点云数据 + * + * @param pointCloud 点云数据 + */ + fun onAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) + +} \ 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 new file mode 100644 index 0000000000..b4e8d6350c --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotPointCloudListenerManager.kt @@ -0,0 +1,73 @@ +package com.mogo.eagle.core.function.call.autopilot + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPointCloudListener +import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.telematics.pad.MessagePad +import perception.TrafficLightOuterClass +import rule_segement.PointCloud +import java.util.concurrent.ConcurrentHashMap + +/** + * @author xiaoyuzhou + * @date 2021/9/30 5:48 下午 + * 点云数据管理 + */ +object CallerAutopilotPointCloudListenerManager : CallerBase() { + + // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + private val M_AUTOPILOT_IDENTIFY_LISTENERS: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加 域控制器感知数据 监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotPointCloudListener + ) { + if (M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { + return + } + M_AUTOPILOT_IDENTIFY_LISTENERS[tag] = listener + } + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) { + return + } + M_AUTOPILOT_IDENTIFY_LISTENERS.remove(tag) + } + + /** + * 删除自动驾驶按钮选中监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMoGoAutopilotPointCloudListener) { + M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { + if (it.value == listener) { + M_AUTOPILOT_IDENTIFY_LISTENERS.remove(it.key) + } + } + } + + /** + * 识别交通元素数据发生更新 回调 + */ + @Synchronized + fun invokeAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) { + M_AUTOPILOT_IDENTIFY_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onAutopilotPointCloudDataUpdate(header,pointCloud) + } + } + +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index d47e0194e9..fcfc0cc7c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -82,7 +82,7 @@ MOGO_LOCATION_VERSION=1.3.59 MOGO_TELEMATIC_VERSION=1.3.59 ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=2.1.1.2 +MAP_SDK_VERSION=2.2.0.1 MAP_SDK_OPERATION_VERSION=1.0.13 # websocket WEBSOCKET_VERSION=1.1.7