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

@@ -35,7 +35,7 @@ public class OchBusModelLoopManager {
}
Logger.i(TAG, "startHeartbeatLoop()");
mHeartbeatDisposable = Observable.interval(OchBusConst.LOOP_DELAY,
OchBusConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OchBusConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -196,7 +196,7 @@ public class OchBusOrderModel {
return;
}
mBusOrdersDisposable = Observable.interval(OchBusConst.LOOP_DELAY,
OchBusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OchBusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -38,7 +38,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startInAndWaitOrdersLoop()");
mInAndWaitServiceDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -59,7 +59,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startNewBookingOrderLoop()");
mNewBookingOrderDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -80,7 +80,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startGrabResultLoop()");
mGrabResultDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -101,7 +101,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startHeartbeatLoop()");
mHeartbeatDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -38,7 +38,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startInAndWaitOrdersLoop()");
mInAndWaitServiceDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -59,7 +59,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startNewBookingOrderLoop()");
mNewBookingOrderDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -80,7 +80,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startGrabResultLoop()");
mGrabResultDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
@@ -101,7 +101,7 @@ public class OCHTaxiModelLoopManager {
}
Logger.i(TAG, "startHeartbeatLoop()");
mHeartbeatDisposable = Observable.interval(OCHTaxiConst.LOOP_DELAY,
OCHTaxiConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS,Schedulers.trampoline())
OCHTaxiConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -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}",

View File

@@ -7,7 +7,6 @@ apply plugin: 'bugly'
//apply ByteX宿主
if (!isAndroidTestBuild()) {
apply plugin: 'bytex'
ByteX {

View File

@@ -0,0 +1,57 @@
package com.mogo.functions.test
import androidx.lifecycle.coroutineScope
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mogo.eagle.core.function.main.MainLauncherActivity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit
@RunWith(AndroidJUnit4::class)
@LargeTest
class KotlinCoroutineSchedulersTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test
fun testKotlinCoroutineSchedulersIo() = runBlocking {
launch.onActivity {
it.lifecycle.coroutineScope.launchWhenCreated {
repeat(10) {
withContext(Dispatchers.IO) {
assert(Thread.currentThread().name.startsWith("io-pool-"))
}
delay(TimeUnit.SECONDS.toMillis(1))
}
}
}
delay(TimeUnit.SECONDS.toMillis(20))
}
@Test
fun testKotlinCoroutineSchedulersCpu() = runBlocking {
launch.onActivity {
it.lifecycle.coroutineScope.launchWhenCreated {
repeat(10) {
withContext(Dispatchers.Default) {
assert(Thread.currentThread().name.startsWith("cpu-pool-"))
}
delay(TimeUnit.SECONDS.toMillis(1))
}
}
}
delay(TimeUnit.SECONDS.toMillis(20))
}
}

View File

@@ -0,0 +1,76 @@
package com.mogo.functions.test
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mogo.eagle.core.function.main.MainLauncherActivity
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.TimeUnit.SECONDS
@RunWith(AndroidJUnit4::class)
@LargeTest
class RxJavaSchedulersTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test
fun testRxJavaIoSchedulers() = runBlocking {
val list = mutableListOf<Int>()
for (i in 1..10) {
list += i
}
val result = Observable.fromIterable(list)
.doOnNext {
assert(Thread.currentThread().name.startsWith("io-pool-"))
}
.subscribeOn(Schedulers.io())
.reduce(0) { adder, toAdd ->
val sum = adder + toAdd
sum
}
.blockingGet()
assert(result == 55)
delay(SECONDS.toMillis(20))
}
@Test
fun testRxJavaCpuSchedulers() = runBlocking {
val result = Observable.create(ObservableOnSubscribe<Int> { emitter ->
for (i in 1..10) {
emitter.onNext(i)
}
assert(Thread.currentThread().name.startsWith("cpu-pool-"))
emitter.onComplete()
}).reduce(0) { adder, toAdd ->
adder + toAdd
}.subscribeOn(Schedulers.computation()).blockingGet()
assert(result == 55)
delay(SECONDS.toMillis(20))
}
@Test
fun testRxJavaIntervalSchedulers() = runBlocking {
var counter = 0
Observable.intervalRange(0, 10, 1, 1 ,SECONDS)
.doOnNext {
counter ++
}
.subscribe()
delay(SECONDS.toMillis(20))
assert(counter == 10)
}
}

View File

@@ -33,7 +33,7 @@ buildscript {
classpath "com.bytedance.android.byteX:base-plugin:0.3.0"
classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}"
classpath 'com.volcengine:apm_insight_plugin:1.4.1'
classpath 'com.mogo.cloud:thread_opt:1.0.0'
classpath 'com.mogo.cloud:thread_opt:1.0.1'
classpath 'com.mogo.cloud:systrace:1.0.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'

View File

@@ -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}",

