完成新架构的域控制器的监听及数据改造

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-18 19:16:41 +08:00
parent a4650ca514
commit 8a3e122518
76 changed files with 1895 additions and 1516 deletions

View File

@@ -1,6 +1,10 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
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
@@ -10,14 +14,15 @@ android {
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
buildTypes {
@@ -37,10 +42,10 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
// 现有的ADAS的通讯SDK需要将里面的东西融合到我们项目中
compileOnly rootProject.ext.dependencies.adasapi
@@ -61,6 +66,7 @@ dependencies {
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
}
}

View File

@@ -12,6 +12,8 @@ import android.location.Location;
import android.os.Handler;
import android.os.Message;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
@@ -129,12 +131,12 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<DispatchAdas
}
@Override
public void notifyAutopilotState(AutopilotStatus autopilotStatus) {
public void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
}
@Override
public void autopilotRoute(AutopilotRoute autopilotRoute) {
public void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
// if (autopilotRoute == null || autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
// return;
// }
@@ -226,12 +228,10 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener<DispatchAdas
}
public void testNotifyAutopilotState() {
AutopilotStatus autopilotStatus = new AutopilotStatus();
AutopilotStatus.ValuesBean valuesBean = new AutopilotStatus.ValuesBean();
valuesBean.setReason("123");
valuesBean.setSpeed(123);
valuesBean.setState(0);
autopilotStatus.setValues(valuesBean);
AutopilotStatusInfo autopilotStatus = new AutopilotStatusInfo();
autopilotStatus.setReason("123");
autopilotStatus.setSpeed(123);
autopilotStatus.setState(0);
AdasServiceModel.getInstance().uploadAutopilotStatus(autopilotStatus);
}

View File

@@ -1,29 +1,28 @@
package com.mogo.module.adas;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo;
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.traffic.TrafficData;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.module.adas.model.AdasServiceModel;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
import com.zhidao.support.adas.high.bean.CarLaneInfo;
import com.zhidao.support.adas.high.bean.CarStateInfo;
import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
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.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
@@ -33,7 +32,7 @@ import io.reactivex.schedulers.Schedulers;
/**
* Created by XuYong on 2021/4/25 14:43
*/
public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusListener {
public class AdasEventManager implements OnAdasMsgConnectStatusListener, IMoGoAutopilotStatusListener {
private final String TAG = "AdasEventManager";
@@ -48,12 +47,13 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
//自动驾驶车速度
private float mCurrentAutopilotSpeed = 0;
//自动驾驶状态
private AutopilotStatus.ValuesBean mAutopilotValuesStatus = null;
private AutopilotStatusInfo mAutopilotValuesStatus = null;
private IAdasProviderBizListener providerBizListener;
private AdasEventManager() {
gson = GsonUtil.getGson();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
}
public static AdasEventManager getInstance() {
@@ -98,157 +98,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
iAdasStatusListeners.clear();
}
@Override
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
Logger.d(TAG, "onWarnMessage " + warnMessageInfo);
//报警model
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onWarnMessage(warnMessageInfo);
}
}
}
@Override
public void onVideoSize(int width, int height) {
Logger.d(TAG, "onVideoSize");
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
}
}
}
@Override
public void onRectData(RectInfo rectInfo) {
Logger.d(TAG, "onRectData " + rectInfo);
try {
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onRectData(rectInfo);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onCarStateData(CarStateInfo carStateInfo) {
//Logger.d(TAG, "onCarStateData " + carStateInfo);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.ownerCarStateInfo(gson.toJson(carStateInfo));
}
}
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
if (bean != null) {
int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turn_light);
}
}
@Override
public void onLightStateData(LightStatueInfo lightStatueInfo) {
Logger.d(TAG, "onLightStateData " + lightStatueInfo);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
}
}
}
@Override
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
Logger.d(TAG, "onObstaclesInfo " + obstaclesInfo);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
}
}
}
@Override
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
Logger.d(TAG, "onCarLaneInfo " + carLaneInfo);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
}
}
}
@Override
public void autopilotStatus(AutopilotStatus autopilotStatus) {
Logger.d(TAG, "autopilotStatus " + autopilotStatus);
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutoPilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setAutopilotStatus(autopilotStatusValues.getState());
autopilotStatusInfo.setAutoDriveStatus(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setErrorReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
int state = autopilotStatusValues.getState();
float speed = autopilotStatusValues.getSpeed();
mCurrentAutopilotStatus = state;
mCurrentAutopilotSpeed = speed;
this.mAutopilotValuesStatus = autopilotStatus.getValues();
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.notifyAutopilotState(autopilotStatus);
}
}
}
}
@Override
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
Logger.d(TAG, "autopilotArrive " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AdasAIDLAutopilotArriveModel adasAIDLAutopilotArriveModel = new AdasAIDLAutopilotArriveModel();
adasAIDLAutopilotArriveModel.setCarType(result.getCarType());
double lon = endLatLon.getLon();
double lat = endLatLon.getLat();
adasAIDLAutopilotArriveModel.setLat(lat);
adasAIDLAutopilotArriveModel.setLon(lon);
Logger.d(TAG, "autopilotArrive reportSite");
reportSite(lon, lat);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotArrive(adasAIDLAutopilotArriveModel);
}
}
}
}
}
}
@Override
public void onAutopilotRoute(AutopilotRoute autopilotRoute) {
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
Logger.d(TAG, "onAutopilotRoute is null !");
return;
}
Logger.d(TAG, "onAutopilotRoute : " + autopilotRoute.toString());
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotRoute(autopilotRoute);
}
}
}
@Override
public void onAutopilotSNRequest() {
@@ -259,11 +108,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
}
}
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
}
@Override
public void onWebSocketConnectSuccess() {
Logger.d(TAG, "webSocket 连接成功");
@@ -271,7 +115,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(true);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
for (IAdasStatusListener listener : iAdasStatusListeners) {
listener.onServiceConnected();
}
@@ -283,7 +127,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
Logger.d(TAG, "webSocket 连接失败 reason:" + reason);
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().setConnectStatus(false);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
for (IAdasStatusListener listener : iAdasStatusListeners) {
listener.onServiceDisconnected();
}
@@ -319,4 +163,96 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
public void setProviderBizListener(IAdasProviderBizListener listener) {
providerBizListener = listener;
}
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
Logger.d(TAG, "autopilotStatus " + autoPilotStatusInfo);
int state = autoPilotStatusInfo.getState();
float speed = autoPilotStatusInfo.getSpeed();
mCurrentAutopilotStatus = state;
mCurrentAutopilotSpeed = speed;
this.mAutopilotValuesStatus = autoPilotStatusInfo;
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.notifyAutopilotState(autoPilotStatusInfo);
}
}
}
@Override
public void onAutopilotArriveAtStation(AutopilotStationInfo autopilotWayArrive) {
Logger.d(TAG, "autopilotArrive " + autopilotWayArrive);
if (autopilotWayArrive != null) {
double lon = autopilotWayArrive.getLon();
double lat = autopilotWayArrive.getLat();
Logger.d(TAG, "autopilotArrive reportSite");
reportSite(lon, lat);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotArrive(autopilotWayArrive);
}
}
}
}
@Override
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
Logger.d(TAG, "onCarStateData " + autoPilotCarStateInfo);
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.ownerCarStateInfo(gson.toJson(autoPilotCarStateInfo));
}
}
//can数据转发
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
if (bean != null) {
int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turn_light);
}
}
@Override
public void onAutopilotRoute(@Nullable AutopilotRouteInfo autopilotRoute) {
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
Logger.d(TAG, "onAutopilotRoute is null !");
return;
}
Logger.d(TAG, "onAutopilotRoute : " + autopilotRoute.toString());
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotRoute(autopilotRoute);
}
}
}
@Override
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
}
@Override
public void onAutopilotIdentifyDataUpdate(@Nullable List<TrafficData> trafficData) {
Logger.d(TAG, "onRectData " + trafficData);
try {
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onRectData(trafficData);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
Logger.d(TAG, "onWarnMessage " + autopilotWarnMessage);
//报警model
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onWarnMessage(autopilotWarnMessage);
}
}
}
}

