准备抽离AutoPilot调用逻辑,有些多,放在10月份进行

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-22 21:14:08 +08:00
parent 9e80448071
commit 808e772cce
27 changed files with 257 additions and 72 deletions

View File

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

View File

@@ -0,0 +1,67 @@
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
implementation "com.zhidao.support.adas:high:1.2.0.2"
if (Boolean.valueOf(RELEASE)) {
} else {
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()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.eagle.core
POM_ARTIFACT_ID=function-autopilot
VERSION_CODE=1

View File

@@ -0,0 +1,21 @@
# 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

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.hmi">
</manifest>

View File

@@ -0,0 +1,56 @@
package com.mogo.eagle.core.function.autopilot;
import android.content.Context;
import com.mogo.eagle.core.data.autopilot.AdasControlCommandParameter;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotProvider;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.LogUtils;
import com.zhidao.support.adas.high.AdasManager;
/**
* @author xiaoyuzhou
* @date 2021/9/22 8:43 下午
*/
public class MoGoAutoPilotProvider implements IMoGoAutoPilotProvider {
private static final String TAG = "MogoAutoPilotProvider";
@Override
public void init(Context context) {
}
@Override
public void startAutoPilot(RemoteControlAutoPilotParameters result) {
if (AdasManager.getInstance().isSocketConnect()) {
AdasControlCommandParameter parameter = new AdasControlCommandParameter(TAG, result);
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter));
} else {
LogUtils.eTag(TAG, "车机与工控机链接失败,无法开启自动驾驶");
}
}
@Override
public void cancelAutoPilot() {
if (AdasManager.getInstance().isSocketConnect()) {
AdasManager.getInstance().controlAutopilotCarHead();
} else {
LogUtils.eTag(TAG, "车机与工控机链接失败,无法断开自动驾驶");
}
}
@Override
public int getAutopilotStatus() {
// int status = IMoGoAutoPilotStatusListener.STATUS_AUTOPILOT_DISABLE;
// try {
// status = adasProvider.autopilotStateCall().getState();
// } catch (Exception e) {
// e.printStackTrace();
// }
return 0;
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.eagle.core.data.autopilot;
public
/**
* @author congtaowang
* @since 2020/10/22
*
* 描述
*/
class AdasControlCommandParameter {
public String action;
public Object result;
public AdasControlCommandParameter( String action, Object result ) {
this.action = action;
this.result = result;
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.data.autopilot;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* 自动驾驶网约车回调数据
*/
class AdasOCHData {
public int type;
public double lon;
public double lat;
public AdasOCHData( int type, double lon, double lat ) {
this.type = type;
this.lon = lon;
this.lat = lat;
}
}

View File

@@ -0,0 +1,54 @@
package com.mogo.eagle.core.data.autopilot;
import java.util.List;
/**
* @author donghongyu
* @since 2021/09/22
* <p>
* 启动自动驾驶参数
*/
public class RemoteControlAutoPilotParameters {
public AutoPilotLonLat startLatLon;
public List<AutoPilotLonLat> wayLatLons;
public AutoPilotLonLat endLatLon;
public float speedLimit;
public int vehicleType;// 运营类型
/**
* 是否播放adas的 开始自动驾驶 语音
*/
public boolean isSpeakVoice = true;
public static class AutoPilotLonLat {
public double lat;
public double lon;
public AutoPilotLonLat() {
}
public AutoPilotLonLat(double lat, double lon) {
this.lat = lat;
this.lon = lon;
}
@Override
public String toString() {
return "AutoPilotLonLat{" +
"lat=" + lat +
", lon=" + lon +
'}';
}
}
@Override
public String toString() {
return "RemoteControlAutoPilotParameters{" +
"startLatLon=" + startLatLon +
", wayLatLons=" + wayLatLons +
", endLatLon=" + endLatLon +
", speedLimit=" + speedLimit +
", vehicleType=" + vehicleType +
'}';
}
}

View File

@@ -1,44 +0,0 @@
package com.mogo.eagle.core.data.model
/**
*@author xiaoyuzhou
*@date 2021/9/14 3:51 下午
*/
class V2XThreatIndInfo {
// /**
// * RV temperary vehicle ID
// */
// private val vehicle_id: String? = null
// /**
// * V2V threat status 0: update 1: add 2: delete
// * range(0..2)
// * [com.zhidao.support.obu.constants.ObuConstants.STATUS]
// */
// private val status = 0
//
// /**
// * RV threat information 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
// */
// private val threat_info: V2vThreat? = null
//
// /**
// * 目前判断RV方向使用的是 ext_info 中的 target_classification 变量
// * The extension information of V2V threat
// */
// private val ext_info: V2vThreatExt? = null
//
// /**
// * RV basic information
// */
// private val basic_info: MovingObjectInfo? = null
// /**
// * Wgs84坐标系线性经纬度轨迹列表
// */
// private val locus_list: List<com.mogo.eagle.core.data.map.MogoLatLng>? = null
//
// /**
// * 高德坐标系Gcj线性经纬度轨迹列表
// */
// private val gd_locus_list: List<com.mogo.eagle.core.data.map.MogoLatLng>? = null
}

View File

@@ -1,5 +1,10 @@
### 模块说明
本模块定义业务层具备那些功能不提供具体业务实现所有具体业务实现均在mogo-core-function-impl模块中
base
IMoGoFunctionProvider--------带界面的功能模块
IMoGoFunctionServerProvider--服务类型的功能模块
adas--域控制器相关
chat--车聊聊相关
check--车辆检测相关

View File

@@ -0,0 +1,32 @@
package com.mogo.eagle.core.function.api.autopilot;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
/**
* @author xiaoyuzhou
* @date 2021/9/22 8:27 下午
* 自动驾驶节点
*/
public interface IMoGoAutoPilotProvider extends IMoGoFunctionServerProvider {
/**
* 开启自动驾驶
*
* @param result
*/
void startAutoPilot(RemoteControlAutoPilotParameters result);
/**
* 结束自动驾驶
*/
void cancelAutoPilot();
/**
* 获取车辆自动驾驶状态
*
* @return
*/
int getAutopilotStatus();
}

View File

@@ -0,0 +1,38 @@
package com.mogo.eagle.core.function.api.autopilot;
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
/**
* @author xiaoyuzhou
* @date 2021/9/22 8:59 下午
* 自动驾驶状态回调监听
*/
public interface IMoGoAutoPilotStatusListener {
/**
* 不可自动驾驶目前场景是刚开机adas还未和工控机连接
*/
int STATUS_AUTOPILOT_DISABLE = 0;
/**
* 可自动驾驶,工控机连接正常,且处于人工干预状态
*/
int STATUS_AUTOPILOT_ENABLE = 1;
/**
* 自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
*/
int STATUS_AUTOPILOT_RUNNING = 2;
/**
* 到站
* @param data 所到车站的简单信息
*/
void onArriveAt( AdasOCHData data );
/**
* 自动驾驶状态发生改变
* @param state {@link #STATUS_AUTOPILOT_DISABLE}
* @param reason 不能自动驾驶的原因
*/
void onStateChanged(int state, String reason);
}