Merge branch 'dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_MogoAP_eagle-220_211207_8.0.17_merge

# Conflicts:
#	app/build.gradle
#	core/function-impl/mogo-core-function-autopilot/build.gradle
#	core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.java
#	modules/mogo-module-adas/build.gradle
This commit is contained in:
donghongyu
2022-02-09 10:59:31 +08:00
57 changed files with 604 additions and 1613 deletions

View File

@@ -1 +0,0 @@
/build

View File

@@ -1,82 +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
implementation rootProject.ext.dependencies.mogochainbase
// 现有的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')
implementation project(':libraries:mogo-adas')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=mogo-module-adas
VERSION_CODE=1

View File

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

View File

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

View File

@@ -1,102 +0,0 @@
{lat=26.820175208327566,lon=112.57748204198309},
{lat=26.82009891465042,lon=112.57735739748664},
{lat=26.820022750763542,lon=112.57723266155585},
{lat=26.81994655656347,lon=112.57710795477944},
{lat=26.81987031666393,lon=112.57698328267305},
{lat=26.819793988171348,lon=112.57685866945901},
{lat=26.819717530408877,lon=112.57673414980971},
{lat=26.819635079638967,lon=112.57661462149986},
{lat=26.819532022659132,lon=112.5765234581422},
{lat=26.819488197195188,lon=112.5764835085963},
{lat=26.81947053563866,lon=112.57645743645142},
{lat=26.81945285740347,lon=112.5764313389555},
{lat=26.81941584428336,lon=112.57637074918446},
{lat=26.819355855639404,lon=112.57626774620917},
{lat=26.8193352833325,lon=112.57623094969783},
{lat=26.819315738575742,lon=112.57619587959701},
{lat=26.81929619389902,lon=112.5761608096667},
{lat=26.819276064037396,lon=112.5761245744324},
{lat=26.819221654527443,lon=112.5760208132482},
{lat=26.819153675938914,lon=112.5758903945585},
{lat=26.8190859083974,lon=112.57576035026403},
{lat=26.81904791926707,lon=112.57568644394968},
{lat=26.819047477540156,lon=112.57568591545105},
{lat=26.819047035811135,lon=112.57568538694994},
{lat=26.819046594080046,lon=112.57568485844635},
{lat=26.81902999052958,lon=112.57568137976324},
{lat=26.818966668056316,lon=112.57572279587626},
{lat=26.81896660310204,lon=112.57572518130716},
{lat=26.81896683258833,lon=112.57572606581252},
{lat=26.81896706207354,lon=112.57572695031374},
{lat=26.818971211272444,lon=112.57573544393973},
{lat=26.819027657144368,lon=112.57584589447032},
{lat=26.819095546341085,lon=112.57597644303986},
{lat=26.8191650468231,lon=112.57610591408428},
{lat=26.819236806047,lon=112.5762338575302},
{lat=26.819310184480436,lon=112.57636063880027},
{lat=26.819384451187933,lon=112.5764867800095},
{lat=26.819460642360763,lon=112.57661149583805},
{lat=26.819536878267925,lon=112.57673619431976},
{lat=26.819613220428206,lon=112.57686079387894},
{lat=26.819689146973122,lon=112.57698570087358},
{lat=26.819765257290772,lon=112.57711047564952},
{lat=26.81984156841068,lon=112.57723510283108},
{lat=26.819916608456698,lon=112.57735767331373},
{lat=26.819990868286688,lon=112.57747918205983},
{lat=26.82006704845146,lon=112.57760363217366},
{lat=26.820142688927376,lon=112.57772676391022},
{lat=26.820220480866162,lon=112.57784947830805},
{lat=26.82029609426984,lon=112.57797111160743},
{lat=26.820372540342063,lon=112.57809575812311},
{lat=26.820449035279513,lon=112.57822036992494},
{lat=26.82052479395364,lon=112.5783432083879},
{lat=26.820600741070034,lon=112.57846626552721},
{lat=26.820676451505513,lon=112.57858892597905},
{lat=26.820750627333855,lon=112.57870908764811},
{lat=26.820788099971104,lon=112.57876896886103},
{lat=26.82079340880141,lon=112.57877600898784},
{lat=26.82079871765643,lon=112.57878304914836},
{lat=26.820804096213536,lon=112.57879017489086},
{lat=26.820866626548845,lon=112.5788587003478},
{lat=26.820983640738305,lon=112.57893123552938},
{lat=26.82111632395692,lon=112.57893777257203},
{lat=26.82117204164965,lon=112.57891747212024},
{lat=26.821184743761496,lon=112.57890962148315},
{lat=26.821197445813166,lon=112.57890177088103},
{lat=26.821210607045213,lon=112.57889357476125},
{lat=26.821290516628242,lon=112.57883467623317},
{lat=26.82140278979742,lon=112.57875048180252},
{lat=26.821515292745254,lon=112.57866667791178},
{lat=26.821628395747688,lon=112.5785838835907},
{lat=26.82174189376551,lon=112.57850175198458},
{lat=26.82185566968843,lon=112.57842010282002},
{lat=26.82196987298559,lon=112.57833919555353},
{lat=26.822083935682734,lon=112.5782580474171},
{lat=26.822198178890964,lon=112.57817722472228},
{lat=26.82231299206679,lon=112.5780973993899},
{lat=26.822427661696032,lon=112.57801732090307},
{lat=26.82254293064344,lon=112.57793832470455},
{lat=26.822658717481524,lon=112.57786026718888},
{lat=26.822774624402133,lon=112.57778243034805},
{lat=26.82289066838358,lon=112.57770484656757},
{lat=26.823007036027615,lon=112.57762787191734},
{lat=26.823123797760537,lon=112.57755163699323},
{lat=26.82324089700492,lon=112.57747604255579},
{lat=26.823355874237176,lon=112.57740187937155},
{lat=26.823470001455,lon=112.57732986163221},
{lat=26.82358841433288,lon=112.57725688653507},
{lat=26.823706827172103,lon=112.5771839112856},
{lat=26.82382523997266,lon=112.57711093588388},
{lat=26.823943652734542,lon=112.57703796032986},
{lat=26.824062065457753,lon=112.57696498462354},
{lat=26.824180478142292,lon=112.57689200876496},
{lat=26.82429889078817,lon=112.57681903275407},
{lat=26.824416715403633,lon=112.5767464980989},
{lat=26.824533859020413,lon=112.57667699873441},
{lat=26.824651399274774,lon=112.57660868246823},
{lat=26.824762900762973,lon=112.57658692553045},
{lat=26.824968687097577,lon=112.57656763804074},
{lat=26.825104150528567,lon=112.57650684107888},
{lat=26.82522465989416,lon=112.57643823074989},
{lat=26.825345659446693,lon=112.57637072881484},
{lat=26.8255763298452,lon=112.57624421893341},