View File

@@ -0,0 +1,110 @@
package com.mogo.module.adas
import android.util.Log
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
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.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.utils.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
import java.util.*
import java.util.concurrent.TimeUnit
/**
* @author congtaowang
* @since 2020/10/25
*
* 对象转换类
*/
object 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?>?): List<TrafficData>? {
if (datums == null || datums.isEmpty()) {
return null
}
val recognizedListResults: MutableList<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 start = System.nanoTime()
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(
"ADAS数据延时", "fromAdasObject cost : " + TimeUnit.NANOSECONDS.toMillis(
System.nanoTime() - start
)
)
return result
}
}

View File

@@ -9,7 +9,9 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.utils.logger.Logger;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.BasicInfo;
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
/**
@@ -45,7 +47,7 @@ public class AdasProvider implements IProvider {
private void initAdas(Context context, AdasEventManager adasEventManager) {
AdasManager.getInstance().create(context);
AdasManager.getInstance().setOnAdasListener(adasEventManager);
AdasManager.getInstance().setOnAdasListener(new OnAdasListenerAdapter());
AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager);
adasEventManager.setProviderBizListener(this::setBasicInfo);
}

View File

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

View File

@@ -1,11 +1,18 @@
package com.mogo.module.adas;
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.traffic.TrafficData;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import java.util.List;
public interface IAdasDataListener {
@@ -13,11 +20,11 @@ public interface IAdasDataListener {
}
default void onRectData(RectInfo rectInfo) {
default void onRectData(List<TrafficData> trafficData) {
}
default void onWarnMessage(WarnMessageInfo warnMessageInfo) {
default void onWarnMessage(AutopilotWarnMessage autopilotWarnMessage) {
}
@@ -25,17 +32,17 @@ public interface IAdasDataListener {
/**
* 自动驾驶到达站点回调接口
*
* @param autopilotArriveModel
* @param autopilotWayArrive
*/
default void autopilotArrive(AdasAIDLAutopilotArriveModel autopilotArriveModel) {
default void autopilotArrive(AutopilotStationInfo autopilotWayArrive) {
}
/**
* 自动驾驶路线回调
*
* @param autopilotRoute {@link AutopilotRoute}
* @param autopilotRoute {@link AutopilotRouteInfo}
*/
default void autopilotRoute(AutopilotRoute autopilotRoute) {
default void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
}
@@ -50,9 +57,9 @@ public interface IAdasDataListener {
/**
* 自动驾驶状态信息
*
* @param autopilotStatus {@link AutopilotStatus}
* @param autopilotStatus {@link AutopilotStatusInfo}
*/
default void notifyAutopilotState(AutopilotStatus autopilotStatus) {
default void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) {
}
}

View File

@@ -0,0 +1,141 @@
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.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.utils.logger.Logger;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
import com.zhidao.support.adas.high.bean.CarLaneInfo;
import com.zhidao.support.adas.high.bean.CarStateInfo;
import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
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.support.obu.ami.AmiClientManager;
import java.util.List;
/**
* @author congtaowang
* @since 2020/10/22
* <p>
* 适配ADAS 回调监听分发
*/
public class OnAdasListenerAdapter implements OnAdasListener {
private final String TAG = "OnAdasListenerAdapter";
@Override
public void onRectData(RectInfo rectInfo) {
List<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeIdentifyDataUpdate(recognizedListResults);
}
@Override
public void onCarStateData(CarStateInfo carStateInfo) {
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
if (bean != null) {
int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turn_light);
}
}
@Override
public void autopilotStatus(AutopilotStatus autopilotStatus) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
}
}
@Override
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
}
}
}
}
@Override
public void onAutopilotRoute(AutopilotRoute route) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotRoute(autopilotRoute);
}
@Override
public void onAutopilotSNRequest() {
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest();
}
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
}
@Override
public void onLightStateData(LightStatueInfo lightStatueInfo) {
}
@Override
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
}
@Override
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
}
@Override
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
final AutopilotWarnMessage warnMessage = AdasObjectUtils.INSTANCE.fromAdasObject(warnMessageInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
}
@Override
public void onVideoSize(int width, int height) {
}
}