View File

@@ -51,16 +51,25 @@ dependencies {
kapt rootProject.ext.dependencies.aroutercompiler
// implementation rootProject.ext.dependencies.adasHigh
implementation rootProject.ext.dependencies.mogoami
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_network
implementation rootProject.ext.dependencies.mogo_core_function_api
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.adasHigh
} 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')
implementation project(':core:mogo-core-network')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
implementation project(':libraries:mogo-adas')

View File

@@ -6,13 +6,17 @@ import androidx.annotation.RequiresPermission
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
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
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
@@ -34,9 +38,27 @@ class MoGoAutopilotProvider :
get() = TAG
override fun init(context: Context) {
MoGoHandAdasMsgManager.getInstance();
Logger.d(TAG, "初始化工控机连接……")
mContext = context
// 初始化ADAS 域控制器
//AdasManager.getInstance().create(context)
CupidLogUtils.setEnableLog(false)
CupidLogUtils.setIsWriteLog(false)
// TODO 临时方案根据不同的身份标识连接不同的工控机IP
when (FunctionBuildConfig.appIdentityMode) {
0 -> // 司机
AdasManager.getInstance().create(context, "192.168.1.102")
1 -> // 乘客
AdasManager.getInstance().create(context, "192.168.1.103")
else -> // 默认采用UDP寻址方式
AdasManager.getInstance().create(context)
}
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
// 监听 adas 连接状态
AdasManager.getInstance().setOnAdasConnectStatusListener(MoGoAdasMsgConnectStatusListenerImpl())
// 监听ADAS-SDK获取到的工控机数据
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
// 同步数据给工控机的服务
AsyncDataToAutopilotServer.INSTANCE.initServer()
}
@@ -72,7 +94,7 @@ class MoGoAutopilotProvider :
val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result)
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter))
} else {
LogUtils.eTag(TAG, "车机与工控机链接失败,无法开启自动驾驶")
Logger.e(TAG, "车机与工控机链接失败,无法开启自动驾驶")
}
}
@@ -84,7 +106,7 @@ class MoGoAutopilotProvider :
if (AdasManager.getInstance().isSocketConnect) {
AdasManager.getInstance().controlAutopilotCarHead()
} else {
LogUtils.eTag(TAG, "车机与工控机链接失败,无法断开自动驾驶")
Logger.e(TAG, "车机与工控机链接失败,无法断开自动驾驶")
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.module.adas;
package com.mogo.eagle.core.function.autopilot.adapter;
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;
@@ -13,6 +13,8 @@ import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_ADAS;
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;
@@ -23,12 +25,17 @@ 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.autopilot.utils.AdasObjectConvertUtils;
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.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;
@@ -49,6 +56,8 @@ import com.zhidao.support.obu.ami.AmiClientManager;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
@@ -58,7 +67,7 @@ import java.util.List;
* <p>
* 适配ADAS 回调监听分发
*/
public class OnAdasListenerAdapter implements OnAdasListener {
public class MoGoAdasListenerImpl implements OnAdasListener {
private final String TAG = "OnAdasListenerAdapter";
@ChainLog(linkCode = CHAIN_LINK_ADAS,
@@ -69,7 +78,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onRectData(RectInfo rectInfo) {
if (HdMapBuildConfig.isMapLoaded) {
ArrayList<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
ArrayList<TrafficData> recognizedListResults = AdasObjectConvertUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
}
}
@@ -86,24 +95,75 @@ public class OnAdasListenerAdapter implements OnAdasListener {
//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);
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();
}
}
}
@@ -170,7 +230,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
public void onAutopilotRoute(AutopilotRoute route) {
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
AutopilotRouteInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
}
}
@@ -218,7 +278,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
if (HdMapBuildConfig.isMapLoaded) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
}
}
@@ -269,7 +329,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
clientPkFileName = "sn")
@Override
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
final AutopilotWarnMessage warnMessage = AdasObjectUtils.INSTANCE.fromAdasObject(warnMessageInfo);
final AutopilotWarnMessage warnMessage = AdasObjectConvertUtils.INSTANCE.fromAdasObject(warnMessageInfo);
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
}
@@ -285,18 +345,18 @@ public class OnAdasListenerAdapter implements OnAdasListener {
*/
@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");
}
}