View File

@@ -1,235 +0,0 @@
package com.mogo.module.adas;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
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.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.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.adas.model.AdasServiceModel;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
import com.zhidao.support.adas.high.bean.BasicInfo;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* Created by XuYong on 2021/4/25 14:43
*/
public class AdasEventManager implements
OnAdasMsgConnectStatusListener,
IMoGoAutopilotStatusListener,
IMoGoAutopilotPlanningListener,
IMoGoAutopilotIdentifyListener,
IMoGoAutopilotCarStateListener {
private final String TAG = "AdasEventManager";
private static volatile AdasEventManager adasEventManager;
private static final byte[] obj = new byte[0];
private final Gson gson;
private final ArrayList<IAdasDataListener> iAdasEventListeners = new ArrayList<>();
//自动驾驶状态
private int mCurrentAutopilotStatus = -1;
//自动驾驶车速度
private float mCurrentAutopilotSpeed = 0;
private AdasEventManager() {
gson = GsonUtil.getGson();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
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();
}
}
}
return adasEventManager;
}
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);
}
/**
* 同步SN信息给工控机
*/
public void syncBasicInfoToAutopilot() {
Logger.d(TAG, "同步PAD的SN给工控机……");
BasicInfo info = new BasicInfo();
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
AdasManager.getInstance().setBasicInfo(info);
}
@Override
public void onAutopilotSNRequest() {
syncBasicInfoToAutopilot();
}
@Override
public void onWebSocketConnectSuccess() {
Logger.d(TAG, "webSocket 连接成功");
// 初始化自动驾驶状态信息
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(true);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
// 同步SN给工控机
syncBasicInfoToAutopilot();
// 开启轮训上传自动驾驶状态
updateDriveStatusTask();
}
@Override
public void onWebSocketConnectFailed(String reason) {
Logger.d(TAG, "webSocket 连接失败 reason:" + reason);
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(false);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
}
public void updateDriveStatusTask() {
Logger.d(TAG, "updateDriveStatusTask");
Flowable.interval(0, 5, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> updateDriveStatus());
}
private void updateDriveStatus() {
AdasServiceModel.getInstance().updateDriveStatus(mCurrentAutopilotStatus, mCurrentAutopilotSpeed);
}
private void reportSite(double lon, double lat) {
AdasServiceModel.getInstance().reportSite(lon, lat);
}
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
int state = autoPilotStatusInfo.getState();
float speed = autoPilotStatusInfo.getSpeed();
mCurrentAutopilotStatus = state;
mCurrentAutopilotSpeed = speed;
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.notifyAutopilotState(autoPilotStatusInfo);
}
}
}
@Override
public void onAutopilotArriveAtStation(AutopilotStationInfo autopilotWayArrive) {
if (autopilotWayArrive != null) {
double lon = autopilotWayArrive.getLon();
double lat = autopilotWayArrive.getLat();
reportSite(lon, lat);
}
}
@Override
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.ownerCarStateInfo(gson.toJson(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 onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
}
@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 onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfo) {
}
@Override
public void onAutopilotRotting(@Nullable AutopilotRouteInfo autopilotRoute) {
}
@Override
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
}
}

