[Change]
完成mogo-module-adas合并到MoGoEagleEye.core.function-impl.mogo-core-function-autopilot Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -63,7 +63,6 @@ callchatprovider : "com.mogo.module.carchatout:module-carchatting-pr
|
||||
|
||||
// V2X
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_COMMONS_VERSION}",
|
||||
moduleADAS : "com.mogo.module:mogo-module-adas:${MOGO_COMMONS_VERSION}",
|
||||
modulesearch : "com.mogo.module:module-search:${MOGO_COMMONS_VERSION}",
|
||||
// push
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_COMMONS_VERSION}",
|
||||
|
||||
@@ -162,7 +162,6 @@ ext {
|
||||
|
||||
// V2X
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
moduleADAS : "com.mogo.module:mogo-module-adas:${MOGO_MODULE_ADAS_VERSION}",
|
||||
modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}",
|
||||
// push
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}",
|
||||
|
||||
@@ -56,6 +56,7 @@ dependencies {
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
@@ -64,6 +65,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
@@ -37,6 +38,7 @@ class MoGoAutopilotProvider :
|
||||
get() = TAG
|
||||
|
||||
override fun init(context: Context) {
|
||||
MoGoHandAdasMsgManager.getInstance();
|
||||
Logger.d(TAG, "初始化工控机连接……")
|
||||
mContext = context
|
||||
// 初始化ADAS 域控制器
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
@@ -19,6 +21,10 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
@@ -37,6 +43,8 @@ import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,7 +86,62 @@ public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
Logger.e(TAG, "bean == null ");
|
||||
}
|
||||
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectConvertUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
|
||||
// 将数据通过数据中心分发出去
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
// 同步给MAP地图
|
||||
adasCarDataCallback(autopilotCarStateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void adasCarDataCallback(@Nullable AutopilotCarStateInfo stateInfo) {
|
||||
|
||||
//模拟数据时,不更新由工控机传输的自车位置
|
||||
if (TimeDelayUploadManager.getInstance().isMock()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
//Logger.d(TAG,"同步自车数据给地图……");
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLat(stateInfo.getValues().getLat());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLon(stateInfo.getValues().getLon());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSatelliteTime(stateInfo.getValues().getSatelliteTime());
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.putOpt("lon", stateInfo.getValues().getLon());
|
||||
data.putOpt("lat", stateInfo.getValues().getLat());
|
||||
data.putOpt("alt", stateInfo.getValues().getAlt());
|
||||
data.putOpt("speed", stateInfo.getValues().getGnss_speed());
|
||||
data.putOpt("heading", stateInfo.getValues().getHeading());
|
||||
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
|
||||
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
|
||||
data.putOpt("gpsProvider", 1);
|
||||
try {
|
||||
data.putOpt("systemTime", Long.parseLong(stateInfo.getValues().getSystemTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("satelliteTime", Long.parseLong(stateInfo.getValues().getSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("receiverDataTime", Long.parseLong(stateInfo.getValues().getReceiverDataTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("adasSatelliteTime", Long.parseLong(stateInfo.getValues().getAdasSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,27 +284,27 @@ public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*
|
||||
* @param info 工控机升级状态
|
||||
*/
|
||||
@Override
|
||||
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
if(info != null){
|
||||
Logger.d(TAG,"onUpgradeStateInfo "+
|
||||
" upgrade mode="+info.getUpgradeMode()+
|
||||
" download status="+info.getDownloadStatus()+
|
||||
" download progress current="+info.getProgress().getCurrent()+
|
||||
" download progress total="+info.getProgress().getTotal()+
|
||||
" download version="+info.getImages()+
|
||||
" upgrade status="+info.getUpgradeStatus());
|
||||
CallerHmiManager.INSTANCE.showAdUpgradeStatus(info.getUpgradeMode(),info.getDownloadStatus(),info.getProgress().getCurrent(),
|
||||
info.getProgress().getTotal(),info.getImages(),info.getUpgradeStatus());
|
||||
}else{
|
||||
Logger.d(TAG,"onUpgradeStateInfo : upgrade state info is null");
|
||||
if (info != null) {
|
||||
Logger.d(TAG, "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.getUpgradeMode() +
|
||||
" download status=" + info.getDownloadStatus() +
|
||||
" download progress current=" + info.getProgress().getCurrent() +
|
||||
" download progress total=" + info.getProgress().getTotal() +
|
||||
" download version=" + info.getImages() +
|
||||
" upgrade status=" + info.getUpgradeStatus());
|
||||
CallerHmiManager.INSTANCE.showAdUpgradeStatus(info.getUpgradeMode(), info.getDownloadStatus(), info.getProgress().getCurrent(),
|
||||
info.getProgress().getTotal(), info.getImages(), info.getUpgradeStatus());
|
||||
} else {
|
||||
Logger.d(TAG, "onUpgradeStateInfo : upgrade state info is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onSSHResult(SSHResult info) {
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasMsgConnectStatusListener, IMo
|
||||
/**
|
||||
* 同步SN信息给工控机
|
||||
*/
|
||||
fun syncBasicInfoToAutopilot() {
|
||||
private fun syncBasicInfoToAutopilot() {
|
||||
Logger.d(TAG, "同步PAD的SN给工控机……")
|
||||
val info = BasicInfo()
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().sn)
|
||||
@@ -85,7 +85,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasMsgConnectStatusListener, IMo
|
||||
/**
|
||||
* 上传自动驾驶状态任务
|
||||
*/
|
||||
fun updateDriveStatusTask() {
|
||||
private fun updateDriveStatusTask() {
|
||||
Logger.d(TAG, "updateDriveStatusTask")
|
||||
Flowable.interval(0, 5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.adas;
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -11,65 +11,39 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 14:43
|
||||
*/
|
||||
public class AdasEventManager implements
|
||||
public class MoGoHandAdasMsgManager implements
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
private static volatile AdasEventManager adasEventManager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private static volatile MoGoHandAdasMsgManager moGoHandAdasMsgManager;
|
||||
|
||||
private final ArrayList<IAdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
|
||||
private AdasEventManager() {
|
||||
private MoGoHandAdasMsgManager() {
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static AdasEventManager getInstance() {
|
||||
if (adasEventManager == null) {
|
||||
synchronized (obj) {
|
||||
if (adasEventManager == null) {
|
||||
adasEventManager = new AdasEventManager();
|
||||
public static MoGoHandAdasMsgManager getInstance() {
|
||||
if (moGoHandAdasMsgManager == null) {
|
||||
synchronized (MoGoHandAdasMsgManager.class) {
|
||||
if (moGoHandAdasMsgManager == null) {
|
||||
moGoHandAdasMsgManager = new MoGoHandAdasMsgManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return adasEventManager;
|
||||
return moGoHandAdasMsgManager;
|
||||
}
|
||||
|
||||
public void addEventListener(IAdasDataListener listener) {
|
||||
Logger.d(TAG, "添加adas事件监听");
|
||||
if (iAdasEventListeners.contains(listener)) {
|
||||
return;
|
||||
}
|
||||
iAdasEventListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeEventListener(IAdasDataListener listener) {
|
||||
Logger.d(TAG, "注销adas事件监听");
|
||||
iAdasEventListeners.remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.ownerCarStateInfo(GsonUtils.toJson(autoPilotCarStateInfo));
|
||||
}
|
||||
}
|
||||
|
||||
// 获取的自动驾驶车辆信息不是空的时候
|
||||
if (autoPilotCarStateInfo != null) {
|
||||
//can数据转发
|
||||
@@ -106,4 +80,4 @@ public class AdasEventManager implements
|
||||
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,6 @@ dependencies {
|
||||
api rootProject.ext.dependencies.mogoservice
|
||||
api rootProject.ext.dependencies.moduleshare
|
||||
api rootProject.ext.dependencies.moduleextensions
|
||||
api rootProject.ext.dependencies.moduleADAS
|
||||
api rootProject.ext.dependencies.callchat
|
||||
api rootProject.ext.dependencies.callchatprovider
|
||||
api rootProject.ext.dependencies.mapcustom
|
||||
@@ -98,7 +97,6 @@ dependencies {
|
||||
api project(':modules:mogo-module-common')
|
||||
api project(':modules:mogo-module-service')
|
||||
api project(':modules:mogo-module-extensions')
|
||||
api project(':modules:mogo-module-adas')
|
||||
api project(':modules:mogo-module-carchatting')
|
||||
api project(':modules:mogo-module-carchattingprovider')
|
||||
api project(':libraries:map-custom')
|
||||
|
||||
@@ -328,8 +328,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
|
||||
// 推送模块
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
|
||||
// ADAS模块(旧,慢慢被 域控制器模块 替换掉)
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_ADAS, "AdasProvider"));
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager
|
||||
|
||||
@@ -208,13 +208,6 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_SMALL_MAP = "/small_map/api";
|
||||
|
||||
/**
|
||||
* ADAS 模块
|
||||
*/
|
||||
@Keep
|
||||
@Deprecated
|
||||
public static final String PATH_ADAS = "/adas/api";
|
||||
|
||||
/**
|
||||
* 车辆检测 模块
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
:test:crashreport-noop
|
||||
:test:crashreport-upgrade
|
||||
:core:function-impl:mogo-core-function-obu-mogo
|
||||
:modules:mogo-module-adas
|
||||
:modules:mogo-module-service
|
||||
:core:function-impl:mogo-core-function-check
|
||||
:services:mogo-service
|
||||
|
||||
1
modules/mogo-module-adas/.gitignore
vendored
1
modules/mogo-module-adas/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,79 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
// 现有的ADAS的通讯SDK,需要将里面的东西融合到我们项目中
|
||||
compileOnly rootProject.ext.dependencies.adasapi
|
||||
|
||||
api rootProject.ext.dependencies.adasHigh
|
||||
implementation rootProject.ext.dependencies.mogoami
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
api rootProject.ext.dependencies.mogo_core_utils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
} else {
|
||||
api project(':core:mogo-core-utils')
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
}
|
||||
}
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=mogo-module-adas
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-adas/proguard-rules.pro
vendored
21
modules/mogo-module-adas/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.adas">
|
||||
|
||||
</manifest>
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* ADAS 模块
|
||||
*
|
||||
* @author
|
||||
* @date 4/21/21 3:39 PM
|
||||
* wiki:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52840459
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_ADAS)
|
||||
public class AdasProvider implements IProvider {
|
||||
private static final String TAG = "AdasProvider";
|
||||
private AdasEventManager adasEventManager;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化 AdasProvider 模块");
|
||||
adasEventManager = AdasEventManager.getInstance();
|
||||
}
|
||||
|
||||
public void addAdasEventListener(IAdasDataListener listener) {
|
||||
adasEventManager.addEventListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasEventListener(IAdasDataListener listener) {
|
||||
adasEventManager.removeEventListener(listener);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
public interface IAdasDataListener {
|
||||
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*
|
||||
* @param ownerCarStateInfo
|
||||
*/
|
||||
default void ownerCarStateInfo(String ownerCarStateInfo) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
</resources>
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.module.common.datacenter;
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
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;
|
||||
@@ -38,36 +38,13 @@ public class SnapshotLocationDataCenter {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private CloudLocationInfo mLastLocationInfo = null;
|
||||
|
||||
// GPS(1s1次) RTK(OS侧)缓存数据,
|
||||
private final List<CloudLocationInfo> mLocationList = new ArrayList<>();
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private final List<CloudLocationInfo> mMachineCacheList = new ArrayList<>();
|
||||
|
||||
private int mDataAccuracy = 0;
|
||||
private double mCurSpeed;
|
||||
private double mCurLon;
|
||||
private double mCurLat;
|
||||
private long mSatelliteTime = 0;
|
||||
|
||||
/**
|
||||
* 同步从定位来的数据(也可能是rtk)
|
||||
*
|
||||
* @param cli {@link CloudLocationInfo}
|
||||
*/
|
||||
public void syncLocationInfo(CloudLocationInfo cli) {
|
||||
if (cli == null) {
|
||||
return;
|
||||
}
|
||||
mLastLocationInfo = cli;
|
||||
mCurSpeed = cli.getSpeed();
|
||||
mCurLon = cli.getLon();
|
||||
mCurLat = cli.getLat();
|
||||
mLocationList.add(cli);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步从工控机来的数据
|
||||
*
|
||||
@@ -113,62 +90,14 @@ public class SnapshotLocationDataCenter {
|
||||
cloudLocationInfo.setSatelliteTime(satelliteTime);
|
||||
cloudLocationInfo.setSystemTime(systemTime);
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
|
||||
mLastLocationInfo = cloudLocationInfo;
|
||||
mMachineCacheList.add(cloudLocationInfo);
|
||||
|
||||
mCurSpeed = cloudLocationInfo.getSpeed();
|
||||
mCurLon = cloudLocationInfo.getLon();
|
||||
mCurLat = cloudLocationInfo.getLat();
|
||||
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某一段时间内的坐标集合
|
||||
*
|
||||
* @return 坐标合集
|
||||
*/
|
||||
public List<CloudLocationInfo> getSendLocationData() {
|
||||
|
||||
List<CloudLocationInfo> list = null;
|
||||
if (mMachineCacheList != null) {
|
||||
mDataAccuracy = 1;
|
||||
list = new ArrayList<>(mMachineCacheList);
|
||||
mMachineCacheList.clear();
|
||||
}
|
||||
if (list == null || list.isEmpty()) {
|
||||
mDataAccuracy = 0;
|
||||
if (mLocationList != null) {
|
||||
list = new ArrayList<>(mLocationList);
|
||||
mLocationList.clear();
|
||||
}
|
||||
}
|
||||
if (list == null || list.isEmpty()) {
|
||||
if (mLastLocationInfo != null) {
|
||||
list = new ArrayList();
|
||||
list.add(mLastLocationInfo);
|
||||
mLastLocationInfo = null;
|
||||
}
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据精度类型,目前按照数据来源标志
|
||||
*
|
||||
* @return 精度
|
||||
*/
|
||||
public int getDataAccuracy() {
|
||||
return mDataAccuracy;
|
||||
}
|
||||
|
||||
public double getCurSpeed() {
|
||||
return mCurSpeed;
|
||||
}
|
||||
|
||||
public double getCurLon() {
|
||||
return mCurLon;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
public void hideCoverUpLayout() {
|
||||
getWindow().setBackgroundDrawable(null);
|
||||
mCoverUpLayout.setVisibility(View.GONE);
|
||||
mServiceApis.getAdasControllerApi().showADAS();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,6 @@ import android.view.MotionEvent;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -31,7 +30,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
@@ -46,7 +44,6 @@ import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -59,8 +56,6 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -81,7 +76,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener,
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoAdasCarDataCallback,
|
||||
IDestroyable {
|
||||
|
||||
private boolean mInternalUnWakeupRegisterStatus = false;
|
||||
@@ -332,7 +326,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
mIntentManager.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this );
|
||||
|
||||
mADASController = MarkerServiceHandler.getADASController();
|
||||
mADASController.setAdasCarDataCallback( this );
|
||||
mFragmentManager = MarkerServiceHandler.getFragmentManager();
|
||||
|
||||
mFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
@@ -861,50 +854,4 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdasCarDataCallback( AutopilotCarStateInfo stateInfo ) {
|
||||
|
||||
//模拟数据时,不更新由工控机传输的自车位置
|
||||
if(TimeDelayUploadManager.getInstance().isMock()){
|
||||
return;
|
||||
}
|
||||
|
||||
if ( stateInfo != null && stateInfo.getValues() != null ) {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.putOpt( "lon", stateInfo.getValues().getLon() );
|
||||
data.putOpt( "lat", stateInfo.getValues().getLat() );
|
||||
data.putOpt( "alt", stateInfo.getValues().getAlt() );
|
||||
data.putOpt( "speed", stateInfo.getValues().getGnss_speed() );
|
||||
data.putOpt( "heading", stateInfo.getValues().getHeading() );
|
||||
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
|
||||
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
|
||||
data.putOpt( "gpsProvider", 1 );
|
||||
try {
|
||||
data.putOpt( "systemTime", Long.parseLong( stateInfo.getValues().getSystemTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "satelliteTime", Long.parseLong( stateInfo.getValues().getSatelliteTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "receiverDataTime", Long.parseLong( stateInfo.getValues().getReceiverDataTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt( "adasSatelliteTime", Long.parseLong( stateInfo.getValues().getAdasSatelliteTime() ) );
|
||||
} catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,20 +10,8 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoADASController extends IProvider {
|
||||
|
||||
/**
|
||||
* 显示
|
||||
*/
|
||||
void showADAS();
|
||||
|
||||
void release();
|
||||
|
||||
/**
|
||||
* 自车定位数据
|
||||
*
|
||||
* @param carDataCallback
|
||||
*/
|
||||
void setAdasCarDataCallback(IMogoAdasCarDataCallback carDataCallback);
|
||||
|
||||
/**
|
||||
* 获取车身的定位纬度
|
||||
*
|
||||
@@ -31,6 +19,11 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
double getLastLat();
|
||||
|
||||
/**
|
||||
* 设置自车的定位纬度
|
||||
*/
|
||||
void setLastLat(double lastLat);
|
||||
|
||||
/**
|
||||
* 获取车身定位经度
|
||||
*
|
||||
@@ -38,6 +31,11 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
double getLastLon();
|
||||
|
||||
/**
|
||||
* 设置自车的定位经度
|
||||
*/
|
||||
void setLastLon(double lastLon);
|
||||
|
||||
/**
|
||||
* 获取由工控机传回的GPS星历时间
|
||||
*
|
||||
@@ -45,4 +43,9 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
String getSatelliteTime();
|
||||
|
||||
/**
|
||||
* 设置自车的GPS星历时间
|
||||
*/
|
||||
void setSatelliteTime(String satelliteTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
|
||||
/**
|
||||
* adas 自车位置数据回调
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasCarDataCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
*
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onAdasCarDataCallback( AutopilotCarStateInfo msg );
|
||||
}
|
||||
@@ -57,7 +57,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.moduleADAS
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_check
|
||||
@@ -67,7 +66,6 @@ dependencies {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":services:mogo-service-api")
|
||||
implementation project(':modules:mogo-module-adas')
|
||||
|
||||
implementation project(':core:function-impl:mogo-core-function-check')
|
||||
implementation project(':core:mogo-core-data')
|
||||
|
||||
@@ -3,95 +3,59 @@ package com.mogo.service.impl.adas;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
import com.mogo.module.adas.IAdasDataListener;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_ADAS_CONTROLLER)
|
||||
public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private static final String TAG = "MogoADASController";
|
||||
|
||||
private AdasProvider adasProvider;
|
||||
private IAdasDataListener mAdasDataListener;
|
||||
|
||||
private IMogoAdasCarDataCallback mMogoAdasCarDataCallback;
|
||||
|
||||
private double mLastLon;
|
||||
private double mLastLat;
|
||||
private String satelliteTime;
|
||||
private String mSatelliteTime;
|
||||
|
||||
@Override
|
||||
public double getLastLat() {
|
||||
return mLastLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastLat(double lastLat) {
|
||||
mLastLat = lastLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLastLon() {
|
||||
return mLastLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastLon(double lastLon) {
|
||||
mLastLon = lastLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
return mSatelliteTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSatelliteTime(String satelliteTime) {
|
||||
mSatelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
adasProvider = ARouter.getInstance().navigation(AdasProvider.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showADAS() {
|
||||
Logger.d(TAG, "showADAS()");
|
||||
init(AbsMogoApplication.getApp());
|
||||
if (mAdasDataListener == null) {
|
||||
mAdasDataListener = new IAdasDataListener() {
|
||||
|
||||
@Override
|
||||
public void ownerCarStateInfo(String ownerCarStateInfo) {
|
||||
// 接收 adas 定位数据线程
|
||||
AutopilotCarStateInfo stateInfo = GsonUtil.objectFromJson(ownerCarStateInfo, AutopilotCarStateInfo.class);
|
||||
if (stateInfo == null || stateInfo.getValues() == null) {
|
||||
return;
|
||||
}
|
||||
mLastLon = stateInfo.getValues().getLon();
|
||||
mLastLat = stateInfo.getValues().getLat();
|
||||
satelliteTime = stateInfo.getValues().getSatelliteTime();
|
||||
if (mMogoAdasCarDataCallback != null) {
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback(stateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
adasProvider.addAdasEventListener(mAdasDataListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
adasProvider.removeAdasEventListener(mAdasDataListener);
|
||||
AutopilotServiceManage.getInstance().release();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasCarDataCallback(IMogoAdasCarDataCallback carDataCallback) {
|
||||
mMogoAdasCarDataCallback = carDataCallback;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ include ':libraries:mogo-map-api'
|
||||
include ':libraries:mogo-map'
|
||||
|
||||
// OLD业务模块
|
||||
include ':modules:mogo-module-adas'
|
||||
include ':modules:mogo-module-common'
|
||||
include ':modules:mogo-module-main'
|
||||
include ':modules:mogo-module-service'
|
||||
|
||||
Reference in New Issue
Block a user