View File

@@ -0,0 +1,100 @@
package com.mogo.eagle.core.function.autopilot.adapter
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener
import com.zhidao.support.adas.high.bean.BasicInfo
import io.reactivex.Flowable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
/**
* ADAS-SDK与工控机连接状态回调
*
* @author donghongyu
*/
class MoGoAdasMsgConnectStatusListenerImpl : OnAdasMsgConnectStatusListener, IMoGoAutopilotStatusListener {
private val TAG = "MoGoAdasMsgConnectStatusListenerImpl"
//自动驾驶状态
private var mCurrentAutopilotStatus = -1
//自动驾驶车速度
private var mCurrentAutopilotSpeed = 0f
override fun onWebSocketConnectSuccess() {
Logger.d(TAG, "webSocket 连接成功")
// 初始化自动驾驶状态信息
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP = AdasManager.getInstance().adasConfig.address
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
// 同步SN给工控机
syncBasicInfoToAutopilot()
// 开启轮训上传自动驾驶状态
updateDriveStatusTask()
}
override fun onWebSocketConnectFailed(reason: String) {
Logger.d(TAG, "webSocket 连接失败 reason:$reason")
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP = AdasManager.getInstance().adasConfig.address
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
}
/**
* 工控机获取SN
*/
override fun onAutopilotSNRequest() {
syncBasicInfoToAutopilot()
}
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
if (autopilotWayArrive != null) {
val lon = autopilotWayArrive.lon
val lat = autopilotWayArrive.lat
AdasServiceModel.getInstance().reportSite(lon, lat)
}
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val state = autoPilotStatusInfo.state
val speed = autoPilotStatusInfo.speed
mCurrentAutopilotStatus = state
mCurrentAutopilotSpeed = speed
}
/**
* 同步SN信息给工控机
*/
private fun syncBasicInfoToAutopilot() {
Logger.d(TAG, "同步PAD的SN给工控机……")
val info = BasicInfo()
info.setSn(MoGoAiCloudClientConfig.getInstance().sn)
AdasManager.getInstance().setBasicInfo(info)
}
/**
* 上传自动驾驶状态任务
*/
private fun updateDriveStatusTask() {
Logger.d(TAG, "updateDriveStatusTask")
Flowable.interval(0, 5, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { aLong: Long? ->
AdasServiceModel.getInstance().updateDriveStatus(mCurrentAutopilotStatus, mCurrentAutopilotSpeed)
}
}
}

View File

@@ -1,38 +0,0 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
/**
* @author xiaoyuzhou
* @date 2021/10/20 1:02 下午
* 自动驾驶状态回调用
*/
public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusListener {
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
}
@Override
public void onAutopilotArriveAtStation(@Nullable AutopilotStationInfo autopilotWayArrive) {
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
}
}

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