View File

@@ -1,103 +0,0 @@
package com.mogo.module.adas
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.network.utils.GsonUtil
import com.zhidao.support.adas.high.bean.AutopilotRoute
import com.zhidao.support.adas.high.bean.CarStateInfo
import com.zhidao.support.adas.high.bean.RectInfo.RectBean
import com.zhidao.support.adas.high.bean.WarnMessageInfo
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
/**
* @author congtaowang
* @since 2020/10/25
*
* 对象转换类
*/
object AdasObjectUtils {
val TAG = "AdasObjectUtils"
fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? {
return GsonUtil.objectFromJson(
GsonUtil.jsonFromObject(autopilotGuardianInfo),
AutopilotGuardianStatusInfo::class.java
)
}
fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? {
return GsonUtil.objectFromJson(
GsonUtil.jsonFromObject(carStateInfo),
AutopilotRouteInfo::class.java
)
}
fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? {
return GsonUtil.objectFromJson(
GsonUtil.jsonFromObject(carStateInfo),
AutopilotCarStateInfo::class.java
)
}
fun fromAdasObject(info: WarnMessageInfo?): AutopilotWarnMessage? {
if (info == null) {
return null
}
val warnMessage = AutopilotWarnMessage()
warnMessage.content = info.content
warnMessage.level = info.level
try {
warnMessage.type = info.type.toInt()
} catch (e: NumberFormatException) {
return null
}
warnMessage.value = info.value
return warnMessage
}
fun regroupTrafficDataData(datums: List<RectBean?>?): ArrayList<TrafficData>? {
if (datums == null || datums.isEmpty()) {
return null
}
val recognizedListResults: ArrayList<TrafficData> = ArrayList()
for (model in datums) {
if (model == null) {
continue
}
val recognizedListResult = fromAdasTrafficDataObject(model)
if (recognizedListResult != null) {
recognizedListResults.add(recognizedListResult)
}
}
return recognizedListResults
}
fun fromAdasTrafficDataObject(model: RectBean?): TrafficData? {
if (model == null) {
return null
}
val result = TrafficData()
result.uuid = model.uuid
result.lat = model.lat
result.lon = model.lon
result.type = TrafficTypeEnum.getType(model.type.toInt())
result.heading = model.heading
result.systemTime = model.systemTime.toLong()
result.satelliteTime = model.satelliteTime.toLong()
result.alt = model.alt
result.speed = model.speed
result.carId = model.carId
result.dataAccuracy = model.dataAccuracy
result.distance = model.distance
result.threatLevel = model.drawlevel
//Log.d(TAG, "TrafficData = $result")
return result
}
}

View File

