fix bug of delay and update map version
This commit is contained in:
0
app/src/main/java/com/mogo/launcher/delayLog
Normal file
0
app/src/main/java/com/mogo/launcher/delayLog
Normal file
@@ -250,6 +250,7 @@ ext {
|
||||
mogoaicloudrealtime : "com.mogo.cloud:realtime:${MOGO_REALTIME_VERSION}",
|
||||
mogoaicloudtanlu : "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}",
|
||||
mogoaicloudtrafficlive : "com.mogo.cloud:trafficlive:${MOGO_TRAFFICLIVE_VERSION}",
|
||||
mogoaicloudlocation : "com.mogo.cloud:location:${MOGO_LOCATION_VERSION}",
|
||||
]
|
||||
|
||||
}
|
||||
@@ -28,9 +28,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation rootProject.ext.dependencies.mogoaicloudsocket
|
||||
|
||||
// 上报位置
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7'
|
||||
implementation rootProject.ext.dependencies.mogoaicloudlocation
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -4,22 +4,13 @@ import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.cloud.location.LocationManager;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.locupload.LocUploadConfig;
|
||||
import com.zhidao.locupload.LocUploadManager;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务
|
||||
*/
|
||||
@Keep
|
||||
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
public class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-sdk";
|
||||
|
||||
@@ -31,9 +22,9 @@ class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
@Keep
|
||||
public static MogoLocationInfoServices getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationInfoServices.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoLocationInfoServices.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoLocationInfoServices();
|
||||
}
|
||||
}
|
||||
@@ -46,9 +37,9 @@ class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation( MogoLocation location ) {
|
||||
public void provideLocation(MogoLocation location) {
|
||||
mLocation = location;
|
||||
Logger.d( TAG, "sdk - provideLocation" );
|
||||
Logger.d(TAG, "sdk - provideLocation");
|
||||
}
|
||||
|
||||
public MogoLocation getLocation() {
|
||||
@@ -57,23 +48,19 @@ class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
LocUploadManager.getInstance().startUpload();
|
||||
Logger.d( TAG, "sdk - start" );
|
||||
LocationManager.getInstance().start();
|
||||
Logger.d(TAG, "sdk - start");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
LocUploadManager.getInstance().stopUpload();
|
||||
Logger.d( TAG, "sdk - stop" );
|
||||
LocationManager.getInstance().stop();
|
||||
Logger.d(TAG, "sdk - stop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
LocUploadConfig.instance().
|
||||
setAppId( DebugConfig.getSocketAppId() ).
|
||||
setContext( context.getApplicationContext() ).
|
||||
setLoggable( DebugConfig.isDebug() ).
|
||||
setLocInterval( 2000L );
|
||||
Logger.d( TAG, "sdk - init" );
|
||||
public void init(Context context) {
|
||||
LocationManager.getInstance().init(context);
|
||||
Logger.d(TAG, "sdk - init");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,19 +3,12 @@ package com.mogo.aicloud.services.locationinfo;
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.zhidao.locupload.location.LocationServiceProvider;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Service( value = LocationServiceProvider.class )
|
||||
class MogoLocationSource extends LocationServiceProvider {
|
||||
@Service(value = LocationServiceProvider.class)
|
||||
public class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getBearing();
|
||||
}
|
||||
return 0;
|
||||
@@ -23,7 +16,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAccuracy();
|
||||
}
|
||||
return 0;
|
||||
@@ -31,7 +24,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getProvider();
|
||||
}
|
||||
return null;
|
||||
@@ -39,7 +32,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSpeed();
|
||||
}
|
||||
return 0;
|
||||
@@ -47,7 +40,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAltitude();
|
||||
}
|
||||
return 0;
|
||||
@@ -55,7 +48,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public String getAdCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAdCode();
|
||||
}
|
||||
return null;
|
||||
@@ -63,7 +56,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public int getLocType() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLocType();
|
||||
}
|
||||
return 0;
|
||||
@@ -71,7 +64,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLatitude();
|
||||
}
|
||||
return 0;
|
||||
@@ -79,7 +72,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLongitude();
|
||||
}
|
||||
return 0;
|
||||
@@ -87,7 +80,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getTime();
|
||||
}
|
||||
return 0;
|
||||
@@ -95,7 +88,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityCode();
|
||||
}
|
||||
return null;
|
||||
@@ -103,7 +96,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public String getCityName() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityName();
|
||||
}
|
||||
return null;
|
||||
@@ -111,7 +104,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public int getGpsAccuracyStatus() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getGpsAccuracyStatus();
|
||||
}
|
||||
return 0;
|
||||
@@ -119,7 +112,7 @@ class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public int getSatellites() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
if (MogoLocationInfoServices.getInstance().getLocation() != null) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSatellite();
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -158,21 +158,22 @@ LOGLIB_VERSION = 1.0.4
|
||||
|
||||
######## MogoAiCloudSDK Version
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.1.18
|
||||
MOGO_NETWORK_VERSION=1.1.21
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.1.18
|
||||
MOGO_PASSPORT_VERSION=1.1.21
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.1.18
|
||||
MOGO_SOCKET_VERSION=1.1.21
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.1.18
|
||||
MOGO_REALTIME_VERSION=1.1.21
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.1.18
|
||||
MOGO_TANLU_VERSION=1.1.21
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.1.18
|
||||
MOGO_LIVE_VERSION=1.1.21
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.1.18
|
||||
#ADAS HIGHT
|
||||
MOGO_ADASHIGH_VERSION=1.1.3
|
||||
MOGO_TRAFFICLIVE_VERSION=1.1.21
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.1.21
|
||||
|
||||
|
||||
######## Foundation MogoAiCloud Module
|
||||
# mogoAiCloud apk services
|
||||
@@ -180,7 +181,7 @@ MOGO_AICLOUD_SERVICES_APK_VERSION=1.0.0-SNAPSHOT
|
||||
# mogoAiCloud sdk services
|
||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
|
||||
# 自研地图
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.64
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.66
|
||||
|
||||
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
|
||||
@@ -95,7 +95,7 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
Log.d(TAG,"setDebugMode==true");
|
||||
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
.setDebugMode( true )
|
||||
.setDebugMode( DebugConfig.isDebug() )
|
||||
.setDataFileSource(1) //todo 1-使用本地地图数据,0-使用在线地图数据
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
import com.mogo.module.adas.entity.WarnMessageModel;
|
||||
import com.mogo.module.adas.model.AdasServiceModel;
|
||||
import com.mogo.module.adas.network.IAdasApiService;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
@@ -34,10 +29,7 @@ import io.reactivex.Flowable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
import static com.mogo.module.adas.AdasConstant.getBaseUrl;
|
||||
|
||||
/**
|
||||
@@ -53,7 +45,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
private final Gson gson;
|
||||
private final ArrayList<IAdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
private final ArrayList<IAdasStatusListener> iAdasStatusListeners = new ArrayList<>();
|
||||
private final IAdasApiService mAdasApiService;
|
||||
private Disposable uploadAutopilotStatus;
|
||||
//自动驾驶状态
|
||||
private int mCurrentAutopilotStatus = -1;
|
||||
@@ -67,7 +58,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
|
||||
private AdasEventManager() {
|
||||
gson = GsonUtil.getGson();
|
||||
mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IAdasApiService.class, getBaseUrl());
|
||||
}
|
||||
|
||||
public static AdasEventManager getInstance() {
|
||||
@@ -116,15 +106,9 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
Logger.d(TAG, "onWarnMessage " + warnMessageInfo);
|
||||
//报警model
|
||||
WarnMessageModel warnMessageModel = null;
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
if (warnMessageModel == null) {
|
||||
warnMessageModel = new WarnMessageModel();
|
||||
warnMessageModel.setAction(MsgActionType.ACTION_WS_MSG_WARNING_TYPE.getmActionType());
|
||||
}
|
||||
warnMessageModel.setValues(warnMessageInfo);
|
||||
listener.cameraEyeDetectResult(gson.toJson(warnMessageModel));
|
||||
listener.onWarnMessage(warnMessageInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +128,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
try {
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.cameraEyeDetectResult(gson.toJson(rectInfo));
|
||||
listener.onRectData(rectInfo);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -236,10 +220,10 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
@Override
|
||||
public void onAutopilotRoute(AutopilotRoute autopilotRoute) {
|
||||
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
|
||||
Logger.d(TAG,"onAutopilotRoute is null !");
|
||||
Logger.d(TAG, "onAutopilotRoute is null !");
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG,"onAutopilotRoute : " + autopilotRoute.toString());
|
||||
Logger.d(TAG, "onAutopilotRoute : " + autopilotRoute.toString());
|
||||
for (IAdasDataListener listener : iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotRoute(autopilotRoute);
|
||||
@@ -283,56 +267,14 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
}
|
||||
|
||||
private void updateDriveStatus() {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, mCurrentAutopilotStatus, mCurrentAutopilotSpeed);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mAdasApiService.updateAutonomousDriveStatus(requestBody).
|
||||
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "updateDriveStatus success");
|
||||
}
|
||||
});
|
||||
AdasServiceModel.getInstance().updateDriveStatus(mCurrentAutopilotStatus, mCurrentAutopilotSpeed);
|
||||
}
|
||||
|
||||
private void reportSite(double lon, double lat) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
|
||||
mAdasApiService.updateReportSite(requestBody).
|
||||
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "autopilotArrive success");
|
||||
}
|
||||
});
|
||||
AdasServiceModel.getInstance().reportSite(lon, lat);
|
||||
}
|
||||
|
||||
public AutopilotStatus.ValuesBean getAutopilotValuesStatus(){
|
||||
public AutopilotStatus.ValuesBean getAutopilotValuesStatus() {
|
||||
return mAutopilotValuesStatus;
|
||||
}
|
||||
|
||||
@@ -346,7 +288,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
return adasAIDLAutopilotStateModel;
|
||||
}
|
||||
|
||||
public void setProviderBizListener(IAdasProviderBizListener listener){
|
||||
public void setProviderBizListener(IAdasProviderBizListener listener) {
|
||||
providerBizListener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.mogo.module.adas.entity.WarnMessageModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 16:52
|
||||
*/
|
||||
|
||||
public interface IAdasDataListener {
|
||||
|
||||
default void sendMsg( String msg ){
|
||||
default void sendMsg(String msg) {
|
||||
|
||||
};
|
||||
|
||||
default void cameraEyeDetectResult( String detectResult ) {
|
||||
}
|
||||
|
||||
default void selectCarModelUrl( String carStyleUrl ) {
|
||||
default void onRectData(RectInfo rectInfo) {
|
||||
|
||||
}
|
||||
|
||||
default void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
|
||||
}
|
||||
|
||||
default void selectCarModelUrl(String carStyleUrl) {
|
||||
}
|
||||
|
||||
default void requestGetCarModelListInfo() {
|
||||
@@ -38,42 +35,41 @@ public interface IAdasDataListener {
|
||||
default void clickSettingBack() {
|
||||
}
|
||||
|
||||
default void showToast( String msg ) {
|
||||
default void showToast(String msg) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶到达站点回调接口
|
||||
*
|
||||
* @param autopilotArriveModel
|
||||
*/
|
||||
default void autopilotArrive( AdasAIDLAutopilotArriveModel autopilotArriveModel ) {
|
||||
default void autopilotArrive(AdasAIDLAutopilotArriveModel autopilotArriveModel) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶路线回调
|
||||
*
|
||||
* @param autopilotRoute {@link AutopilotRoute}
|
||||
*/
|
||||
default void autopilotRoute(AutopilotRoute autopilotRoute){
|
||||
default void autopilotRoute(AutopilotRoute autopilotRoute) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*
|
||||
* @param ownerCarStateInfo
|
||||
*/
|
||||
default void ownerCarStateInfo( String ownerCarStateInfo ) {
|
||||
}
|
||||
|
||||
default void notifyOwnerCarState( AdasAIDLOwnerCarStateModel ownerCarStateModel ) {
|
||||
default void ownerCarStateInfo(String ownerCarStateInfo) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
*
|
||||
* @param autopilotStatus {@link AutopilotStatus}
|
||||
*/
|
||||
default void notifyAutopilotState( AutopilotStatus autopilotStatus ) {
|
||||
default void notifyAutopilotState(AutopilotStatus autopilotStatus) {
|
||||
}
|
||||
|
||||
default void notifyOwnerCarRect( List<AdasAIDLOwnerCarRectModel> ownerCarStateRectList ) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.mogo.module.adas.model;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportDispatchResult;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
import com.mogo.module.adas.entity.ReportedRoute;
|
||||
import com.mogo.module.adas.network.IAdasApiService;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -14,16 +15,16 @@ import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.adas.AdasConstant.getBaseUrl;
|
||||
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
|
||||
|
||||
public class AdasServiceModel {
|
||||
@@ -126,7 +127,7 @@ public class AdasServiceModel {
|
||||
*
|
||||
* @param dispatchResultType int
|
||||
*/
|
||||
public void dispatchResultUpload(int dispatchResultType,IDispatch dispatch) {
|
||||
public void dispatchResultUpload(int dispatchResultType, IDispatch dispatch) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportDispatchResult reportDispatchResult = new ReportDispatchResult(sn, dispatchResultType);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -157,4 +158,54 @@ public class AdasServiceModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateDriveStatus(int autoPilotStatus, float autoPilotSpeed) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, autoPilotStatus, autoPilotSpeed);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mAdasApiService.updateAutonomousDriveStatus(requestBody).
|
||||
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "updateDriveStatus success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void reportSite(double lon, double lat){
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(reportSiteBean));
|
||||
mAdasApiService.updateReportSite(requestBody).
|
||||
subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
|
||||
@@ -76,6 +77,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* @param resultList
|
||||
*/
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
final long start = System.nanoTime();
|
||||
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
@@ -100,7 +102,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(true, marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
@@ -110,9 +112,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
|
||||
Log.d("ADAS数据延时绘制", "查找缓存绘制 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// 复用过期 marker
|
||||
if (newDiffSetSize > 0) {
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
@@ -122,14 +124,15 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
// Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
renderAdasOneFrame(false, marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
Log.d(TAG, "更新缓存marker, size : " + mMarkersCaches.size());
|
||||
// Log.d(TAG, "更新缓存marker, size : " + mMarkersCaches.size());
|
||||
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,9 +248,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult recognizedListResult,
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||
final long start = System.nanoTime();
|
||||
// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
@@ -264,7 +266,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// if (useCache) {
|
||||
Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||
@@ -286,9 +288,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, recognizedListResult.heading, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
}
|
||||
// if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
// showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, recognizedListResult.heading, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// }
|
||||
Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +301,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
|
||||
long start = System.nanoTime();
|
||||
if (recognizedListResult == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -322,6 +326,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.position(new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon));
|
||||
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)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,45 +211,8 @@ class BaseDrawer {
|
||||
// AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
// if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// }
|
||||
// 距离策略 todo 此处两种策略是临时方案
|
||||
// double[] coordinates = getCurCoordinates();
|
||||
// double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
|
||||
// if (distance < 15) {
|
||||
// return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
// } else if (distance < 50 && distance >= 15) {
|
||||
// return Car3DModelColor.Warming.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
// }
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
// double curSpeed = getCurSpeed();
|
||||
// if (curSpeed > 0 && speed > curSpeed) {
|
||||
// double rate = ((speed - curSpeed) / curSpeed) * 100;
|
||||
// if (rate >= 50) {
|
||||
// return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
// } else if (rate > 10 && rate < 50) {
|
||||
// return Car3DModelColor.Warming.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
// }
|
||||
// }
|
||||
|
||||
// 默认颜色 // todo 方案1
|
||||
// switch (fromType) {
|
||||
// case FROM_ADAS:
|
||||
// return Car3DModelColor.Normal_Visual.color;
|
||||
// case FROM_ROAD_UNIT:
|
||||
// return Car3DModelColor.Normal_Cloud.color;
|
||||
// default:
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// }
|
||||
return Car3DModelColor.Normal.color;
|
||||
// todo 方案2
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Normal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -341,7 +341,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime(duration);
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker(TAG, options);
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
if(!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()){
|
||||
if (!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()) {
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter(mogoLatLngs.get(0));
|
||||
}
|
||||
WorkThreadHandler.getInstance().post(() -> marker.startSmooth(mogoLatLngs, duration));
|
||||
@@ -652,7 +652,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
String carsLine = roadSizeBr.readLine();
|
||||
SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
List<SocketDownData.CloudRoadDataProto> allList = GsonUtil.arrayFromJson(carsLine, SocketDownData.CloudRoadDataProto.class);
|
||||
if(allList == null || allList.size() == 0){
|
||||
if (allList == null || allList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allList) {
|
||||
@@ -854,7 +854,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i("mock-timer-loc-info",jo.toString());
|
||||
Log.i("mock-timer-loc-info", jo.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -917,10 +917,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
}
|
||||
|
||||
AdasRec adasRec = new AdasRec();
|
||||
adasRec.models = allList;
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(GsonUtil.jsonFromObject(adasRec));
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(allList);
|
||||
Log.i("mock-timer-adas", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
return true;
|
||||
}
|
||||
@@ -947,16 +944,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
}
|
||||
|
||||
AdasRec adasRec = new AdasRec();
|
||||
adasRec.models = allList;
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(GsonUtil.jsonFromObject(adasRec));
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized(allList);
|
||||
Log.i("mock-timer-adas", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class AdasRec {
|
||||
public String action = "view";
|
||||
public List<ADASRecognizedResult> models;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,13 +108,6 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
void removeAdasWarnMessageCallback(IMogoAdasWarnMessageCallback callback);
|
||||
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||
|
||||
/**
|
||||
* 添加adas识别物体回调
|
||||
*
|
||||
@@ -213,5 +206,4 @@ public interface IMogoADASController extends IProvider {
|
||||
|
||||
void mockAdasRecognized(List<ADASRecognizedResult> recognizedResults);
|
||||
|
||||
void mockAdasRecognized(String json);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.utils.MortonCode;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/*
|
||||
@@ -37,12 +40,12 @@ public class AdasObjectUtils {
|
||||
return warnMessage;
|
||||
}
|
||||
|
||||
public static List<ADASRecognizedResult> regroupData(List<AdasAIDLOwnerCarRectModel> datums) {
|
||||
public static List<ADASRecognizedResult> regroupData(List<RectInfo.RectBean> datums) {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<ADASRecognizedResult> recognizedListResults = new ArrayList<>();
|
||||
for (AdasAIDLOwnerCarRectModel model : datums) {
|
||||
for (RectInfo.RectBean model : datums) {
|
||||
if (model == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -54,10 +57,12 @@ public class AdasObjectUtils {
|
||||
return recognizedListResults;
|
||||
}
|
||||
|
||||
public static ADASRecognizedResult fromAdasObject(AdasAIDLOwnerCarRectModel model) {
|
||||
public static ADASRecognizedResult fromAdasObject(RectInfo.RectBean model) {
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
long start = System.nanoTime();
|
||||
ADASRecognizedResult result = new ADASRecognizedResult();
|
||||
result.uuid = model.getUuid();
|
||||
result.lat = model.getLat();
|
||||
@@ -73,11 +78,14 @@ public class AdasObjectUtils {
|
||||
result.dataAccuracy = model.dataAccuracy;
|
||||
result.distance = model.distance;
|
||||
result.drawlevel = model.getDrawlevel();
|
||||
result.mortonCode = MortonCode.wrapEncodeMorton(result.lon, result.lat);
|
||||
IMogoMapUIController mogoMapUIController = ARouter.getInstance().navigation(IMogoServiceApis.class).getMapServiceApi().getMapUIController();
|
||||
if (mogoMapUIController != null) {
|
||||
result.tileId = String.valueOf(mogoMapUIController.getTileId(result.lon, result.lat));
|
||||
}
|
||||
// result.mortonCode = MortonCode.wrapEncodeMorton(result.lon, result.lat);
|
||||
Log.d("ADAS数据延时","fromAdasObject cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
// IMogoMapUIController mogoMapUIController = ARouter.getInstance().navigation(IMogoServiceApis.class).getMapServiceApi().getMapUIController();
|
||||
// if (mogoMapUIController != null) {
|
||||
// long start = System.currentTimeMillis();
|
||||
// result.tileId = String.valueOf(mogoMapUIController.getTileId(result.lon, result.lat));
|
||||
// Log.d("ADAS数据延时", "getTileId 耗时 : " + (System.currentTimeMillis() - start) + "ms");
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.adas.AdasProvider;
|
||||
import com.mogo.module.adas.IAdasStatusListener;
|
||||
import com.mogo.module.adas.IAdasDataListener;
|
||||
import com.mogo.module.adas.IAdasStatusListener;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
@@ -50,15 +50,11 @@ import com.zhidao.adasconfig.common.config.EnumCarHeading;
|
||||
import com.zhidao.adasconfig.common.config.EnumSkinStyle;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
|
||||
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.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.msg.MyMessageFactory;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -66,15 +62,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_ADAS_CONTROLLER)
|
||||
public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@@ -94,10 +85,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private boolean mIsReleased = true;
|
||||
|
||||
private IAdasDataListener mAdasDataListener;
|
||||
private AdasProvider adasProvider;
|
||||
|
||||
|
||||
/**
|
||||
* 获取adas前车距离
|
||||
*/
|
||||
@@ -118,24 +107,33 @@ public class MogoADASController implements IMogoADASController {
|
||||
*/
|
||||
private final List<IMogoAdasRouteCallBack> mMogoAdasRouteCallBacks = new CopyOnWriteArrayList<>();
|
||||
|
||||
private IAdasDataListener mAdasDataListener;
|
||||
|
||||
private IMogoAdasCarDataCallback mMogoAdasCarDataCallback;
|
||||
|
||||
private List<AdasAIDLOwnerCarRectModel> mLastFrameDatums;
|
||||
private IMogoAdasOCHCallback mAdasOCHCallback;
|
||||
|
||||
/**
|
||||
* 接收 adas 识别数据线程
|
||||
*/
|
||||
private final Handler mAdasRecognizedRecHandler = new Handler(WorkThreadHandler.newInstance("AdasRecognizedRecThread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.obj instanceof List) {
|
||||
mAdasDataListener.notifyOwnerCarRect((List<AdasAIDLOwnerCarRectModel>) msg.obj);
|
||||
} else if (msg.obj == null) {
|
||||
mAdasDataListener.notifyOwnerCarRect(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
private double mLastLon;
|
||||
private double mLastLat;
|
||||
private double mSpeed;
|
||||
private String satelliteTime;
|
||||
|
||||
@Override
|
||||
public double getLastSpeed() {
|
||||
return mSpeed;
|
||||
}
|
||||
|
||||
public double getLastLat() {
|
||||
return mLastLat;
|
||||
}
|
||||
|
||||
public double getLastLon() {
|
||||
return mLastLon;
|
||||
}
|
||||
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收 adas 定位数据线程
|
||||
@@ -160,6 +158,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
mLastLon = stateInfo.getValues().getLon();
|
||||
mLastLat = stateInfo.getValues().getLat();
|
||||
mSpeed = stateInfo.getValues().getGnss_speed();
|
||||
// satelliteTime = stateInfo.getValues().getSatelliteTime();
|
||||
satelliteTime = stateInfo.getValues().getSystemTime();
|
||||
if (mMogoAdasCarDataCallback != null) {
|
||||
@@ -169,116 +168,12 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
};
|
||||
|
||||
private final OnAdasListener mOnAdasListener = new OnAdasListenerAdapter() {
|
||||
|
||||
@Override
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
|
||||
List<AdasAIDLOwnerCarRectModel> data = new ArrayList<>();
|
||||
if (rectInfo != null && rectInfo.getModels() != null && !rectInfo.getModels().isEmpty()) {
|
||||
List<RectInfo.RectBean> beans = rectInfo.getModels();
|
||||
for (RectInfo.RectBean bean : beans) {
|
||||
if (bean == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AdasAIDLOwnerCarRectModel model = new AdasAIDLOwnerCarRectModel();
|
||||
model.setId(bean.getId());
|
||||
model.setXl(bean.getXl());
|
||||
model.setXr(bean.getXr());
|
||||
model.setYb(bean.getYb());
|
||||
model.setYt(bean.getYt());
|
||||
model.setDistance_x(bean.getDistance_x());
|
||||
model.setDistance_y(bean.getDistance_y());
|
||||
String type;
|
||||
if (TextUtils.isEmpty(bean.getType())) {
|
||||
type = "100";
|
||||
Logger.d(TAG, " === ADAS 返回结果出现 type 为 null情况 ====");
|
||||
} else {
|
||||
type = bean.getType();
|
||||
}
|
||||
model.setType(type);
|
||||
model.setLat(bean.getLat());
|
||||
model.setLon(bean.getLon());
|
||||
model.setHeading(bean.getHeading());
|
||||
model.setSystemTime(bean.getSystemTime());
|
||||
model.setSatelliteTime(bean.getSystemTime());
|
||||
model.setAlt(bean.getAlt());
|
||||
model.setCarId(bean.getCarId());
|
||||
model.setUuid(bean.getUuid());
|
||||
model.setColor(bean.getColor());
|
||||
model.setSpeed(bean.getSpeed());
|
||||
model.setDataAccuracy(bean.getDataAccuracy());
|
||||
model.setDistance(bean.getDistance());
|
||||
model.setDrawlevel(bean.getDrawlevel()); //liyz
|
||||
|
||||
data.add(model);
|
||||
|
||||
Log.d("ADAS数据延时", "uuid : " + bean.getUuid() + " type : " + bean.getType() + "systemTime : " + System.currentTimeMillis() + " GPS time" + Long.parseLong(bean.getSystemTime())
|
||||
+ " timeDelay : " + (System.currentTimeMillis() - Long.parseLong(bean.getSystemTime())));
|
||||
|
||||
// Log.d("ADAS原始数据", "uuid : " + bean.getUuid() + " type : " + bean.getType());
|
||||
Logger.d(TAG, "识别距离:x = %s, y = %s", model.getDistance_x(), model.getDistance_y());
|
||||
}
|
||||
}
|
||||
|
||||
if (mLastFrameDatums == null) {
|
||||
mLastFrameDatums = new ArrayList<>();
|
||||
}
|
||||
try {
|
||||
mLastFrameDatums.addAll(data);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
Message message = mAdasRecognizedRecHandler.obtainMessage();
|
||||
message.obj = data;
|
||||
message.sendToTarget();
|
||||
DebugConfig.setStatus(DebugConfig.sAdasRecognized, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRoute(AutopilotRoute autopilotRoute) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
if (warnMessageInfo == null) {
|
||||
return;
|
||||
}
|
||||
// 警告消息
|
||||
Logger.d(TAG, "onWarnMessage = %s", warnMessageInfo.toString());
|
||||
if (mMogoAdasWarnMessageCallbackList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final ADASWarnMessage warnMessage = AdasObjectUtils.fromAdasObject(warnMessageInfo);
|
||||
if (warnMessage == null) {
|
||||
return;
|
||||
}
|
||||
UiThreadHandler.post(() -> {
|
||||
for (IMogoAdasWarnMessageCallback callback : mMogoAdasWarnMessageCallbackList) {
|
||||
if (callback != null) {
|
||||
callback.onReceiveData(warnMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private IMogoAdasOCHCallback mAdasOCHCallback;
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*
|
||||
* @param models
|
||||
*/
|
||||
private void handleAdasRecognizedData(List<AdasAIDLOwnerCarRectModel> models) {
|
||||
private void handleAdasRecognizedData(List<RectInfo.RectBean> models) {
|
||||
if (models == null
|
||||
|| models.isEmpty()) {
|
||||
invokeCallbackPerSecond(null);
|
||||
@@ -287,7 +182,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
invokeCallbackPerSecond(models);
|
||||
}
|
||||
|
||||
private void invokeCallbackPerSecond(List<AdasAIDLOwnerCarRectModel> models) {
|
||||
private void invokeCallbackPerSecond(List<RectInfo.RectBean> models) {
|
||||
List<ADASRecognizedResult> recognizedListResults = AdasObjectUtils.regroupData(models);
|
||||
if (!mMogoAdasRecognizedDataCallbacks.isEmpty()) {
|
||||
for (IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks) {
|
||||
@@ -299,8 +194,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
}
|
||||
|
||||
private MyMessageFactory mAdasMessageFactory;
|
||||
|
||||
@Override
|
||||
public void openADAS() {
|
||||
showADAS();
|
||||
@@ -360,20 +253,52 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cameraEyeDetectResult(String detectResult) {
|
||||
Logger.d(TAG, "detectResult " + detectResult);
|
||||
try {
|
||||
JSONObject jsonObjectWs = new JSONObject(detectResult);
|
||||
String action = jsonObjectWs.optString("action");
|
||||
if (TextUtils.isEmpty(action)) {
|
||||
Logger.w(TAG, "--->action is null");
|
||||
return;
|
||||
}
|
||||
//识别的他车移动操作
|
||||
mAdasMessageFactory.createMessage(action).handlerMsg(GsonUtil.getGson(), mOnAdasListener, detectResult);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
// 仅在 vr 模式下显示 adas 识别车辆
|
||||
if (!SingletonsHolder.get(IMogoStatusManager.class).isVrMode()) {
|
||||
return;
|
||||
}
|
||||
if (!SingletonsHolder.get(IMogoStatusManager.class).isMainPageLaunched()) {
|
||||
return;
|
||||
}
|
||||
if (rectInfo == null || TextUtils.isEmpty(rectInfo.getAction())) {
|
||||
Logger.w(TAG, "--->action is null");
|
||||
return;
|
||||
}
|
||||
final long start = System.nanoTime();
|
||||
if (rectInfo.getModels() != null && !rectInfo.getModels().isEmpty()) {
|
||||
List<RectInfo.RectBean> beans = rectInfo.getModels();
|
||||
try {
|
||||
handleAdasRecognizedData(beans);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
DebugConfig.setStatus(DebugConfig.sAdasRecognized, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
if (warnMessageInfo == null) {
|
||||
return;
|
||||
}
|
||||
// 警告消息
|
||||
Logger.d(TAG, "onWarnMessage = %s", warnMessageInfo.toString());
|
||||
if (mMogoAdasWarnMessageCallbackList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final ADASWarnMessage warnMessage = AdasObjectUtils.fromAdasObject(warnMessageInfo);
|
||||
if (warnMessage == null) {
|
||||
return;
|
||||
}
|
||||
UiThreadHandler.post(() -> {
|
||||
for (IMogoAdasWarnMessageCallback callback : mMogoAdasWarnMessageCallbackList) {
|
||||
if (callback != null) {
|
||||
callback.onReceiveData(warnMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -455,31 +380,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
message.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyOwnerCarState(AdasAIDLOwnerCarStateModel ownerCarStateModel) {
|
||||
Logger.d(TAG, "AdasAIDLOwnerCarStateModel " + ownerCarStateModel);
|
||||
ADASCarStateInfo stateInf = new ADASCarStateInfo();
|
||||
stateInf.setAction("state");
|
||||
ADASCarStateInfo.ValuesBean bean = new ADASCarStateInfo.ValuesBean();
|
||||
bean.setSatelliteTime(ownerCarStateModel.getSatelliteTime());
|
||||
bean.setAcceleration(ownerCarStateModel.getAcceleration());
|
||||
bean.setAlt(ownerCarStateModel.getAlt());
|
||||
bean.setGnss_speed(ownerCarStateModel.getGnss_speed());
|
||||
bean.setHeading(ownerCarStateModel.getHeading());
|
||||
bean.setLat(ownerCarStateModel.getLat());
|
||||
bean.setLon(ownerCarStateModel.getLon());
|
||||
bean.setReceiverDataTime(ownerCarStateModel.getReceiverDataTime());
|
||||
bean.setSystemTime(ownerCarStateModel.getSystemTime());
|
||||
bean.setYaw_rate(ownerCarStateModel.getYaw_rate());
|
||||
stateInf.setValues(bean);
|
||||
mLastLon = ownerCarStateModel.getLon();
|
||||
mLastLat = ownerCarStateModel.getLat();
|
||||
mSpeed = ownerCarStateModel.getGnss_speed();
|
||||
if (mMogoAdasCarDataCallback != null) {
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback(stateInf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAutopilotState(AutopilotStatus autopilotStatus) {
|
||||
Logger.d(TAG, "notifyAutopilotState: " + autopilotStatus);
|
||||
@@ -488,53 +388,11 @@ public class MogoADASController implements IMogoADASController {
|
||||
mAdasOCHCallback.onStateChanged(autopilotStatus.getValues().getState(), autopilotStatus.getValues().getReason());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyOwnerCarRect(List<AdasAIDLOwnerCarRectModel> ownerCarStateRectList) {
|
||||
// 物体识别返回
|
||||
Logger.d(TAG, "ADAS-REC-received data: size = %s", ownerCarStateRectList == null ? 0 : ownerCarStateRectList.size());
|
||||
final long start = System.currentTimeMillis();
|
||||
// 仅在 vr 模式下显示 adas 识别车辆
|
||||
if (!SingletonsHolder.get(IMogoStatusManager.class).isVrMode()) {
|
||||
return;
|
||||
}
|
||||
if (!SingletonsHolder.get(IMogoStatusManager.class).isMainPageLaunched()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
handleAdasRecognizedData(ownerCarStateRectList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Logger.i("ADAS-REC-timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
};
|
||||
adasProvider.addAdasEventListener(mAdasDataListener);
|
||||
}
|
||||
}
|
||||
|
||||
private double mLastLon;
|
||||
private double mLastLat;
|
||||
private double mSpeed;
|
||||
private String satelliteTime;
|
||||
|
||||
@Override
|
||||
public double getLastSpeed() {
|
||||
return mSpeed;
|
||||
}
|
||||
|
||||
public double getLastLat() {
|
||||
return mLastLat;
|
||||
}
|
||||
|
||||
public double getLastLon() {
|
||||
return mLastLon;
|
||||
}
|
||||
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
private boolean useTestSn = false;
|
||||
|
||||
private void invokeShowADASOperation() {
|
||||
@@ -607,7 +465,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
mIsReleased = false;
|
||||
mAdasMessageFactory = new MyMessageFactory();
|
||||
adasProvider = ARouter.getInstance().navigation(AdasProvider.class);
|
||||
this.context = context;
|
||||
}
|
||||
@@ -627,7 +484,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
if (ui == null || !DebugConfig.isMapBased()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d(TAG, "new Mode: " + ui.name());
|
||||
switch (ui) {
|
||||
case CarUp_2D:
|
||||
@@ -777,25 +633,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
mMogoAdasWarnMessageCallbackList.remove(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
if (mLastFrameDatums == null) {
|
||||
return null;
|
||||
}
|
||||
if (!DebugConfig.isUseAdasRecognize()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
List<AdasAIDLOwnerCarRectModel> data = mLastFrameDatums;
|
||||
mLastFrameDatums = null;
|
||||
List<ADASRecognizedResult> recognizedResultList;
|
||||
recognizedResultList = AdasObjectUtils.regroupData(data);
|
||||
return recognizedResultList;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdasRecognizedDataCallback(IMogoAdasRecognizedDataCallback callback) {
|
||||
if (callback == null) {
|
||||
@@ -921,27 +758,6 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mockAdasRecognized(String json) {
|
||||
mAdasDataListener.cameraEyeDetectResult(json);
|
||||
}
|
||||
|
||||
//
|
||||
// private static final int PERIOD = 5 * 1000;
|
||||
// private static final int DELAY = 10000;
|
||||
// private Disposable mDisposable;
|
||||
//
|
||||
// /**
|
||||
// * 定时循环任务
|
||||
// */
|
||||
// private void timeLoop() {
|
||||
// mDisposable = Observable.interval(DELAY, PERIOD, TimeUnit.MILLISECONDS)
|
||||
// .map((aLong -> aLong + 1))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .subscribe(aLong ->
|
||||
// adasProvider.setBasicInfo()
|
||||
// );//getUnreadCount()执行的任务
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user