This commit is contained in:
zhongchao
2022-03-11 20:04:11 +08:00
parent c804f5162d
commit 5886f4feb7
81 changed files with 1689 additions and 1095 deletions

View File

@@ -2,7 +2,6 @@ package com.mogo.module.common.datacenter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.cloud.location.CloudLocationInfo;
@@ -12,6 +11,8 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
/**
* 定位坐标同步数据中心
* 接收来自工控机实际定位数据
@@ -61,13 +62,27 @@ public class SnapshotLocationDataCenter {
double lat = data.optDouble("lat", -1);
double alt = data.optDouble("alt", -1);
double heading = data.optDouble("heading", -1);
double acceleration = data.optDouble("acceleration", -1);
double yawRate = data.optDouble("yawRate", -1);
double speed = data.optDouble("speed", -1);
long satelliteTime = data.optLong("satelliteTime");
long systemTime = data.optLong("systemTime");
int gpsProvider = data.optInt("gpsProvider", 1);
realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime);
}
public void syncAdasLocationInfo(MessagePad.GnssInfo gnssInfo) {
//测试面板状态同步
DebugConfig.setStatus(DebugConfig.sLocation, true);
double lon = gnssInfo.getLongitude();
double lat = gnssInfo.getLatitude();
double alt = gnssInfo.getAltitude();
double heading = gnssInfo.getHeading();
double speed = gnssInfo.getGnssSpeed();
long satelliteTime = Double.valueOf(gnssInfo.getSatelliteTime()).longValue();
long systemTime = Double.valueOf(gnssInfo.getSystemTime()).longValue();
realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime);
}
private void realSync(double lon, double lat, double alt, double heading, double speed, long satelliteTime, long systemTime) {
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setLocationLat(lat);
@@ -80,22 +95,21 @@ public class SnapshotLocationDataCenter {
DebugConfig.setStatusData(DebugConfig.sLat, lat);
// 使用与渠道配置一样的gps提供者提供的数据
if (gpsProvider == FunctionBuildConfig.gpsProvider) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt(alt);
cloudLocationInfo.setHeading(heading);
cloudLocationInfo.setLat(lat);
cloudLocationInfo.setLon(lon);
cloudLocationInfo.setSpeed(speed);
cloudLocationInfo.setSatelliteTime(satelliteTime);
cloudLocationInfo.setSystemTime(systemTime);
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
mMachineCacheList.add(cloudLocationInfo);
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt(alt);
cloudLocationInfo.setHeading(heading);
cloudLocationInfo.setLat(lat);
cloudLocationInfo.setLon(lon);
cloudLocationInfo.setSpeed(speed);
cloudLocationInfo.setSatelliteTime(satelliteTime);
cloudLocationInfo.setSystemTime(systemTime);
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
//todo list数据暂时无人使用增加后会导致数据量缓慢增加
// mMachineCacheList.add(cloudLocationInfo);
mCurLon = cloudLocationInfo.getLon();
mCurLat = cloudLocationInfo.getLat();
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
}
mCurLon = cloudLocationInfo.getLon();
mCurLat = cloudLocationInfo.getLat();
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
}
public double getCurLon() {

View File

@@ -168,11 +168,11 @@ public class BaseDrawer {
* @return SNTP时间
*/
protected long getCurSatelliteTime() {
String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
if (TextUtils.isEmpty(satelliteTime)) {
Long satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
if (satelliteTime == 0) {
return System.currentTimeMillis();
}
return Long.parseLong(satelliteTime);
return satelliteTime;
}
/**

View File

@@ -13,6 +13,8 @@ import com.mogo.module.common.MogoApisHandler;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import mogo.telematics.pad.MessagePad;
/**
* @author xiaoyuzhou
* @date 2021/10/19 10:45 上午
@@ -40,7 +42,7 @@ public class IdentifyDataDrawer {
/**
* 过滤后的数据集合
*/
private final ArrayList<TrafficData> mFilterTrafficData = new ArrayList<>();
private final ArrayList<MessagePad.TrackedObject> mFilterTrafficData = new ArrayList<>();
private IdentifyDataDrawer() {
mContext = AbsMogoApplication.getApp();
@@ -67,7 +69,7 @@ public class IdentifyDataDrawer {
*
* @param resultList adas感知融合数据
*/
public void renderAdasRecognizedResult(ArrayList<TrafficData> resultList) {
public void renderAdasRecognizedResult(ArrayList<MessagePad.TrackedObject> resultList) {
if (resultList == null || resultList.isEmpty()) {
clearOldMarker();
Logger.w(TAG, "感知数据为空无需渲染……");
@@ -82,14 +84,14 @@ public class IdentifyDataDrawer {
// 循环将集合中的数据提取记录
for (TrafficData trafficData : resultList) {
for (MessagePad.TrackedObject trafficData : resultList) {
// 过滤掉未知感知数据
if (!FunctionBuildConfig.isDrawUnknownIdentifyData &&
trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) {
trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//Logger.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}
trafficDataUuidList.add(trafficData.getUuid());
trafficDataUuidList.add("" + trafficData.getUuid());
}
// // 找出上一针数据中已经不在本次数据中存在的数据
// for (String uuid : mMarkersCaches.keySet()) {
@@ -118,11 +120,11 @@ public class IdentifyDataDrawer {
*
* @return 过滤后的数据集合
*/
private ArrayList<TrafficData> filterTrafficData(ArrayList<TrafficData> trafficData) {
private ArrayList<MessagePad.TrackedObject> filterTrafficData(ArrayList<MessagePad.TrackedObject> trafficData) {
mFilterTrafficData.clear();
for (TrafficData data : trafficData) {
for (MessagePad.TrackedObject data : trafficData) {
// 过滤掉未知感知数据
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) {
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//Logger.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}

View File

@@ -23,7 +23,6 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -90,7 +89,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
removeUselessMarker(mMarkersCaches);
mLastPositions.clear();
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
}
public boolean isChangeCarModeStatus() {
@@ -215,10 +213,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
if (mMarkersCaches.isEmpty()) {
return;
}
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) {
return;
}
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
while (iterator.hasNext()) {
IMogoMarker result = iterator.next();
@@ -226,9 +220,9 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
if (proto == null) { // 后续有业务数据在操作,更新数据,不做处理
continue;
}
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - proto.getSatelliteTime();
long internal = getCurSatelliteTime() - proto.getSatelliteTime();
Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid()
+ " localTime : " + adasControllerApi.getSatelliteTime()
+ " localTime : " + getCurSatelliteTime()
+ " originTime : " + proto.getSatelliteTime()
+ " internal : " + internal);
if (internal > 5000) {
@@ -242,14 +236,10 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
if (mLastPositions.isEmpty()) {
return;
}
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime()) || adasControllerApi.getSatelliteTime().equals("0")) {
return;
}
Iterator<SocketDownData.CloudRoadDataProto> iterator = mLastPositions.values().iterator();
while (iterator.hasNext()) {
SocketDownData.CloudRoadDataProto result = iterator.next();
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - result.getSatelliteTime();
long internal = getCurSatelliteTime() - result.getSatelliteTime();
if (internal > 3000) {
iterator.remove();
}