完成mogo-module-adas合并到MoGoEagleEye.core.function-impl.mogo-core-function-autopilot

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-02-08 20:26:15 +08:00
parent 117897d576
commit 4dc06e5817
31 changed files with 126 additions and 453 deletions

View File

@@ -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')

View File

@@ -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 域控制器

View File

@@ -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) {

View File

@@ -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())

View File

@@ -0,0 +1,83 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.traffic.TrafficData;
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.util.ThreadUtils;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
public class MoGoHandAdasMsgManager implements
IMoGoAutopilotIdentifyListener,
IMoGoAutopilotCarStateListener {
private final String TAG = "AdasEventManager";
private static volatile MoGoHandAdasMsgManager moGoHandAdasMsgManager;
private MoGoHandAdasMsgManager() {
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
}
public static MoGoHandAdasMsgManager getInstance() {
if (moGoHandAdasMsgManager == null) {
synchronized (MoGoHandAdasMsgManager.class) {
if (moGoHandAdasMsgManager == null) {
moGoHandAdasMsgManager = new MoGoHandAdasMsgManager();
}
}
}
return moGoHandAdasMsgManager;
}
@Override
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
// 获取的自动驾驶车辆信息不是空的时候
if (autoPilotCarStateInfo != null) {
//can数据转发
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
if (bean != null) {
//转向灯状态 0是正常 1是左转 2是右转
int turnLight = bean.getTurn_light();
AmiClientManager.getInstance().setTurnLightState(turnLight);
}
}
}
@Override
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
try {
if (FunctionBuildConfig.isDrawIdentifyData) {
ThreadUtils.getSinglePool().execute(() ->
IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
}
@Override
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
}
}

View File

@@ -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')

View File

@@ -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