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

@@ -1,12 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.common" >
<manifest package="com.mogo.module.common">
<application>
<receiver android:name=".datacenter.receiver.SnapShotMockTestPanelBroadCastReceiver">
<intent-filter>
<action android:name="com.loc.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

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();
}

View File

@@ -297,10 +297,6 @@ public class MockIntentHandler implements IntentHandler {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.rtkEnable(false);
break;
case 39:// 使用自动驾驶车的定位数据
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.syncLocation2Map(null);
break;
case 40:
double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375},
{40.20258331298828, 116.74071502685547},
@@ -789,9 +785,9 @@ public class MockIntentHandler implements IntentHandler {
try {
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute(() ->
IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
);
// ThreadUtils.getSinglePool().execute(() ->
// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
// );
} else {
IdentifyDataDrawer.getInstance().clearOldMarker();
}
@@ -825,9 +821,9 @@ public class MockIntentHandler implements IntentHandler {
try {
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute(() ->
IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
);
// ThreadUtils.getSinglePool().execute(() ->
// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
// );
} else {
IdentifyDataDrawer.getInstance().clearOldMarker();
}

View File

@@ -4,9 +4,6 @@ import android.content.Context;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
@@ -18,7 +15,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.module.common.utils.DrivingDirectionUtils;
import org.jetbrains.annotations.NotNull;
@@ -27,6 +23,9 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
public class MogoRouteOverlayManager implements
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener,
IMoGoMapLocationListener {
@@ -102,13 +101,13 @@ public class MogoRouteOverlayManager implements
}
@Override
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
if (routeList.getModels() == null || routeList.getModels().size() == 0) {
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
return;
}
List<MogoLatLng> latLngList = new ArrayList<>();
for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) {
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
}
int listSize = latLngList.size();
mEnding = latLngList.get(listSize - 1);
@@ -120,7 +119,7 @@ public class MogoRouteOverlayManager implements
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData) {
return;
}
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getControl_pilotmode();
this.STATUS_AUTOPILOT = autoPilotStatusInfo.getPilotmode();
//Log.d("lianglihui","onAutopilotStatusResponse:"+STATUS_AUTOPILOT);
// if (STATUS_AUTOPILOT == 1 ){
// if (mEnding != null){
@@ -128,7 +127,7 @@ public class MogoRouteOverlayManager implements
// }
// }else {
//
// }
// }
if (STATUS_AUTOPILOT != 1) {
RouteOverlayDrawer.getInstance(mContext).clearEndingMarker();
RouteOverlayDrawer.getInstance(mContext).clearMogoRouteOverlay();
@@ -136,20 +135,16 @@ public class MogoRouteOverlayManager implements
}
@Override
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
if (autopilotWayArrive == null) {
if (arrivalNotification == null) {
return;
}
Logger.d(TAG, "onArriveAt data : " + autopilotWayArrive.toString());
Logger.d(TAG, "onArriveAt data : " + arrivalNotification.toString());
// //演示模式下 到达终点将忽略 引导线绘制 选项关闭
// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
}
@Override
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
}
@Override
public void onAutopilotSNRequest() {
@@ -157,7 +152,7 @@ public class MogoRouteOverlayManager implements
}
@Override
public void onLocationChanged(@Nullable MogoLocation location) { //todo 拖尾
public void onLocationChanged(@Nullable MogoLocation location) {
// mLocation = location;
// if (mTrajectoryList.isEmpty()) {
// return;
@@ -184,18 +179,18 @@ public class MogoRouteOverlayManager implements
mLocation = location;
List<MogoLatLng> temp = mTrajectoryList;
if (temp.isEmpty()){
if (temp.isEmpty()) {
return;
}
// Log.e(TAG, "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude());
ArrayList list = new ArrayList();
for (MogoLatLng latLng:temp) {
ArrayList list = new ArrayList();
for (MogoLatLng latLng : temp) {
// if(!isPointOnCarFront(mLocation,latLng)){
list.add(latLng);
list.add(latLng);
// }
}
Log.d(TAG,"TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size());
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1){
Log.d(TAG, "TrajectoryData = " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + "---status = " + STATUS_AUTOPILOT + "----size = " + list.size());
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || STATUS_AUTOPILOT == 1) {
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(list);
}
}
@@ -218,4 +213,9 @@ public class MogoRouteOverlayManager implements
}
}
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
}
}