wait to finish
This commit is contained in:
@@ -1,8 +1,59 @@
|
||||
package com.mogo.eagle.core.function.map;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class TrackManager {
|
||||
|
||||
private static final class TrackOwner{
|
||||
// private static final
|
||||
private static final class TrackOwner {
|
||||
private static final TrackManager trackManager = new TrackManager();
|
||||
}
|
||||
|
||||
public static TrackManager getInstance() {
|
||||
return TrackOwner.trackManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* marker缓存队列
|
||||
*/
|
||||
private final ArrayMap<String, TrackObj> mMarkersCaches = new ArrayMap<>();
|
||||
|
||||
/**
|
||||
* 过滤后的数据集合
|
||||
*/
|
||||
private final ArrayList<MessagePad.TrackedObject> mFilterTrafficData = new ArrayList<>();
|
||||
|
||||
|
||||
public ArrayList<MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
|
||||
//清空上次返回数据,做到缓存复用
|
||||
mFilterTrafficData.clear();
|
||||
//进入过滤机制的感知物体,首先从缓存队列中进行查找 uuid
|
||||
for (MessagePad.TrackedObject data : trafficData) {
|
||||
// todo 过滤掉未知感知数据,后面会依据危险等级显示
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
|
||||
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
|
||||
continue;
|
||||
}
|
||||
String uuid = "" + data.getUuid();
|
||||
TrackObj trackObj = mMarkersCaches.get(uuid);
|
||||
if (trackObj != null) {
|
||||
data = trackObj.updateObj(data);
|
||||
mFilterTrafficData.add(data);
|
||||
} else {
|
||||
trackObj = new TrackObj(data);
|
||||
//todo 判断是否有重合元素 google s2
|
||||
|
||||
}
|
||||
mMarkersCaches.put(uuid, trackObj);
|
||||
}
|
||||
return mFilterTrafficData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
package com.mogo.eagle.core.function.map;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class TrackObj {
|
||||
|
||||
private final CircleQueue circleQueue = new CircleQueue(10);
|
||||
private final int[] observationType = new int[3]; //类型变化的观测数组
|
||||
private final KalmanFilter kalmanFilter; //卡尔曼结果
|
||||
private S2CellId s2CellId; //s2 id权重
|
||||
private long recentlyTime;
|
||||
private double headingDelta; //航向角德尔塔
|
||||
private double speedDelta; //速度德尔塔
|
||||
private double typeWeight; //类型权重
|
||||
private final int[] observationType = new int[3]; //类型变化的观测数组
|
||||
|
||||
public TrackObj(MessagePad.TrackedObject data) {
|
||||
kalmanFilter = new KalmanFilter(data.getLongitude(), data.getLatitude(), 0.0000005);
|
||||
circleQueue.addQueue(new ObjQueue(data.getHeading(), data.getSpeed(), data.getType()));
|
||||
recentlyTime = Double.valueOf(data.getSatelliteTime()).longValue();
|
||||
S2LatLng s2LatLng = S2LatLng.fromDegrees(data.getLatitude(), data.getLongitude());
|
||||
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(21); //需要验证21前后
|
||||
}
|
||||
|
||||
public long getRecentlyTime() {
|
||||
return recentlyTime;
|
||||
@@ -41,7 +56,10 @@ public class TrackObj {
|
||||
this.typeWeight = typeWeight;
|
||||
}
|
||||
|
||||
public void updateObj() {
|
||||
|
||||
//先处理kalman数据,将经纬度校准后,放入缓存队列,然后基于后序策略将各个项进行校准
|
||||
public MessagePad.TrackedObject updateObj(MessagePad.TrackedObject data) {
|
||||
// assert kf != null;
|
||||
// double[] lonLat = kf.filter(data.getLongitude(), data.getLatitude());
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user