View File

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

View File

@@ -1,17 +1,17 @@
package com.mogo.module.adas.entity;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
/**
* 上报自动驾驶规划的路径
*/
public class ReportedRoute {
private String sn;
private AutopilotStatus.ValuesBean bean;
private AutopilotStatusInfo bean;
private String siteList;
public ReportedRoute(String sn, AutopilotStatus.ValuesBean bean) {
public ReportedRoute(String sn, AutopilotStatusInfo bean) {
this.sn = sn;
this.bean = bean;
}

View File

@@ -1,31 +0,0 @@
package com.mogo.module.adas.entity;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
/**
* @author nie yunlong
* @des
* @date 2020/10/22
*/
public class WarnMessageModel {
private String action;
private WarnMessageInfo values;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public WarnMessageInfo getValues() {
return values;
}
public void setValues(WarnMessageInfo values) {
this.values = values;
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.adas.model;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
import com.mogo.module.adas.entity.ReportDispatchResult;
import com.mogo.module.adas.entity.ReportSiteBean;
@@ -59,9 +60,9 @@ public class AdasServiceModel {
*
* @param autopilotStatus {@link AutopilotStatus}
*/
public void uploadAutopilotStatus(AutopilotStatus autopilotStatus) {
public void uploadAutopilotStatus(AutopilotStatusInfo autopilotStatus) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus.getValues());
ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus);
Map<String, Object> map = new HashMap<>();
map.put("sn", sn);
map.put("data", GsonUtil.jsonFromObject(reportedRoute));

View File

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

View File

@@ -2,7 +2,7 @@ package com.mogo.module.common.datacenter;
import com.mogo.commons.FunctionBuildConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.cloud.location.CloudLocationInfo;
@@ -94,10 +94,10 @@ public class SnapshotLocationDataCenter {
// 使用与渠道配置一样的gps提供者提供的数据
if (gpsProvider == FunctionBuildConfig.gpsProvider) {
//测试面板状态同步
AutoPilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setLocationLat(lat);
autopilotStatusInfo.setLocationLon(lon);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener();
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
DebugConfig.setStatusData(DebugConfig.sLon, lon);
DebugConfig.setStatusData(DebugConfig.sLat, lat);

View File

@@ -1,5 +1,7 @@
package com.mogo.module.common.drawer;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
@@ -7,12 +9,12 @@ import android.util.Log;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import java.util.ArrayList;
import java.util.Iterator;
@@ -21,16 +23,13 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
public
/**
* @author congtaowang
* @since 2020/10/28
*
* <p>
* 绘制adas近景识别到的车辆
*/
class AdasRecognizedResultDrawer extends BaseDrawer {
public class AdasRecognizedResultDrawer extends BaseDrawer {
private static final String TAG = "RecognizedResultDrawer";
@@ -45,7 +44,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
super();
}
private final Map<String, ADASRecognizedResult> mLastPositions = new ConcurrentHashMap<>();
private final Map<String, TrafficData> mLastPositions = new ConcurrentHashMap<>();
public static AdasRecognizedResultDrawer getInstance() {
if (sInstance == null) {
@@ -76,7 +75,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
*
* @param resultList adas感知融合数据
*/
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
public void renderAdasRecognizedResult(List<TrafficData> resultList) {
final long start = System.nanoTime();
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
@@ -91,18 +90,18 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
return;
}
// List<ADASRecognizedResult> allDatumsList = new ArrayList<>();
// List<TrafficData> allDatumsList = new ArrayList<>();
// prepareData(resultList, allDatumsList);
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
List<ADASRecognizedResult> newDiffSet = new ArrayList<>();
for (ADASRecognizedResult recognizedListResult : resultList) {
List<TrafficData> newDiffSet = new ArrayList<>();
for (TrafficData recognizedListResult : resultList) {
if (isUselessValue(recognizedListResult)) {
continue;
}
// 复用之前存在的 marker
String uniqueKey = recognizedListResult.uuid;
String uniqueKey = recognizedListResult.getUuid();
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
if (marker != null && !marker.isDestroyed()) {
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
@@ -120,8 +119,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// 复用过期 marker
if (newDiffSetSize > 0) {
for (int i = 0; i < newDiffSetSize; i++) {
ADASRecognizedResult recognizedListResult = newDiffSet.get(i);
String uniqueKey = recognizedListResult.uuid;
TrafficData recognizedListResult = newDiffSet.get(i);
String uniqueKey = recognizedListResult.getUuid();
IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult);
if (marker == null) {
continue;
@@ -142,7 +141,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
* @param in
* @param out
*/
private void prepareData(List<ADASRecognizedResult> in, List<ADASRecognizedResult> out) {
private void prepareData(List<TrafficData> in, List<TrafficData> out) {
// foreCastPoint(in);
out.addAll(in);
}
@@ -154,22 +153,22 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
*
* @param in 数据源
*/
private void foreCastPoint(List<ADASRecognizedResult> in) {
private void foreCastPoint(List<TrafficData> in) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
for (ADASRecognizedResult adasResult : in) {
Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.uuid);
long internal = getCurSatelliteTime() - adasResult.satelliteTime;
for (TrafficData adasResult : in) {
Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.getUuid());
long internal = getCurSatelliteTime() - adasResult.getSatelliteTime();
if (internal <= 0) {
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.uuid);
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.getUuid());
continue;
}
long startTime = System.currentTimeMillis();
// 预测点
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.speed);
double foreCastDistance = adasResult.speed * internal / 1000;
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.getSpeed());
double foreCastDistance = adasResult.getSpeed() * internal / 1000;
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.lat, adasResult.lon);
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.heading);
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.getLat(), adasResult.getLon());
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.getHeading());
// 计算与自车距离
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
@@ -178,10 +177,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
long foreCastInternal = System.currentTimeMillis() - startTime;
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
adasResult.lat = foreCastMogoLatLon.getLat();
adasResult.lon = foreCastMogoLatLon.getLon();
adasResult.satelliteTime = (getCurSatelliteTime() - foreCastInternal);
adasResult.distance = distanceFromSelf;
adasResult.setLat(foreCastMogoLatLon.getLat());
adasResult.setLon(foreCastMogoLatLon.getLon());
adasResult.setSatelliteTime((getCurSatelliteTime() - foreCastInternal));
adasResult.setDistance(distanceFromSelf);
}
}
}
@@ -192,9 +191,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
* @param marker
* @param recognizedListResult
*/
private void updateCacheMarkerRes(IMogoMarker marker, ADASRecognizedResult recognizedListResult) {
private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) {
String resIdVal;
int resId = getModelRes(recognizedListResult.type);
int resId = getModelRes(recognizedListResult.getType().getType());
resIdVal = resId + "";
String resName = mMarkerCachesResMd5Values.get(resIdVal);
if (!TextUtils.isEmpty(resName)) {
@@ -211,11 +210,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if (mLastPositions.isEmpty()) {
return;
}
Iterator<ADASRecognizedResult> iterator = mLastPositions.values().iterator();
Iterator<TrafficData> iterator = mLastPositions.values().iterator();
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
while (iterator.hasNext()) {
ADASRecognizedResult result = iterator.next();
long internal = result.satelliteTime - getCurSatelliteTime();
TrafficData result = iterator.next();
long internal = result.getSatelliteTime() - getCurSatelliteTime();
if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象
iterator.remove();
}
@@ -225,33 +224,33 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
/**
* 过滤无用数据
*
* @param recognizedListResult {@link ADASRecognizedResult}
* @param recognizedListResult {@link TrafficData}
* @return useless
*/
private boolean isUselessValue(ADASRecognizedResult recognizedListResult) {
private boolean isUselessValue(TrafficData recognizedListResult) {
if (recognizedListResult == null) {
return true;
}
if (nonRenderType(recognizedListResult.type)) {
if (nonRenderType(recognizedListResult.getType().getType())) {
return true;
}
String uniqueKey = recognizedListResult.uuid;
String uniqueKey = recognizedListResult.getUuid();
return TextUtils.isEmpty(uniqueKey);
}
/**
* 绘制某个物体的一个数据
*
* @param recognizedListResult {@link ADASRecognizedResult}
* @param recognizedListResult {@link TrafficData}
* @param newAdasRecognizedMarkersCaches 缓存集合
*/
private void renderAdasOneFrame(IMogoMarker marker,
String uniqueKey,
ADASRecognizedResult recognizedListResult,
TrafficData recognizedListResult,
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
final long start = System.nanoTime();
// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
TrafficData lastPosition = mLastPositions.remove(uniqueKey);
// 道路吸附
// double lastLon = -1;
// double lastLat = -1;
@@ -269,18 +268,15 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
long interval = 45;
if (lastPosition != null) {
interval = computeAnimDuration(lastPosition.satelliteTime, recognizedListResult.satelliteTime);
interval = computeAnimDuration(lastPosition.getSatelliteTime(), recognizedListResult.getSatelliteTime());
}
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon());
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
Log.d("ADAS动画数据","cost : " + cost);
Log.d("ADAS动画数据", "cost : " + cost);
final long intervalRef = interval - cost;
Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.uuid);
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
String carColor = recognizedListResult.color;
if (TextUtils.isEmpty(carColor)) {
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel);
}
Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.getUuid());
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.getHeading(), intervalRef);
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
marker.setAnchorColor(carColor);
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
@@ -302,22 +298,19 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
/**
* 绘制 marker
*
* @param recognizedListResult {@link ADASRecognizedResult}
* @param recognizedListResult {@link TrafficData}
* @return {@link IMogoMarker}
*/
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) {
long start = System.nanoTime();
if (recognizedListResult == null) {
return null;
}
int resId = getModelRes(recognizedListResult.type);
int resId = getModelRes(recognizedListResult.getType().getType());
String resIdVal = resId + "";
String carColor = recognizedListResult.color;
if (TextUtils.isEmpty(carColor)) {
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel);
}
String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel());
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
.anchor(0.5f, 0.5f)
@@ -327,8 +320,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
.controlAngle(true)
.resName(mMarkerCachesResMd5Values.get(resIdVal))
.icon3DRes(resId)
.rotate((float) recognizedListResult.heading)
.position(new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon));
.rotate((float) recognizedListResult.getHeading())
.position(new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon()));
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
cacheMarkerIconResMd5Val(resIdVal, marker);
Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));

