wait to test

This commit is contained in:
zhongchao
2022-04-07 14:38:23 +08:00
parent 3fb14b29a7
commit 1b72b6c9a2
2 changed files with 51 additions and 31 deletions

View File

@@ -1,11 +1,13 @@
package com.mogo.eagle.core.function.map;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
@@ -31,12 +33,12 @@ public class IdentifyDataDrawer {
/**
* 上一帧数据的缓存
*/
private static final ConcurrentHashMap<String, TrafficData> mMarkersCaches = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, MessagePad.TrackedObject> mMarkersCaches = new ConcurrentHashMap<>();
/**
* 已经感知不到的脏数据
*/
private final ConcurrentHashMap<String, TrafficData> mDirtyPositions = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, MessagePad.TrackedObject> firstData = new ConcurrentHashMap<>();
/**
* 记录每次实际绘制的交通元素UUID
*/
@@ -71,6 +73,7 @@ public class IdentifyDataDrawer {
*
* @param resultList adas感知融合数据
*/
@SuppressLint("NewApi")
public void renderAdasRecognizedResult(List<MessagePad.TrackedObject> resultList) {
if (resultList == null || resultList.isEmpty()) {
clearOldMarker();
@@ -84,35 +87,26 @@ public class IdentifyDataDrawer {
return;
}
// 循环将集合中的数据提取记录
for (MessagePad.TrackedObject trafficData : resultList) {
// 过滤掉未知感知数据
if (!FunctionBuildConfig.isDrawUnknownIdentifyData &&
trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
//清除缓存
for (MessagePad.TrackedObject data : resultList) {
if(trafficDataUuidList.size() > 0 && trafficDataUuidList.contains("" + data.getUuid())){
trafficDataUuidList.remove(data.getUuid());
}
trafficDataUuidList.add("" + trafficData.getUuid());
}
// // 找出上一针数据中已经不在本次数据中存在的数据
// for (String uuid : mMarkersCaches.keySet()) {
// if (!trafficDataUuidList.contains(uuid)) {
// mDirtyPositions.put(uuid, mMarkersCaches.get(uuid));
// }
// }
// // 移除脏数据
// for (String uuid : mDirtyPositions.keySet()) {
// MogoApisHandler.getInstance().getApis()
// .getMapServiceApi()
// .getMarkerManager(mContext)
// .removeMarker(uuid);
// }
// 绘制新数据
MogoMarkerManager.getInstance(mContext)
.updateBatchMarkerPosition(filterTrafficData(resultList));
trafficDataUuidList.forEach(uuid -> {
mMarkersCaches.remove(uuid);
});
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "origin data size : " + resultList.size());
ArrayList<MessagePad.TrackedObject> filterList = filterTrafficData(resultList);
if (filterList.size() > 0) {
// 绘制新数据
MogoMarkerManager.getInstance(mContext)
.updateBatchMarkerPosition(filterList);
}
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "first data size : " + firstData.size() + " , mMarkersCaches : " + mMarkersCaches.size());
// 首次未添加的感知物在调用完绘制方法后再塞入cache map
mMarkersCaches.putAll(firstData);
}
/**
@@ -121,14 +115,39 @@ public class IdentifyDataDrawer {
* @return 过滤后的数据集合
*/
private ArrayList<MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
firstData.clear();
mFilterTrafficData.clear();
trafficDataUuidList.clear();
for (MessagePad.TrackedObject data : trafficData) {
// 过滤掉未知感知数据
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}
mFilterTrafficData.add(data);
//首次过来的数据不添加,首次未添加的感知物在调用完绘制方法后再塞入cache map
MessagePad.TrackedObject cacheData = mMarkersCaches.get("" + data.getUuid());
if (cacheData != null) {
//todo 测试航向角修正时打开
MessagePad.TrackedObject correctData = null;
//todo 判断点是不是在当前车道线上,如果是,判断差值,进行修正
// if (Math.abs(cacheData.getHeading() - data.getHeading()) > 90) {
// CallerLogger.INSTANCE.d(M_HMI + "arrow47","uuid修正 上一帧 : " + cacheData.getHeading() + " , 当前帧 : " + data.getHeading());
// correctData = data.toBuilder().setHeading(cacheData.getHeading()).build();
// }
if (correctData != null) {
mFilterTrafficData.add(correctData);
//更新已存在的感知物体数据
mMarkersCaches.put("" + data.getUuid(), correctData);
} else {
mFilterTrafficData.add(data);
//更新已存在的感知物体数据
mMarkersCaches.put("" + data.getUuid(), data);
}
} else {
firstData.put("" + data.getUuid(), data);
}
trafficDataUuidList.add("" + data.getUuid());
}
return mFilterTrafficData;
}