@@ -1,4 +1,4 @@
package com.mogo.module.adas.entity;
package com.mogo.eagle.core.function.autopilot.entity;
/**
* Created by XuYong on 2021/5/28 16:12

View File

@@ -1,4 +1,4 @@
package com.mogo.module.adas.entity;
package com.mogo.eagle.core.function.autopilot.entity;
/**
* Created by XuYong on 2021/5/31 16:24

View File

@@ -1,24 +1,27 @@
package com.mogo.module.adas.model;
package com.mogo.eagle.core.function.autopilot.network;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.function.autopilot.entity.AutonomousDriveStatusBean;
import com.mogo.eagle.core.function.autopilot.entity.ReportSiteBean;
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 com.mogo.module.common.constants.HostConst;
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;
/**
* 将自动驾驶状态及站点信息上传给云平台云平台会根据此数据做路线的绘制
*
* @author dongghongyu
*/
public class AdasServiceModel {
private static final String TAG = "AdasServiceModel";
@@ -28,7 +31,7 @@ public class AdasServiceModel {
private final IAdasApiService mAdasApiService;
private AdasServiceModel() {
this.mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IAdasApiService.class, DATA_SERVICE_HOST);
this.mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IAdasApiService.class, HostConst.DATA_SERVICE_HOST);
}
public static AdasServiceModel getInstance() {
@@ -48,7 +51,7 @@ public class AdasServiceModel {
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())) {
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);
@@ -73,7 +76,7 @@ public class AdasServiceModel {
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())) {
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(ContextHolderUtil.getContext())) {
@Override
public void onError(String message, int code) {
super.onError(message, code);

View File

@@ -1,4 +1,4 @@
package com.mogo.module.adas.network;
package com.mogo.eagle.core.function.autopilot.network;
import com.mogo.eagle.core.data.BaseData;

View File

@@ -1,10 +1,102 @@
package com.mogo.eagle.core.function.autopilot.utils
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.zhidao.support.adas.high.bean.AutopilotRoute
import com.zhidao.support.adas.high.bean.CarStateInfo
import com.zhidao.support.adas.high.bean.RectInfo
import com.zhidao.support.adas.high.bean.WarnMessageInfo
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
import com.zhidao.utils.common.GsonUtil
/**
* @author xiaoyuzhou
* @date 2021/10/18 1:32 下午
*/
class AdasObjectConvertUtils {
object AdasObjectConvertUtils {
val TAG = "AdasObjectConvertUtils"
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<RectInfo.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: RectInfo.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

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

View File

@@ -43,75 +43,6 @@ public interface IMoGoV2XMarkerManager extends IProvider {
*/
void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult);
/**
* 绘制V2X 地图点事件
*
* @param markerCardResult 大而全中过滤出来的点事件
*/
void drawableV2XMarker(MarkerCardResult markerCardResult);
/**
* 绘制 在线车辆 POI
*
* @param markerOnlineCars
* @param clickListener
*/
void drawableOnlineCarPOI(List<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener);
/**
* 清除 在线车辆 POI
*/
void clearOnlineCarPOI();
/**
* 绘制可以直播的在线车辆
*
* @param markerOnlineCars
* @param clickListener
*/
void drawableLiveCarPOI(List<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener);
/**
* 清除 可以直播的在线车辆 POI
*/
void clearLiveCarPOI();
/**
* 绘制 探路
*
* @param exploreWayList
* @param clickListener
*/
void drawableExplorePOI(List<MarkerExploreWay> exploreWayList, IMogoMarkerClickListener clickListener);
/**
* 清除 探路 POI
*/
void clearExplorePOI();
/**
* 绘制 新鲜事儿
*
* @param noveltyInfoList
* @param clickListener
*/
void drawableNoveltyPOI(List<MarkerNoveltyInfo> noveltyInfoList, IMogoMarkerClickListener clickListener);
/**
* 清除 新鲜事儿 POI
*/
void clearNoveltyPOI();
/**
* 绘制Marker上面调用的都是这个方法
*
* @param context
* @param markerShowEntity
* @param clickListener
*/
void drawableMarker(Context context, MarkerShowEntity markerShowEntity, IMogoMarkerClickListener clickListener);
/**
* 展开气泡

View File

@@ -25,58 +25,16 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
boolean isRoadEventWindowShow();
/**
* 头部 V2X的道路直播 UI 是否在展示
*/
boolean isRoadLiveCarWindowShow();
/**
* 头部 他人车辆故障求助 UI 是否在展示
*/
boolean isOtherSeekHelpWindowShow();
/**
* 地图区域 自身的道路求助按钮 是否在展示
*/
boolean isMeSeekHelpButtonShow();
/**
* 地图区域 他人车辆故障求助POI 是否在展示
*/
boolean isOtherSeekHelpPOIShow();
/**
* 前瞻需求
* 右侧2/3 V2X 场景动画 UI 是否在展示
*/
boolean isV2XAnimationShow();
/**
* 前瞻需求
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
boolean isLeftLiveVideoShow();
/**
* 推送弹窗的状态
*/
boolean isPushWindowShow();
/**
* 推送的 POI 状态
*/
boolean isPushPOIShow();
/**
* 疲劳驾驶 状态
*/
boolean isFatigueDrivingWindowShow();
/**
* 事件面板状态 状态
*/
boolean isEventPanelWindowShow();
/**
* 设置 V2X道路预警POI 是否在展示
*
@@ -117,22 +75,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
void setOtherSeekHelpWindowShow(String tag, boolean show);
/**
* 地图区域 自身的道路求助按钮 是否在展示
*
* @param tag
* @param show
*/
void setMeSeekHelpButtonShow(String tag, boolean show);
/**
* 地图区域 他人车辆故障求助POI 是否在展示
*
* @param tag
* @param show
*/
void setOtherSeekHelpPOIShow(String tag, boolean show);
/**
* 设置 右侧2/3 全屏 V2X 场景动画 是否在展示
*
@@ -177,30 +119,4 @@ public interface IMoGoV2XStatusManager extends IProvider {
* @param show
*/
void setFatigueDrivingWindowShow(String tag, boolean show);
/**
* 事件面板状态 是否在展示
*
* @param tag
* @param show
*/
void setEventPanelWindowShow(String tag, boolean show);
/**
* 注册监听
*
* @param tag 业务类型
* @param descriptor 监听类型
* @param listener 监听回调
*/
void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener);
/**
* 注销
*
* @param tag 业务类型
* @param descriptor 注销类型
* @param listener 注销回调
*/
void unregisterStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener);
}

View File

@@ -38,11 +38,6 @@ public enum V2XStatusDescriptor {
*/
OtherSeekHelpWindow_UI,
/**
* 头部 自身的道路求助按钮 UI 是否在展示
*/
MeSeekHelpButton_UI,
/**
* 右侧2/3 V2X 场景动画 UI 是否在展示
*/
@@ -71,10 +66,5 @@ public enum V2XStatusDescriptor {
/**
* 疲劳驾驶弹窗
*/
FatigueDrivingWindow_UI,
/**
* 事件面板状态
*/
EventPanelWindow_UI,
FatigueDrivingWindow_UI
}

View File

@@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.listener.V2XMarkerClickListener;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
@@ -31,11 +30,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerNoveltyInfo;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
@@ -173,266 +169,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
}
@Override
public void drawableV2XMarker(MarkerCardResult markerCardResult) {
boolean isShowEventWindow = false;
boolean isShowEventButton = false;
boolean isOtherSeekHelpWindowShow = false;
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
//预警Window状态
isShowEventWindow = v2xStatus.isRoadEventWindowShow();
//预警按钮状态
isShowEventButton = v2xStatus.isRoadEventButtonShow();
//道路求助的window
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
}
try {
//当没有预警提示的时候重新绘制地图POI点
if (!isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) {
// 清除上次的道路事件TODO 这里注意,道路事件的触发和这里是异步操作会触发异常
//mV2XRoadEventEntityArrayList.clear();
// 清除原来的大而全的新鲜事儿
try {
clearALLPOI();
} catch (Exception e) {
e.printStackTrace();
}
// 清除连接线
IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline();
if (polylineManager != null) {
polylineManager.clearLine();
}
if (markerCardResult != null) {
// 绘制新的地图气泡
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
drawableOnlineCarPOI(onlineCarList, V2XMarkerClickListener.getInstance());
drawableExplorePOI(exploreWayList, V2XMarkerClickListener.getInstance());
drawableNoveltyPOI(noveltyInfoList, V2XMarkerClickListener.getInstance());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void drawableOnlineCarPOI(List<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener) {
try {
if (markerOnlineCars != null) {
for (MarkerOnlineCar markerOnlineCar : markerOnlineCars) {
MarkerLocation markerLocation = markerOnlineCar.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(markerOnlineCar);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(markerOnlineCar.getType());
markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getSafeLabel());
markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead());
drawableMarker(BridgeApi.INSTANCE.context(), markerShowEntity, clickListener);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearOnlineCarPOI() {
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
marker.removeMarkers(V2XConst.V2X_CARD_TYPE_USER_DATA);
}
}
@Override
public void drawableLiveCarPOI(List<MarkerOnlineCar> markerOnlineCars, IMogoMarkerClickListener clickListener) {
try {
Logger.w(MODULE_NAME, "V2X===事件周边的直播车机:" + markerOnlineCars);
if (markerOnlineCars != null) {
for (MarkerOnlineCar markerOnlineCar : markerOnlineCars) {
// 设置车类型
markerOnlineCar.getUserInfo().setSafeLabelType(4);
markerOnlineCar.getCarInfo().setVehicleType(0);
MarkerLocation markerLocation = markerOnlineCar.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(markerOnlineCar);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(V2XConst.V2X_MARKER_LIVE_CAR);
markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getSafeLabel());
markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead());
drawableMarker(
BridgeApi.INSTANCE.context(),
markerShowEntity,
clickListener);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearLiveCarPOI() {
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
marker.removeMarkers(V2XConst.V2X_MARKER_LIVE_CAR);
}
}
@Override
public void drawableExplorePOI(List<MarkerExploreWay> exploreWayList, IMogoMarkerClickListener clickListener) {
try {
if (exploreWayList != null) {
for (MarkerExploreWay markerExploreWay : exploreWayList) {
// 因为目前探路卡片不支持直播,所以这里做了过滤 @李小鹏
if (!markerExploreWay.getCanLive()) {
MarkerLocation markerLocation = markerExploreWay.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(markerExploreWay);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(markerExploreWay.getType());
markerShowEntity.setTextContent(markerExploreWay.getAddr());
drawableMarker(
BridgeApi.INSTANCE.context(),
markerShowEntity,
clickListener);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearExplorePOI() {
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
marker.removeMarkers(V2XConst.V2X_CARD_TYPE_ROAD_CONDITION);
}
}
@Override
public void drawableNoveltyPOI(List<MarkerNoveltyInfo> noveltyInfoList, IMogoMarkerClickListener clickListener) {
try {
if (noveltyInfoList != null) {
for (MarkerNoveltyInfo noveltyInfo : noveltyInfoList) {
MarkerLocation markerLocation = noveltyInfo.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(noveltyInfo);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(noveltyInfo.getType());
markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress());
// 这里只绘制道路事件相关
if (EventTypeEnum.TRAFFIC_CHECK.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.ROAD_CLOSED.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ROAD_WORK.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_PONDING.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_PARKING.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ICE.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_FOG.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT_01.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT_02.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT_03.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT_04.getPoiType().equals(noveltyInfo.getPoiType())
|| EventTypeEnum.FOURS_ACCIDENT_05.getPoiType().equals(noveltyInfo.getPoiType())) {
drawableMarker(BridgeApi.INSTANCE.context(), markerShowEntity, clickListener);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearNoveltyPOI() {
IMogoMarkerManager marker = BridgeApi.INSTANCE.marker();
if (marker != null) {
marker.removeMarkers(V2XConst.V2X_CARD_TYPE_NOVELTY);
}
}
@Override
public void drawableMarker(Context context, MarkerShowEntity markerShowEntity, IMogoMarkerClickListener clickListener) {
// Logger.i(MODULE_NAME, "绘制Marker====drawMapMarker" + markerShowEntity);
try {
if (markerShowEntity.getMarkerLocation() != null) {
MogoMarkerOptions options = new MogoMarkerOptions()
.data(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
// 这里对Marker做下持有者转换与大而全的区分开由于绘制的时候用到了低层能力所以不去修改markerShowEntity中的type
switch (markerShowEntity.getMarkerType()) {
case ServiceConst.CARD_TYPE_USER_DATA:
options.owner(V2XConst.V2X_CARD_TYPE_USER_DATA);
break;
case ServiceConst.CARD_TYPE_NOVELTY:
options.owner(V2XConst.V2X_CARD_TYPE_NOVELTY);
break;
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
options.owner(V2XConst.V2X_CARD_TYPE_ROAD_CONDITION);
break;
case V2XConst.V2X_MARKER_SPECIAL_CAR:
options.owner(V2XConst.V2X_MARKER_SPECIAL_CAR);
break;
case V2XConst.V2X_MARKER_LIVE_CAR:
options.owner(V2XConst.V2X_MARKER_LIVE_CAR);
break;
default:
options.owner(markerShowEntity.getMarkerType());
break;
}
IMogoMarker marker = null;
Bitmap bitmap;
if (markerShowEntity.getMarkerType().equals(ServiceConst.CARD_TYPE_USER_DATA)
|| markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_SPECIAL_CAR)
|| markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_LIVE_CAR)
|| markerShowEntity.getMarkerType().equals(V2XConst.V2X_MARKER_EXPRESS)
) {
bitmap = V2XMarkerAdapter.getV2XCarMarkerView(context, markerShowEntity);
options.icon(bitmap);
IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker();
if (markerManager != null) {
marker = markerManager.addMarker(markerShowEntity.getMarkerType(), options);
}
} else {
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(context, markerShowEntity, options);
bitmap = ViewUtils.fromView(iMarkerView.getView());
options.icon(bitmap);
IMogoMarkerManager markerManager = BridgeApi.INSTANCE.marker();
if (markerManager != null) {
marker = markerManager.addMarker(markerShowEntity.getMarkerType(), options);
}
iMarkerView.setMarker(marker);
}
//marker.setOnMarkerClickListener(clickListener);
} else {
Logger.e(MODULE_NAME, "Location 必须进行初始化!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public IMogoMarker openMarker(Context context, IMogoMarker currentMarker) {

View File

@@ -63,56 +63,16 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
return get_bool_val(V2XStatusDescriptor.RoadEventWindow_UI);
}
@Override
public boolean isRoadLiveCarWindowShow() {
return get_bool_val(V2XStatusDescriptor.RoadLiveCarWindow_UI);
}
@Override
public boolean isOtherSeekHelpWindowShow() {
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpWindow_UI);
}
@Override
public boolean isMeSeekHelpButtonShow() {
return get_bool_val(V2XStatusDescriptor.MeSeekHelpButton_UI);
}
@Override
public boolean isOtherSeekHelpPOIShow() {
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpPOI_UI);
}
@Override
public boolean isV2XAnimationShow() {
return get_bool_val(V2XStatusDescriptor.V2XAnimationWindow_UI);
}
@Override
public boolean isLeftLiveVideoShow() {
return get_bool_val(V2XStatusDescriptor.LiveCarWindow_UI);
}
@Override
public boolean isPushWindowShow() {
return get_bool_val(V2XStatusDescriptor.PushWindow_UI);
}
@Override
public boolean isPushPOIShow() {
return get_bool_val(V2XStatusDescriptor.PushWindowPOI_UI);
}
@Override
public boolean isFatigueDrivingWindowShow() {
return get_bool_val(V2XStatusDescriptor.FatigueDrivingWindow_UI);
}
@Override
public boolean isEventPanelWindowShow() {
return get_bool_val(V2XStatusDescriptor.EventPanelWindow_UI);
}
@Override
public void setRoadEventPOIShow(String tag, boolean show) {
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
@@ -152,24 +112,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpWindow_UI);
}
@Override
public void setMeSeekHelpButtonShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.MeSeekHelpButton_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.MeSeekHelpButton_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.MeSeekHelpButton_UI);
}
@Override
public void setOtherSeekHelpPOIShow(String tag, boolean show) {
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
statusManager.setV2XUIShow(V2XConst.MODULE_NAME, show);
}
mStatus.put(V2XStatusDescriptor.OtherSeekHelpPOI_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.OtherSeekHelpPOI_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpPOI_UI);
}
@Override
public void setV2XAnimationWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
@@ -213,40 +155,7 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
}
@Override
public void setEventPanelWindowShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.EventPanelWindow_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.EventPanelWindow_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.EventPanelWindow_UI);
}
@Override
public void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
if (listener == null || descriptor == null) {
return;
}
if (!mListeners.containsKey(descriptor)) {
mListeners.put(descriptor, new ArrayList<>());
}
if (mListeners.get(descriptor) == null) {
mListeners.put(descriptor, new ArrayList<>());
}
List<IMoGoV2XStatusChangedListener> listeners = mListeners.get(descriptor);
if (listeners != null) {
listeners.add(listener);
}
}
@Override
public void unregisterStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
List<IMoGoV2XStatusChangedListener> listeners = mListeners.get(descriptor);
if (listeners != null) {
listeners.remove(listener);
}
}
/**
/**
* 调用所有存储的监听
*
* @param descriptor

View File

@@ -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";
/**
* 车辆检测 模块
*/

View File

@@ -16,16 +16,14 @@ interface IMoGoAutopilotStatusListener {
*
* @param autoPilotStatusInfo 状态信息
*/
fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo)
fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo){}
/**
* 自动驾驶到站
*
* @param autopilotWayArrive 所到车站的简单信息
*/
fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?){
}
fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?){}
/**
* 工控机获取SN
@@ -35,9 +33,7 @@ interface IMoGoAutopilotStatusListener {
/**
* 工控机监控节点
*/
fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?){
}
fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?){}
companion object {

View File

@@ -37,19 +37,15 @@ public class FinalizeCrashFixer {
* 只有线程在运行状态才会关闭线程
*/
public static void fix() {
AppStateManager.INSTANCE.registerAppStateListener(new IAppStateListener() {
@Override
public void onAppStateChanged(boolean isForeground) {
if (isForeground) {
//前后台则重新反射关闭一遍,避免线程被再次开启
Logger.d("FinalizeCrashFixer", "--- 切换到前台 ---");
realFix();
} else {
//前后台则重新反射关闭一遍,避免线程被再次开启
Logger.d("FinalizeCrashFixer", "--- 切换到后台 ---");
realFix();
}
AppStateManager.INSTANCE.registerAppStateListener(isForeground -> {
if (isForeground) {
//前后台则重新反射关闭一遍,避免线程被再次开启
Logger.d("FinalizeCrashFixer", "--- 切换到前台 ---");
} else {
//前后台则重新反射关闭一遍,避免线程被再次开启
Logger.d("FinalizeCrashFixer", "--- 切换到后台 ---");
}
realFix();
});
}

View File

@@ -24,7 +24,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

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

View File

@@ -1,7 +1,6 @@
package com.mogo.service.adas;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
/**
* @author congtaowang
@@ -11,28 +10,8 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
*/
public interface IMogoADASController extends IProvider {
/**
* 显示
*/
void showADAS();
void release();
/**
* 给adas传递数据
*
* @param result
*/
void aiCloudToAdasData(AutopilotControlParameters result);
/**
* 自车定位数据
*
* @param carDataCallback
*/
void setAdasCarDataCallback(IMogoAdasCarDataCallback carDataCallback);
/**
* 获取车身的定位纬度
*
@@ -40,6 +19,11 @@ public interface IMogoADASController extends IProvider {
*/
double getLastLat();
/**
* 设置自车的定位纬度
*/
void setLastLat(double lastLat);
/**
* 获取车身定位经度
*
@@ -47,6 +31,11 @@ public interface IMogoADASController extends IProvider {
*/
double getLastLon();
/**
* 设置自车的定位经度
*/
void setLastLon(double lastLon);
/**
* 获取由工控机传回的GPS星历时间
*
@@ -54,4 +43,9 @@ public interface IMogoADASController extends IProvider {
*/
String getSatelliteTime();
/**
* 设置自车的GPS星历时间
*/
void setSatelliteTime(String satelliteTime);
}

View File

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

View File

@@ -1,45 +0,0 @@
package com.mogo.service.adas;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
/**
* @author congtaowang
* @since 2021/1/18
* <p>
* 自动驾驶到站回调
*/
public interface IMogoAdasOCHCallback {
/**
* 不可自动驾驶目前场景是刚开机adas还未和工控机连接
*/
int STATUS_AUTOPILOT_DISABLE = 0;
/**
* 可自动驾驶,工控机连接正常,且处于人工干预状态
*/
int STATUS_AUTOPILOT_ENABLE = 1;
/**
* 自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
*/
int STATUS_AUTOPILOT_RUNNING = 2;
/**
* 到站
*
* @param data 所到车站的简单信息
* @see com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener#onAutopilotArriveAtStation
*/
@Deprecated
void onArriveAt(AutopilotStationInfo data);
/**
* 自动驾驶状态发生改变
*
* @param state {@link #STATUS_AUTOPILOT_DISABLE}
* @param reason 不能自动驾驶的原因
* @see com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener#onAutopilotStatusResponse
*/
@Deprecated
void onStateChanged(int state, String reason);
}

View File

@@ -57,18 +57,15 @@ 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
} else {
implementation project(':modules:mogo-module-adas')
api project(":libraries:mogo-map")
implementation project(":libraries:mogo-map-api")
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')

View File

@@ -3,125 +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.AutopilotControlCmdParameter;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
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.mogo.service.adas.IMogoAdasOCHCallback;
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 String getSatelliteTime() {
return satelliteTime;
public void setLastLon(double lastLon) {
mLastLon = lastLon;
}
private final List<IMogoAdasOCHCallback> mAdasOCHCallback = new CopyOnWriteArrayList<>();
@Override
public String getSatelliteTime() {
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);
}
}
@Override
public void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
DebugConfig.setAutoPilotStatus(autopilotStatus.getState() + "");
if (!mAdasOCHCallback.isEmpty()) {
for (IMogoAdasOCHCallback cb : mAdasOCHCallback) {
cb.onStateChanged(autopilotStatus.getState(), autopilotStatus.getReason());
}
}
}
};
adasProvider.addAdasEventListener(mAdasDataListener);
}
}
@Override
public void aiCloudToAdasData(AutopilotControlParameters result) {
try {
AutopilotControlCmdParameter parameter = new AutopilotControlCmdParameter("aiCloudToStartAutopilot", result);
//位置信息 action是aiCloudToStartAutopilot
try {
adasProvider.sendWsMessage(GsonUtil.jsonFromObject(parameter));
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
Logger.e(TAG, e, "aiCloudToAdasData");
}
}
@Override
public void release() {
adasProvider.removeAdasEventListener(mAdasDataListener);
AutopilotServiceManage.getInstance().release();
}
@Override
public void setAdasCarDataCallback(IMogoAdasCarDataCallback carDataCallback) {
mMogoAdasCarDataCallback = carDataCallback;
}
}

View File

@@ -57,7 +57,6 @@ include ':libraries:mogo-map'
include ':libraries:mogo-adas'
// OLD业务模块
include ':modules:mogo-module-adas'
include ':modules:mogo-module-common'
include ':modules:mogo-module-main'
include ':modules:mogo-module-service'