@@ -1,67 +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.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
/**
* ADAS 模块
*
* @author
* @date 4/21/21 3:39 PM
* wikihttp://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();
initAdas(context, adasEventManager);
}
private void initAdas(Context context, AdasEventManager adasEventManager) {
CupidLogUtils.setEnableLog(false);
CupidLogUtils.setIsWriteLog(false);
// TODO 临时方案根据不同的身份标识连接不同的工控机IP
switch (FunctionBuildConfig.appIdentityMode) {
case 0:
// 司机
AdasManager.getInstance().create(context, "192.168.1.102");
break;
case 1:
// 乘客
AdasManager.getInstance().create(context, "192.168.1.103");
break;
default:
// 默认采用UDP寻址方式
AdasManager.getInstance().create(context);
break;
}
AdasManager.getInstance().setOnAdasListener(new OnAdasListenerAdapter());
AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager);
}
public void addAdasEventListener(IAdasDataListener listener) {
adasEventManager.addEventListener(listener);
}
public void removeAdasEventListener(IAdasDataListener listener) {
adasEventManager.removeEventListener(listener);
}
public void sendWsMessage(String msg) {
AdasManager.getInstance().aiCloudToAdasData(msg);
}
}

View File

@@ -1,24 +0,0 @@
package com.mogo.module.adas;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
public interface IAdasDataListener {
/**
* 自车定位信息
*
* @param ownerCarStateInfo
*/
default void ownerCarStateInfo(String ownerCarStateInfo) {
}
/**
* 自动驾驶状态信息
*
* @param autopilotStatus {@link AutopilotStatusInfo}
*/
default void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
}
}

View File

@@ -1,308 +0,0 @@
package com.mogo.module.adas;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA;
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_ADAS;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
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.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
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.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
import com.zhidao.support.adas.high.bean.CarLaneInfo;
import com.zhidao.support.adas.high.bean.CarStateInfo;
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.SSHResult;
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
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 com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
* @since 2020/10/22
* <p>
* 适配ADAS 回调监听分发
*/
public class OnAdasListenerAdapter implements OnAdasListener {
private final String TAG = "OnAdasListenerAdapter";
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onRectData(RectInfo rectInfo) {
if (HdMapBuildConfig.isMapLoaded) {
ArrayList<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onCarStateData(CarStateInfo carStateInfo) {
if (HdMapBuildConfig.isMapLoaded) {
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
// Log.w("DHY-location", bean.getLon() + "," + bean.getLat() + " OnAdasListenerAdapter-onCarStateData");
if (bean != null) {
int turnLight = bean.getTurnLightOften(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turnLight);
int brakeLight = bean.getBrake_light(); //TODO
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
//设置转向灯
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
//设置刹车信息
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
} else {
Logger.e(TAG, "bean == null ");
}
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void autopilotStatus(AutopilotStatus autopilotStatus) {
if (HdMapBuildConfig.isMapLoaded) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
}
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
}
}
}
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onAutopilotRoute(AutopilotRoute route) {
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
}
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
}
@Override
public void onAutopilotSNRequest() {
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest();
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
if (HdMapBuildConfig.isMapLoaded) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
}
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onAutopilotRecord(AutopilotRecordResult result) {
if (result != null) {
AutoPilotRecordResult real = new AutoPilotRecordResult();
real.setDiskFree(result.getDiskFree());
real.setId(result.getId());
real.setDuration(result.getDuration());
real.setNote(result.getNote());
real.setTotal(result.getTotalSize());
real.setType(result.getType());
real.setFileName(result.getFilename());
real.setKey(result.getKey());
real.setStat(result.getStat());
real.setTimestamp(result.getTimestamp());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotRecordResult(real);
}
}
@Override
public void onLightStateData(LightStatueInfo lightStatueInfo) {
}
@Override
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
}
@Override
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
}
@ChainLog(linkCode = CHAIN_LINK_ADAS,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
paramIndexes = {0},
clientPkFileName = "sn")
@Override
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
final AutopilotWarnMessage warnMessage = AdasObjectUtils.INSTANCE.fromAdasObject(warnMessageInfo);
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
}
@Override
public void onVideoSize(int width, int height) {
}
/**
* 工控机升级状态
*
* @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");
}
}
@Override
public void onSSHResult(SSHResult info) {
}
}

View File

@@ -1,41 +0,0 @@
package com.mogo.module.adas.entity;
/**
* Created by XuYong on 2021/5/28 16:12
*/
public class AutonomousDriveStatusBean {
private String sn;
private int status;
private float vehicleSpeed;
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
this.sn = sn;
this.status = status;
this.vehicleSpeed = vehicleSpeed;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public float getVehicleSpeed() {
return vehicleSpeed;
}
public void setVehicleSpeed(float vehicleSpeed) {
this.vehicleSpeed = vehicleSpeed;
}
}