View File

@@ -14,8 +14,8 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.navi.VrModeNavInfoView;
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
import com.mogo.service.adas.MogoADASWarnType;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.mogo.eagle.core.data.autopilot.MogoADASWarnType;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.utils.logger.Logger;
import org.json.JSONArray;
@@ -92,7 +92,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}
@Override
public void onReceiveData(ADASWarnMessage msg) {
public void onReceiveData(AutopilotWarnMessage msg) {
Logger.d(TAG, "收到adas warn message, isVrMode: " + isVrMode + " msg: " + msg);
if (!isVrMode) {
return;

View File

@@ -1,5 +1,5 @@
#-----ServiceModule-----
-keep class com.mogo.module.service.carinfo.CarStateInfo{*;}
-keep class com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo{*;}
-keep class com.mogo.module.service.launchercard.LauncherCardRefreshType{*;}
-keep class com.mogo.module.service.network.bean.*{*;}
-keep class com.mogo.module.service.network.RefreshBody{*;}

View File

@@ -21,7 +21,7 @@
#-renamesourcefileattribute SourceFile
#-----ServiceModule-----
-keep class com.mogo.module.service.carinfo.CarStateInfo.*{*;}
-keep class com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo.*{*;}
-keep class com.mogo.module.service.network.RefreshBody.*{*;}
-keep class com.mogo.module.service.network.bean.DemoUserInfoEntity.*{*;}
-keep interface com.mogo.module.service.intent.IntentHandler

View File

@@ -53,7 +53,7 @@ import com.mogo.module.service.ttsConfig.TtsConfigModleData;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.adas.IMogoAdasCarDataCallback;
import com.mogo.service.adas.entity.ADASCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
@@ -970,7 +970,7 @@ public class MogoServices implements IMogoMapListener,
}
@Override
public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) {
public void onAdasCarDataCallback( AutopilotCarStateInfo stateInfo ) {
if(TimeDelayUploadManager.getInstance().isMock()){ //模拟数据时,不更新由工控机传输的自车位置
return;

View File

@@ -2,7 +2,7 @@ package com.mogo.module.service.autopilot;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.cloud.socket.IMogoSocketManager;
import com.mogo.utils.logger.Logger;
@@ -23,14 +23,14 @@ class AutoPilotRemoteController {
private IMogoSocketManager mMogoSocketManager;
private IMogoOnMessageListener<AutoPilotControlParameters> mParametersListener = new IMogoOnMessageListener<AutoPilotControlParameters>() {
private IMogoOnMessageListener<AutopilotControlParameters> mParametersListener = new IMogoOnMessageListener<AutopilotControlParameters>() {
@Override
public Class<AutoPilotControlParameters> target() {
return AutoPilotControlParameters.class;
public Class<AutopilotControlParameters> target() {
return AutopilotControlParameters.class;
}
@Override
public void onMsgReceived( AutoPilotControlParameters obj ) {
public void onMsgReceived( AutopilotControlParameters obj ) {
if ( obj == null ) {
Logger.e( TAG, "远端控制参数为null", new NullPointerException() );
return;

View File

@@ -1,142 +0,0 @@
package com.mogo.module.service.carinfo;
import java.io.Serializable;
/**
* @author nie yunlong
* @des 车辆状态
* @date 2020/3/12
*/
public class CarStateInfo implements Serializable {
/**
* action : “state”
* values : {"lon":116.8,"lat":39.4,"alt":22.3,"heading":87.5,"acceleration":0.5,"yaw_rate":0.3}
*/
private String action;
private ValuesBean values;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public ValuesBean getValues() {
return values;
}
public void setValues(ValuesBean values) {
this.values = values;
}
public static class ValuesBean {
/**
* lon : 116.8
* lat : 39.4
* alt : 22.3
* heading : 87.5
* acceleration : 0.5
* yaw_rate : 0.3
*/
private double lon;
private double lat;
private double alt;
private double heading;
private double acceleration;
private double yaw_rate;
//惯导车速 m/s
private float gnss_speed;
//gps 时间
private String satelliteTime;
public float getGnss_speed() {
return gnss_speed;
}
public void setGnss_speed( float gnss_speed ) {
this.gnss_speed = gnss_speed;
}
public String getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime( String satelliteTime ) {
this.satelliteTime = satelliteTime;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getAlt() {
return alt;
}
public void setAlt(double alt) {
this.alt = alt;
}
public double getHeading() {
return heading;
}
public void setHeading(double heading) {
this.heading = heading;
}
public double getAcceleration() {
return acceleration;
}
public void setAcceleration(double acceleration) {
this.acceleration = acceleration;
}
public double getYaw_rate() {
return yaw_rate;
}
public void setYaw_rate(double yaw_rate) {
this.yaw_rate = yaw_rate;
}
@Override
public String toString() {
return "ValuesBean{" +
"lon=" + lon +
", lat=" + lat +
", alt=" + alt +
", heading=" + heading +
", acceleration=" + acceleration +
", yaw_rate=" + yaw_rate +
'}';
}
}
@Override
public String toString() {
return "CarStateInfo{" +
"action='" + action + '\'' +
", values=" + values +
'}';
}
}

View File

@@ -10,8 +10,8 @@ import android.os.Handler;
import android.os.Message;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager;
@@ -137,17 +137,17 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
}
private void startAutoPilot() {
AutoPilotControlParameters currentAutopilot = new AutoPilotControlParameters();
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
currentAutopilot.isSpeakVoice = false;
List<AutoPilotControlParameters.AutoPilotLonLat> wayLatLon = new ArrayList<>();
List<AutopilotControlParameters.AutoPilotLonLat> wayLatLon = new ArrayList<>();
if (receiverBean!=null && receiverBean.getStopsList()!= null){
for (MogoLatLng mogoLatLng : receiverBean.getStopsList()) {
wayLatLon.add(new AutoPilotControlParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon));
wayLatLon.add(new AutopilotControlParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon));
}
}
currentAutopilot.wayLatLons = wayLatLon;
currentAutopilot.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
currentAutopilot.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
currentAutopilot.vehicleType = 10;
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
mApis.getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
@@ -191,10 +191,10 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener<Dispatch
}
@Override
public void onArriveAt(AutoPilotStationInfo data) {
public void onArriveAt(AutopilotStationInfo data) {
Logger.d(TAG, "onArriveAt data : " + data.toString());
double endLat = data.lat;
double endLon = data.lon;
double endLat = data.getLat();
double endLon = data.getLon();
// 计算是不是到了终点
float distanceFromSelf = CoordinateUtils.calculateLineDistance(receiverBean.getEndLon(), receiverBean.getEndLat()
, endLon, endLat);

View File

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

View File

@@ -1,75 +0,0 @@
package com.mogo.module.service.dispatch.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* @author song kenan
* @des
* @date 2021/6/21
*/
public class AutopilotRoute {
@SerializedName("action")
private String action;
@SerializedName("models")
private List<RouteModels> models;
public static class RouteModels {
@SerializedName("lat")
private Double lat;
@SerializedName("lon")
private Double lon;
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLon() {
return lon;
}
public void setLon(Double lon) {
this.lon = lon;
}
@Override
public String toString() {
return "RouteModels{" +
"lat=" + lat +
", lon=" + lon +
'}';
}
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public List<RouteModels> getModels() {
return models;
}
public void setModels(List<RouteModels> models) {
this.models = models;
}
@Override
public String toString() {
return "AutopilotRoute{" +
"action='" + action + '\'' +
", models=" + models +
'}';
}
}

View File

@@ -1,108 +0,0 @@
package com.mogo.module.service.dispatch.bean;
import java.io.Serializable;
/**
* @author nie yunlong
* @des
* @date 2020/7/14
*/
public class AutopilotStatus implements Serializable {
/**
* action : autopilotstate
* values : {"state":0,"reason":""}
*/
private String action;
private ValuesBean values;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public ValuesBean getValues() {
return values;
}
public void setValues(ValuesBean values) {
this.values = values;
}
public static class ValuesBean {
/**
* 0是不可用 1是ready 2是自动驾驶start
*
* @return
*/
private int state;
/**
* 车速 m/s
*/
private float speed;
/**
* 不可用原因
*/
private String reason;
/**
* 摄像头状态 1代表开启0代表关闭
*/
private int camera;
/**
* 雷达状态 1代表开启0代表关闭
*/
private int radar;
/**
* RTK状态 1代表开启0代表关闭
*/
private int rtk;
/**
* 自动驾驶状态 0非自动驾驶1自动驾驶
*/
private int pilotmode;
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public float getSpeed() {
return speed;
}
public void setSpeed(float speed) {
this.speed = speed;
}
public int getCamera() {
return camera;
}
public int getRadar() {
return radar;
}
public int getRtk() {
return rtk;
}
public int getPilotmode() {
return pilotmode;
}
}
}

View File

@@ -1,38 +0,0 @@
package com.mogo.module.service.dispatch.bean;
import com.mogo.module.service.dispatch.model.DispatchResult;
public class DispatchData {
private String action;
private DispatchResult result;
public DispatchData(String action, DispatchResult result) {
this.action = action;
this.result = result;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public DispatchResult getResult() {
return result;
}
public void setResult(DispatchResult result) {
this.result = result;
}
@Override
public String toString() {
return "DispatchData{" +
"action='" + action + '\'' +
", result=" + result +
'}';
}
}

View File

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

View File

@@ -1,6 +1,8 @@
package com.mogo.module.service.dispatch.bean;
import com.mogo.eagle.core.data.autopilot.AutopilotStatus;
/**
* 上报自动驾驶规划的路径
*/

View File

@@ -1,39 +0,0 @@
package com.mogo.module.service.dispatch.model;
import com.mogo.module.service.dispatch.bean.EndLatLon;
import com.mogo.module.service.dispatch.bean.StartLatLon;
public class DispatchResult {
private StartLatLon startLatLon;
private EndLatLon endLatLon;
public DispatchResult(StartLatLon startLatLon, EndLatLon endLatLon) {
this.startLatLon = startLatLon;
this.endLatLon = endLatLon;
}
public StartLatLon getStartLatLon() {
return startLatLon;
}
public void setStartLatLon(StartLatLon startLatLon) {
this.startLatLon = startLatLon;
}
public EndLatLon getEndLatLon() {
return endLatLon;
}
public void setEndLatLon(EndLatLon endLatLon) {
this.endLatLon = endLatLon;
}
@Override
public String toString() {
return "DispatchResult{" +
"startLatLon=" + startLatLon +
", endLatLon=" + endLatLon +
'}';
}
}

View File

@@ -7,8 +7,8 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.service.dispatch.bean.AutopilotRoute;
import com.mogo.module.service.dispatch.bean.AutopilotStatus;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatus;
import com.mogo.module.service.dispatch.bean.ReportDispatchResult;
import com.mogo.module.service.dispatch.bean.ReportedRoute;
import com.mogo.utils.logger.Logger;
@@ -93,7 +93,7 @@ public class DispatchServiceModel {
*
* @param list 路线集合
*/
public void uploadAutopilotRoute(List<AutopilotRoute.RouteModels> list) {
public void uploadAutopilotRoute(List<AutopilotRouteInfo.RouteModels> list) {
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
ReportedRoute reportedRoute = new ReportedRoute(sn, GsonUtil.jsonFromObject(list));
Map<String, Object> map = new HashMap<>();

View File

@@ -4,24 +4,23 @@ import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.carinfo.CarStateInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import org.json.JSONObject;
public
/**
* @author congtaowang
* @since 2020/6/5
* <p>
* 描述
*/
class ADASStatusIntentHandler implements IntentHandler {
public class ADASStatusIntentHandler implements IntentHandler {
private static volatile ADASStatusIntentHandler sInstance;
@@ -29,9 +28,9 @@ class ADASStatusIntentHandler implements IntentHandler {
}
public static ADASStatusIntentHandler getInstance() {
if ( sInstance == null ) {
synchronized ( ADASStatusIntentHandler.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (ADASStatusIntentHandler.class) {
if (sInstance == null) {
sInstance = new ADASStatusIntentHandler();
}
}
@@ -44,38 +43,40 @@ class ADASStatusIntentHandler implements IntentHandler {
}
@Override
public void handle( Context context, Intent intent ) {
if ( intent == null ) {
public void handle(Context context, Intent intent) {
if (intent == null) {
return;
}
if ( MogoReceiver.ACTIION_ADAS.equals( intent.getAction() ) ) {
if (MogoReceiver.ACTIION_ADAS.equals(intent.getAction())) {
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 );
int status = intent.getIntExtra(MogoReceiver.PARAM_ADAS_STATUS, 0);
MarkerServiceHandler.getMogoStatusManager().setADASUIShow(ServiceConst.TYPE, status == 1);
}
// 由于adas可能调高此处的调用频率存在anr风险且此处没有作用所以暂时注释掉
else {
String msg = intent.getStringExtra( "adasMsg" );
if ( TextUtils.isEmpty( msg ) ) {
String msg = intent.getStringExtra("adasMsg");
if (TextUtils.isEmpty(msg)) {
return;
}
Logger.d( "ADASCOOR", msg );
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
if ( stateInfo != null && stateInfo.getValues() != null ) {
Logger.d("ADAS COOR", msg);
AutopilotCarStateInfo stateInfo = GsonUtil.objectFromJson(msg, AutopilotCarStateInfo.class);
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( "satelliteTime", stateInfo.getValues().getSatelliteTime() );
data.putOpt( "heading", stateInfo.getValues().getHeading() );
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
} catch ( Exception e ) {
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("satelliteTime", stateInfo.getValues().getSatelliteTime());
data.putOpt("heading", stateInfo.getValues().getHeading());
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
} catch (Exception e) {
e.printStackTrace();
}
}

View File

@@ -18,8 +18,9 @@ import com.mogo.cloud.socket.entity.SocketDownDataHelper;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.navi.IMogoNaviListener;
@@ -39,8 +40,7 @@ import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.module.service.status.EnvStatusManager;
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
import com.mogo.service.adas.entity.ADASCarStateInfo;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
@@ -492,17 +492,17 @@ public class MockIntentHandler implements IntentHandler {
InputStream is = context.getAssets().open("coors.json");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = "";
List<ADASCarStateInfo> vals = new ArrayList<>();
List<AutopilotCarStateInfo> vals = new ArrayList<>();
while ((line = br.readLine()) != null) {
String[] json = line.split(" - ");
long time = Long.parseLong(json[0]);
ADASCarStateInfo si = GsonUtil.objectFromJson(json[1], ADASCarStateInfo.class);
AutopilotCarStateInfo si = GsonUtil.objectFromJson(json[1], AutopilotCarStateInfo.class);
// si.getValues().setSatelliteTime( time + "" );
vals.add(si);
}
long interval = -1;
ADASCarStateInfo last = null;
for (ADASCarStateInfo val : vals) {
AutopilotCarStateInfo last = null;
for (AutopilotCarStateInfo val : vals) {
if (last == null) {
interval = 0;
} else {
@@ -523,10 +523,10 @@ public class MockIntentHandler implements IntentHandler {
.onAutopilotArriveLike(intent.getIntExtra("type", 8));
break;
case 44:// 控制自动驾驶
AutoPilotControlParameters parameters = new AutoPilotControlParameters();
AutopilotControlParameters parameters = new AutopilotControlParameters();
parameters.vehicleType = 9;
parameters.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.1690522746, 116.567374558);
parameters.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.1651999405, 116.567217441);
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1690522746, 116.567374558);
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1651999405, 116.567217441);
MogoApisHandler.getInstance()
.getApis()
.getAdasControllerApi()
@@ -664,7 +664,7 @@ public class MockIntentHandler implements IntentHandler {
}
public void onAdasCarDataCallback(ADASCarStateInfo stateInfo) {
public void onAdasCarDataCallback(AutopilotCarStateInfo stateInfo) {
if (stateInfo != null && stateInfo.getValues() != null) {
JSONObject data = new JSONObject();
try {
@@ -905,10 +905,10 @@ public class MockIntentHandler implements IntentHandler {
}
}
List<ADASRecognizedResult> allList = new ArrayList<>();
List<TrafficData> allList = new ArrayList<>();
for (BufferedReader reader : readers) {
String line = reader.readLine();
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class);
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);
if (adasRecognizedResult != null) {
allList.add(adasRecognizedResult);
}
@@ -932,10 +932,10 @@ public class MockIntentHandler implements IntentHandler {
}
}
List<ADASRecognizedResult> allList = new ArrayList<>();
List<TrafficData> allList = new ArrayList<>();
for (BufferedReader reader : readers2) {
String line = reader.readLine();
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class);
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);
if (adasRecognizedResult != null) {
allList.add(adasRecognizedResult);
}