View File

@@ -1,40 +0,0 @@
package com.mogo.module.adas.entity;
/**
* Created by XuYong on 2021/5/31 16:24
*/
public class ReportSiteBean {
private String sn;
private double lon;
private double lat;
public ReportSiteBean(String sn, double lon, double lat) {
this.sn = sn;
this.lon = lon;
this.lat = lat;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
}

View File

@@ -1,95 +0,0 @@
package com.mogo.module.adas.model;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
import com.mogo.module.adas.entity.ReportSiteBean;
import com.mogo.module.adas.network.IAdasApiService;
import com.mogo.module.common.MogoApisHandler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.mogo.commons.context.ContextHolderUtil.getContext;
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
public class AdasServiceModel {
private static final String TAG = "AdasServiceModel";
private static volatile AdasServiceModel instance;
private static final byte[] obj = new byte[0];
private final IAdasApiService mAdasApiService;
private AdasServiceModel() {
this.mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IAdasApiService.class, DATA_SERVICE_HOST);
}
public static AdasServiceModel getInstance() {
if (instance == null) {
synchronized (obj) {
if (instance == null) {
instance = new AdasServiceModel();
}
}
}
return instance;
}
public void updateDriveStatus(int autoPilotStatus, float autoPilotSpeed) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, autoPilotStatus, autoPilotSpeed);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
mAdasApiService.updateAutonomousDriveStatus(requestBody).
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
Logger.d(TAG, "updateDriveStatus success");
}
});
}
public void reportSite(double lon, double lat) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
mAdasApiService.updateReportSite(requestBody).
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
Logger.d(TAG, "autopilotArrive success");
}
});
}
}

View File

@@ -1,31 +0,0 @@
package com.mogo.module.adas.network;
import com.mogo.eagle.core.data.BaseData;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
public interface IAdasApiService {
/**
* 上传自动驾驶状态接口
* @param requestBody
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
@POST("/dataService/autonomousDrive/updateAutonomousDriveStatus")
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody);
/**
* 站点上报 用于网约车业务 云平台绘制路线使用
* @param requestBody
* @return
*/
@Headers({"Content-Type:application/json;charset=UTF-8"})
@POST("/dataService/autonomousDrive/reportSite")
Observable<BaseData> updateReportSite(@Body RequestBody requestBody);
}

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

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

View File

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

View File

@@ -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,12 +76,10 @@ public class MogoServices implements IMogoMapListener,
IMogoVoiceCmdCallBack,
FragmentStackTransactionListener,
IMogoCarLocationChangedListener2,
IMogoAdasCarDataCallback,
IDestroyable {
private boolean mInternalUnWakeupRegisterStatus = false;
private Location mLastCarLocation;
private MogoServices() {
// private constructor
@@ -201,7 +194,6 @@ public class MogoServices implements IMogoMapListener,
}
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
// mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
mStatusManager.setUserInteractionStatus( TAG, true, false );
mUiController.recoverLockMode();
notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
@@ -265,11 +257,6 @@ public class MogoServices implements IMogoMapListener,
private Handler mThreadHandler;
/**
* 当前限速
*/
private int mCurrentLimit = -1;
private final IMogoStatusChangedListener statusChangedListener = new StatusChangedAdapter() {
@Override
@@ -339,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 );
@@ -646,7 +632,6 @@ public class MogoServices implements IMogoMapListener,
if ( latLng == null ) {
return;
}
mLastCarLocation = latLng;
// poi 定位无法获取时,使用该定位
if ( mLastAutoRefreshLocation == null ) {
MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
@@ -834,10 +819,6 @@ public class MogoServices implements IMogoMapListener,
MoGoAiCloudRealTime.stopRealTime();
}
public Location getLastCarLocation() {
return mLastCarLocation;
}
private boolean mLastStatusIsVr = false;
public boolean isLastStatusIsVr() {
@@ -873,49 +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();
}
}
}
}

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
@@ -172,7 +173,7 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
currentAutopilot.vehicleType = 10;
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
mApis.getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot);
}
@Override