add new func of ezhou airport and upgrade the aiSdkVersion to fit demo server
This commit is contained in:
11
.idea/misc.xml
generated
11
.idea/misc.xml
generated
@@ -8,6 +8,17 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="../../../../../layout/custom_preview.xml" value="0.19947916666666668" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch.xml" value="0.184" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_adas_dispatch_affirm.xml" value="0.19166666666666668" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/drawable/bg_map_marker_blue_info.xml" value="0.184" />
|
||||
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
|
||||
@@ -200,10 +200,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// 第三方平台的sn是由AI云SDK中服务调用通过服务端生成的
|
||||
preparePassportEnvironment();
|
||||
prepareSocketAndLocationServices(apis);
|
||||
//无延迟
|
||||
// UiThreadHandler.postDelayed(() -> {
|
||||
//
|
||||
// }, delay);
|
||||
}
|
||||
|
||||
private void preparePassportEnvironment() {
|
||||
@@ -245,14 +241,16 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
break;
|
||||
}
|
||||
// 设置应用服务AppId 长链、鉴权
|
||||
clientConfig.setServiceAppId("com_mogo_launcher");
|
||||
if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE || DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEMO) {
|
||||
clientConfig.setServiceAppId("com_mogo_launcher");
|
||||
} else {
|
||||
clientConfig.setServiceAppId("com.mogo.launcher");
|
||||
}
|
||||
// 设置AI云平台分配给三方应用的签名密钥,需要从AI云平台申请
|
||||
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
|
||||
clientConfig.setThirdPartyDeviceId(Utils.getSn());
|
||||
// 设置循环检测间隔时间
|
||||
clientConfig.setLoopCheckDelay(15 * 1000);
|
||||
// 设置是否使用MoGoAiCloud SDK内部定位进行实时数据上报
|
||||
clientConfig.setIsUseExternalLocation(true);
|
||||
|
||||
// 设置DNS经纬度位置
|
||||
clientConfig.setIHttpDnsCurrentLocation(new IHttpDnsCurrentLocation() {
|
||||
|
||||
@@ -7,10 +7,10 @@ import androidx.annotation.Keep;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
mAckListeners.put(body.getMsgId(), listener);
|
||||
com.mogo.cloud.socket.MsgBody msgBody = new com.mogo.cloud.socket.MsgBody();
|
||||
MsgBody msgBody = new MsgBody();
|
||||
msgBody.msgType(body.getMsgType());
|
||||
msgBody.ack(body.isAck());
|
||||
msgBody.content(body.getContent());
|
||||
|
||||
@@ -7,10 +7,10 @@ import androidx.annotation.Keep;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
mAckListeners.put(body.getMsgId(), listener);
|
||||
com.mogo.cloud.socket.MsgBody msgBody = new com.mogo.cloud.socket.MsgBody();
|
||||
MsgBody msgBody = new MsgBody();
|
||||
msgBody.msgType(body.getMsgType());
|
||||
msgBody.ack(body.isAck());
|
||||
msgBody.content(body.getContent());
|
||||
|
||||
@@ -13,7 +13,7 @@ org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx4096m
|
||||
|
||||
#开启gradle缓存
|
||||
org.gradle.caching=true
|
||||
org.gradle.caching=trueconstraintlayout
|
||||
android.enableBuildCache=true
|
||||
|
||||
#开启kotlin的增量和并行编译
|
||||
@@ -157,19 +157,19 @@ LOGLIB_VERSION = 1.0.4
|
||||
|
||||
######## MogoAiCloudSDK Version
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.0.84
|
||||
MOGO_NETWORK_VERSION=1.1.34
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.0.84
|
||||
MOGO_PASSPORT_VERSION=1.1.34
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.0.84
|
||||
MOGO_SOCKET_VERSION=1.1.34
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.0.84
|
||||
MOGO_REALTIME_VERSION=1.1.34
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.0.84
|
||||
MOGO_TANLU_VERSION=1.1.34
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.0.84
|
||||
MOGO_LIVE_VERSION=1.1.34
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.0.84
|
||||
MOGO_TRAFFICLIVE_VERSION=1.1.34
|
||||
|
||||
######## Foundation MogoAiCloud Module
|
||||
# mogoAiCloud apk services
|
||||
|
||||
@@ -51,7 +51,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -311,9 +310,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(int drawlevel) {
|
||||
public void setAdasRecognizedResult(int drawLevel) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setAdasRecognizedResult(drawlevel);
|
||||
mClient.setAdasRecognizedResult(drawLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.module.common.uploadintime;
|
||||
package com.mogo.module.common.datacenter;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -16,20 +16,20 @@ import java.util.List;
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
public class SnapshotLocationController {
|
||||
public class SnapshotLocationDataCenter {
|
||||
|
||||
private static final String TAG = "SnapshotLocationController";
|
||||
|
||||
private static volatile SnapshotLocationController sInstance;
|
||||
private static volatile SnapshotLocationDataCenter sInstance;
|
||||
|
||||
private SnapshotLocationController() {
|
||||
private SnapshotLocationDataCenter() {
|
||||
}
|
||||
|
||||
public static SnapshotLocationController getInstance() {
|
||||
public static SnapshotLocationDataCenter getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotLocationController.class) {
|
||||
synchronized (SnapshotLocationDataCenter.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotLocationController();
|
||||
sInstance = new SnapshotLocationDataCenter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,29 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
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.SimpleHandlerThreadPool;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -29,20 +34,25 @@ public
|
||||
*/
|
||||
class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
private static final String TAG = "AdasRecognizedResultDrawer";
|
||||
private static final String TAG = "RecognizedResultDrawer";
|
||||
|
||||
private static volatile AdasRecognizedResultDrawer sInstance;
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
public AdasRecognizedResultDrawer() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final Map< String, ADASRecognizedResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
private final Map<String, ADASRecognizedResult> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AdasRecognizedResultDrawer.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (AdasRecognizedResultDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AdasRecognizedResultDrawer();
|
||||
}
|
||||
}
|
||||
@@ -59,212 +69,268 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public boolean hasCached( String uniqueKey ) {
|
||||
return mMarkersCaches.containsKey( uniqueKey );
|
||||
public boolean hasCached(String uniqueKey) {
|
||||
return mMarkersCaches.containsKey(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染 adas 识别的数据
|
||||
*
|
||||
* @param resultList
|
||||
* @param resultList adas感知融合数据
|
||||
*/
|
||||
public void renderAdasRecognizedResult( List< ADASRecognizedResult > resultList ) {
|
||||
if ( resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize() ) {
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
final long start = System.nanoTime();
|
||||
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches = new HashMap<>();
|
||||
List< ADASRecognizedResult > newDiffSet = new ArrayList<>();
|
||||
for ( ADASRecognizedResult recognizedListResult : resultList ) {
|
||||
// List<ADASRecognizedResult> allDatumsList = new ArrayList<>();
|
||||
// prepareData(resultList, allDatumsList);
|
||||
|
||||
if ( isUselessValue( recognizedListResult ) ) {
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
List<ADASRecognizedResult> newDiffSet = new ArrayList<>();
|
||||
for (ADASRecognizedResult recognizedListResult : resultList) {
|
||||
|
||||
if (isUselessValue(recognizedListResult)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 复用之前存在的 marker
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = mMarkersCaches.remove( uniqueKey );
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
// 新增差集
|
||||
newDiffSet.add( recognizedListResult );
|
||||
// 新增添加进差集
|
||||
newDiffSet.add(recognizedListResult);
|
||||
}
|
||||
}
|
||||
|
||||
removeUselessMarker();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
int cachedMarkerSize = mMarkersCaches.size();
|
||||
// 需要新增的 marker 数量
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
int size = cachedMarkerSize >= newDiffSetSize ? newDiffSetSize : cachedMarkerSize;
|
||||
|
||||
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// 复用过期 marker
|
||||
if ( newDiffSetSize > 0 ) {
|
||||
Iterator< Map.Entry< String, IMogoMarker > > entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get( i );
|
||||
if (newDiffSetSize > 0) {
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get(i);
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
Map.Entry< String, IMogoMarker > entry = entryIterator.next();
|
||||
entryIterator.remove();
|
||||
ADASRecognizedResult old = mLastPositions.remove( entry.getKey() );
|
||||
IMogoMarker marker = entry.getValue();
|
||||
if ( marker == null ) {
|
||||
IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 更新资源内容
|
||||
if ( old == null || old.type != recognizedListResult.type ) {
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get( resIdVal );
|
||||
if ( !TextUtils.isEmpty( resName ) ) {
|
||||
if ( !TextUtils.equals( resName, marker.getMarkerResName() ) ) {
|
||||
marker.use3DResource( resName );
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource( resId );
|
||||
mMarkerCachesResMd5Values.put( resIdVal, resName );
|
||||
}
|
||||
}
|
||||
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
}
|
||||
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for ( int i = size; i < newDiffSetSize; i++ ) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get( i );
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = drawAdasRecognizedDataMarker( recognizedListResult );
|
||||
if ( marker == null ) {
|
||||
continue;
|
||||
}
|
||||
renderAdasOneFrame( marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches );
|
||||
// Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
}
|
||||
if ( cachedMarkerSize - size > 0 ) {
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
private boolean isUselessValue( ADASRecognizedResult recognizedListResult ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
return true;
|
||||
}
|
||||
if ( !isRenderType( recognizedListResult.type ) ) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 对数据补点
|
||||
*
|
||||
* @param in
|
||||
* @param out
|
||||
*/
|
||||
private void prepareData(List<ADASRecognizedResult> in, List<ADASRecognizedResult> out) {
|
||||
// foreCastPoint(in);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
private final static String FORECAST = "adasForecast";
|
||||
|
||||
/**
|
||||
* 基于工控机识别的数据点速度预测当前位置和距离自车距离
|
||||
*
|
||||
* @param in 数据源
|
||||
*/
|
||||
private void foreCastPoint(List<ADASRecognizedResult> 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;
|
||||
if (internal <= 0) {
|
||||
Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.uuid);
|
||||
continue;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 预测点
|
||||
Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.speed);
|
||||
double foreCastDistance = adasResult.speed * internal / 1000;
|
||||
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(adasResult.lat, adasResult.lon);
|
||||
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.heading);
|
||||
|
||||
// 计算与自车距离
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker
|
||||
* @param recognizedListResult
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, ADASRecognizedResult recognizedListResult) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<ADASRecognizedResult> iterator = mLastPositions.values().iterator();
|
||||
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
ADASRecognizedResult result = iterator.next();
|
||||
long internal = result.satelliteTime - getCurSatelliteTime();
|
||||
if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤无用数据
|
||||
*
|
||||
* @param recognizedListResult {@link ADASRecognizedResult}
|
||||
* @return useless
|
||||
*/
|
||||
private boolean isUselessValue(ADASRecognizedResult recognizedListResult) {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (nonRenderType(recognizedListResult.type)) {
|
||||
return true;
|
||||
}
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param recognizedListResult
|
||||
* @param newAdasRecognizedMarkersCaches
|
||||
* @param recognizedListResult {@link ADASRecognizedResult}
|
||||
* @param newAdasRecognizedMarkersCaches 缓存集合
|
||||
*/
|
||||
private void renderAdasOneFrame( IMogoMarker marker,
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult recognizedListResult,
|
||||
Map< String, IMogoMarker > newAdasRecognizedMarkersCaches ) {
|
||||
private void renderAdasOneFrame(IMogoMarker marker,
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult 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);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.lon;
|
||||
// lastLat = lastPosition.lat;
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
//
|
||||
// recognizedListResult.lon = matchLonLat[0];
|
||||
// recognizedListResult.lat = matchLonLat[1];
|
||||
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove( uniqueKey );
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if ( lastPosition != null ) {
|
||||
lastLon = lastPosition.lon;
|
||||
lastLat = lastPosition.lat;
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat( recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat );
|
||||
|
||||
recognizedListResult.lon = matchLonLat[0];
|
||||
recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
mLastPositions.put( uniqueKey, recognizedListResult );
|
||||
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
newAdasRecognizedMarkersCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
long interval = computeAnimDuration( lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime );
|
||||
|
||||
final MogoLatLng renderLoc = new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon );
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
SimpleHandlerThreadPool.getInstance().postRender( () -> {
|
||||
marker.addDynamicAnchorPosition( renderLoc, ( float ) recognizedListResult.heading, intervalRef );
|
||||
} );
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||
}
|
||||
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
|
||||
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||
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, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
if (TextUtils.isEmpty(carColor)) {
|
||||
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel);
|
||||
}
|
||||
marker.setAnchorColor( carColor );
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
if ( shouldShowSpeed( recognizedListResult.type ) ) {
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
|
||||
if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = recognizedListResult.speed;
|
||||
msg.obj = obj;
|
||||
msg.obj = new SpeedData(marker
|
||||
, recognizedListResult.speed
|
||||
, recognizedListResult.uuid
|
||||
, recognizedListResult.type
|
||||
, recognizedListResult.heading
|
||||
, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制 marker
|
||||
*
|
||||
* @param recognizedListResult
|
||||
* @return
|
||||
* @param recognizedListResult {@link ADASRecognizedResult}
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
private IMogoMarker drawAdasRecognizedDataMarker( ADASRecognizedResult recognizedListResult ) {
|
||||
if ( recognizedListResult == null ) {
|
||||
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
|
||||
long start = System.nanoTime();
|
||||
if (recognizedListResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
String resIdVal = resId + "";
|
||||
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
if (TextUtils.isEmpty(carColor)) {
|
||||
carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel);
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.gps( true )
|
||||
.anchorColor( carColor )
|
||||
.controlAngle( true )
|
||||
.resName( mMarkerCachesResMd5Values.get( resIdVal ) )
|
||||
.icon3DRes( resId )
|
||||
.rotate( ( float ) recognizedListResult.heading )
|
||||
.position( new MogoLatLng( recognizedListResult.lat, recognizedListResult.lon ) );
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
|
||||
cacheMarkerIconResMd5Val( resIdVal, marker );
|
||||
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
.anchorColor(carColor)
|
||||
.controlAngle(true)
|
||||
.resName(mMarkerCachesResMd5Values.get(resIdVal))
|
||||
.icon3DRes(resId)
|
||||
.rotate((float) recognizedListResult.heading)
|
||||
.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;
|
||||
}
|
||||
|
||||
@@ -279,12 +345,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* 清除旧的 marker 数据
|
||||
*/
|
||||
public void clearOldMarker() {
|
||||
if ( mMarkersCaches != null ) {
|
||||
if (mMarkersCaches != null) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS );
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_ADAS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
@@ -10,23 +13,21 @@ import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.lang.Math.PI;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public
|
||||
/*
|
||||
@@ -37,40 +38,19 @@ public
|
||||
*/
|
||||
class BaseDrawer {
|
||||
|
||||
/**
|
||||
* 速度显示对象
|
||||
*/
|
||||
public class SpeedData {
|
||||
|
||||
public IMogoMarker marker;
|
||||
public Context context;
|
||||
double speed;
|
||||
|
||||
public void showSpeed() {
|
||||
try {
|
||||
showSelfSpeed(context,
|
||||
marker,
|
||||
speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除过期的 marker
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*/
|
||||
public static final int MSG_DISPLAY_SPEED = 11;
|
||||
|
||||
/**
|
||||
* 地图刷新频率
|
||||
*/
|
||||
public static final int MAP_RENDER_FRAME_FREQUENCY = 30;
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*/
|
||||
public static final int MSG_DISPLAY_SPEED = 11;
|
||||
|
||||
/**
|
||||
* 移动点的时间间隔
|
||||
*/
|
||||
@@ -79,23 +59,30 @@ class BaseDrawer {
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
protected static final Map<String, String> mMarkerCachesResMd5Values = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected Map<String, IMogoMarker> mMarkersCaches = new HashMap<>();
|
||||
protected static final ConcurrentHashMap<String, String> mMarkerCachesResMd5Values = new ConcurrentHashMap<>();
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
protected static Handler mRenderThreadHandler = null;
|
||||
private static TextView mSpeedView;
|
||||
|
||||
public BaseDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
initWorkThreadHandler();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(mContext);
|
||||
mSpeedView.setSingleLine(false);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
}
|
||||
|
||||
private static Handler mWorkThreadHandler;
|
||||
protected static Handler mRenderThreadHandler = null;
|
||||
|
||||
/**
|
||||
* 处理 marker 移除的线程
|
||||
@@ -140,30 +127,29 @@ class BaseDrawer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*
|
||||
* @param data {@link SpeedData}
|
||||
*/
|
||||
private static void showSpeed(SpeedData data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
data.showSpeed();
|
||||
private static void showSpeed(SpeedData speedData) {
|
||||
showSelfSpeed(speedData.getMarker()
|
||||
, speedData.getSpeed()
|
||||
, speedData.getUuid()
|
||||
, speedData.getType()
|
||||
, speedData.getHeading()
|
||||
, speedData.getIsVrMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除无效[为 null 或者 已被销毁]的 marker
|
||||
*/
|
||||
protected void removeUselessMarker() {
|
||||
protected void removeUselessMarker(Map<String, IMogoMarker> mMarkersCaches) {
|
||||
if (mMarkersCaches == null || mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker marker = iterator.next();
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
if (marker != null) {
|
||||
iterator.remove();
|
||||
marker.remove();
|
||||
marker.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,29 +173,29 @@ class BaseDrawer {
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return render
|
||||
*/
|
||||
public boolean isRenderType(int type) {
|
||||
public boolean nonRenderType(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto
|
||||
|| recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|
||||
|| recognizedType == AdasRecognizedType.classIdUnKnow; //todo unKnow物体绘制
|
||||
return recognizedType != AdasRecognizedType.classIdCar
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficBus
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficTruck
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否展示车速
|
||||
* 是否展示车速,UUID以及类型
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return showSpeed
|
||||
*/
|
||||
public boolean shouldShowSpeed(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow; //todo unKnow物体不绘制车速
|
||||
return true; //todo 验证行人预警,对行人和自行车不做infoWindow过滤
|
||||
// AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
// return recognizedType != AdasRecognizedType.classIdPerson;
|
||||
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
|
||||
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,64 +206,53 @@ class BaseDrawer {
|
||||
*/
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.othercar;
|
||||
if (recognizedType == AdasRecognizedType.classIdCar) {
|
||||
// TODO 这里临时替换模型解决穿模现象
|
||||
return R.raw.tachexiaoche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.bus;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return R.raw.motorbike;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.arraw;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
|
||||
return R.raw.othercar;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return R.raw.tache;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
|
||||
return R.raw.zixingche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
// TODO 这里临时替换模型解决穿模现象
|
||||
return R.raw.daba;
|
||||
}
|
||||
return R.raw.people;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据速度、经纬度计算距离判断车辆颜色
|
||||
* 根据数据源判断车辆预警颜色
|
||||
*
|
||||
* @param speed 车速 TODO 这里很可能是adas的策略
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param type 车辆类型
|
||||
* @param fromType 数据来源
|
||||
* @param drawLevel 危险等级
|
||||
* @return 实际车辆颜色
|
||||
*/
|
||||
protected String getModelRenderColor(int type, double speed, double lon, double lat, double angle) {
|
||||
|
||||
protected String getModelRenderColor(int type, int fromType, int drawLevel) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return "#D8D8D8FF";
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow){ //todo unKnow颜色绘制
|
||||
return "#FF2894FF";
|
||||
}
|
||||
// 距离策略
|
||||
double[] coordinates = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
|
||||
if (distance < 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if (distance < 100 && distance >= 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
}
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
double curSpeed = getCurSpeed();
|
||||
if (curSpeed > 0 && speed > curSpeed) {
|
||||
double rate = ((speed - curSpeed) / curSpeed) * 100;
|
||||
if (rate >= 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if (rate > 10 && rate < 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
if (fromType == FROM_ADAS) {
|
||||
switch (drawLevel) {
|
||||
case 1:
|
||||
return Car3DModelColor.Normal.color;
|
||||
case 2:
|
||||
return Car3DModelColor.Warming.color;
|
||||
case 3:
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
default:
|
||||
return Car3DModelColor.Error.color;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认颜色
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
|
||||
@@ -286,10 +261,10 @@ class BaseDrawer {
|
||||
*
|
||||
* @return isCurSpeed
|
||||
*/
|
||||
private double getCurSpeed() {
|
||||
protected double getCurSpeed() {
|
||||
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
if (speed <= 0) {
|
||||
speed = SnapshotLocationController.getInstance().getCurSpeed();
|
||||
speed = SnapshotLocationDataCenter.getInstance().getCurSpeed();
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
@@ -297,20 +272,32 @@ class BaseDrawer {
|
||||
/**
|
||||
* 返回当前自车经纬度
|
||||
*
|
||||
* @return
|
||||
* @return 0:lon 1:lat
|
||||
*/
|
||||
private double[] getCurCoordinates() {
|
||||
protected double[] getCurCoordinates() {
|
||||
double[] coordinates = {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||
};
|
||||
if (coordinates[0] <= 0) {
|
||||
coordinates[0] = SnapshotLocationController.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationController.getInstance().getCurLat();
|
||||
coordinates[0] = SnapshotLocationDataCenter.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationDataCenter.getInstance().getCurLat();
|
||||
}
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前自车SNTP时间
|
||||
*
|
||||
* @return SNTP时间
|
||||
*/
|
||||
protected long getCurSatelliteTime() {
|
||||
String satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
|
||||
if (TextUtils.isEmpty(satelliteTime)) {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
return Long.parseLong(satelliteTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型颜色
|
||||
@@ -319,26 +306,26 @@ class BaseDrawer {
|
||||
|
||||
Normal("#D8D8D8FF"),
|
||||
Warming("#FFD53EFF"),
|
||||
Dangerous("#FF3C45FF");
|
||||
Dangerous("#FF3C45FF"),
|
||||
Error("#00000000");
|
||||
|
||||
private final String color;
|
||||
|
||||
Car3DModelColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示车辆速度
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param mogoMarker {@link IMogoMarker}
|
||||
* @param speed 是否显示速度
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public void showSelfSpeed(Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode) {
|
||||
public static void showSelfSpeed(IMogoMarker mogoMarker, double speed, String uuid, int type, double heading, boolean isVrMode) {
|
||||
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
@@ -347,26 +334,15 @@ class BaseDrawer {
|
||||
return;
|
||||
}
|
||||
int speedIntVal = (int) (speed * 3.6);
|
||||
if (speedIntVal <= 0) {
|
||||
if (speedIntVal <= 0) { //速度为0 隐藏InfoWindow
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
String speedVal = speedIntVal + "";
|
||||
String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName(speedVal);
|
||||
mogoMarker.setInfoWindowOffset(0, 20);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(context);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
mSpeedView.setText(speedVal);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName(speedVal, mogoMarker.getMarkerInfoResName());
|
||||
} else {
|
||||
mogoMarker.updateInfoWindowView(infoResName);
|
||||
}
|
||||
// String text = "speed : " + speedIntVal + "\n" + uuid + "\n" + "type : " + type + "\n" + "heading : " + heading;
|
||||
String text = uuid + " , " + (int) heading;
|
||||
mSpeedView.setText(text);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,8 +371,8 @@ class BaseDrawer {
|
||||
/**
|
||||
* 缓存绘制 marker 的 id 和 marker 资源缓存的 md5 的关系
|
||||
*
|
||||
* @param id
|
||||
* @param marker
|
||||
* @param id 缓存资源ID
|
||||
* @param marker {@link IMogoMarker}
|
||||
*/
|
||||
protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
@@ -412,11 +388,11 @@ class BaseDrawer {
|
||||
/**
|
||||
* 道路匹配到车道中心点
|
||||
*
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param angle
|
||||
* @param isRtk
|
||||
* @return
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param angle 方向角
|
||||
* @param isRtk 是否是RTK
|
||||
* @return 匹配经纬度值
|
||||
*/
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isRtk) {
|
||||
final long start = System.currentTimeMillis();
|
||||
@@ -432,25 +408,27 @@ class BaseDrawer {
|
||||
/**
|
||||
* 清理缓存路段数据
|
||||
*
|
||||
* @param id
|
||||
* @param id 缓存数据Key
|
||||
*/
|
||||
public static void clearRoadCacheById(String id) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间
|
||||
* 使用系统时间或卫星时间计算出动画的运动时间,最小值45,防止两个点距离过近设置的最小动画执行时间
|
||||
*
|
||||
* @param lastSystemTime
|
||||
* @param curSystemTime
|
||||
* @param lastSatelliteTime
|
||||
* @param curSatelliteTime
|
||||
* @return
|
||||
* @param lastSatelliteTime 上一个点SNTP时间,精确值
|
||||
* @param curSatelliteTime 当前点SNTP时间,精确值
|
||||
* @return 动画运动时间
|
||||
*/
|
||||
public long computeAnimDuration(long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime) {
|
||||
long systemTimeInterval = curSystemTime - lastSystemTime;
|
||||
long satelliteTimeInterval = curSatelliteTime - lastSatelliteTime;
|
||||
long interval = systemTimeInterval < satelliteTimeInterval || satelliteTimeInterval == 0 ? systemTimeInterval : satelliteTimeInterval;
|
||||
public long computeAnimDuration(long lastSatelliteTime, long curSatelliteTime) {
|
||||
if (lastSatelliteTime == 0 || curSatelliteTime == 0) {
|
||||
Log.d("ADAS动画数据", "卫星时间存在错误");
|
||||
return 45;
|
||||
}
|
||||
long interval = curSatelliteTime - lastSatelliteTime;
|
||||
Log.d("ADAS动画数据", "lastSatelliteTime : " + lastSatelliteTime +
|
||||
" ---- curSatelliteTime : " + curSatelliteTime + " ===== 插值 : " + interval);
|
||||
if (interval < 45) {
|
||||
interval = 45;
|
||||
}
|
||||
@@ -460,13 +438,13 @@ class BaseDrawer {
|
||||
/**
|
||||
* 根据位置信息、车头朝向计算道路吸附
|
||||
*
|
||||
* @param id
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param heading
|
||||
* @param lastLon
|
||||
* @param lastLat
|
||||
* @return
|
||||
* @param id UUID
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @param heading 方向角
|
||||
* @param lastLon 上一个点经度
|
||||
* @param lastLat 上一个点纬度
|
||||
* @return 匹配经纬度
|
||||
*/
|
||||
protected double[] getMatchLonLat(String id, double lon, double lat, double heading, double lastLon, double lastLat) {
|
||||
double[] matchedPoint = matchRoad(id, lon,
|
||||
@@ -475,7 +453,7 @@ class BaseDrawer {
|
||||
true
|
||||
);
|
||||
|
||||
boolean match = false;
|
||||
boolean match;
|
||||
if (matchedPoint != null) {
|
||||
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
|
||||
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Message;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownDataHelper;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -15,9 +21,8 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
@@ -26,11 +31,11 @@ import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -50,13 +55,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
super();
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
|
||||
public static SnapshotSetDataDrawer getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SnapshotSetDataDrawer.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotSetDataDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotSetDataDrawer();
|
||||
}
|
||||
}
|
||||
@@ -68,41 +73,34 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
private static final Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
private final Map<String, SocketDownData.CloudRoadDataProto> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 注册StatusDescriptor.VR_MODE类型,VR_MODE状态改变回调
|
||||
*
|
||||
* @param descriptor 状态类型
|
||||
* @param isTrue true - accOn、adas ui show、voice ui show、push ui show、v2x ui show
|
||||
*/
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
Logger.d( TAG, "%s - %s", descriptor, isTrue );
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
Logger.d(TAG, "%s - %s", descriptor, isTrue);
|
||||
mChangeCarModeStatus = true;
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
mMarkersCaches = new HashMap<>();
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
mLastPositions.clear();
|
||||
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
public boolean isChangeCarModeStatus() {
|
||||
return mChangeCarModeStatus;
|
||||
}
|
||||
|
||||
public void setChangeCarModeStatus( boolean mChangeCarModeStatus ) {
|
||||
public void setChangeCarModeStatus(boolean mChangeCarModeStatus) {
|
||||
this.mChangeCarModeStatus = mChangeCarModeStatus;
|
||||
}
|
||||
|
||||
@@ -112,240 +110,279 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 自车周边数据
|
||||
* @return 清除结果
|
||||
*/
|
||||
private boolean clear( MogoSnapshotSetData data ) {
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched() ) {
|
||||
if ( mMarkersCaches == null ) {
|
||||
private boolean clear(SocketDownData.LauncherSnapshotProto data) {
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageLaunched()) {
|
||||
if (mMarkersCaches == null) {
|
||||
return false;
|
||||
}
|
||||
if ( mMarkersCaches != null ) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mMarkersCaches.clear();
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA);
|
||||
return true;
|
||||
}
|
||||
if ( data == null || (
|
||||
( data.getAllList() == null || data.getAllList().isEmpty() ) &&
|
||||
( data.getNearList() == null || data.getNearList().isEmpty() ) ) ) {
|
||||
if ( mMarkersCaches != null ) {
|
||||
if (data == null || (
|
||||
(data.getAllListList() == null || data.getAllListList().isEmpty()) &&
|
||||
(data.getNearListList() == null || data.getNearListList().isEmpty()))) {
|
||||
if (mMarkersCaches != null) {
|
||||
mMarkersCaches.clear();
|
||||
}
|
||||
if ( mLastPositions != null ) {
|
||||
mLastPositions.clear();
|
||||
}
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA );
|
||||
mLastPositions.clear();
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, DataTypes.TYPE_MARKER_CLOUD_DATA);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
* 绘制来自云端的 mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
*
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
public void renderSnapshotData( MogoSnapshotSetData data ) {
|
||||
|
||||
if ( clear( data ) ) {
|
||||
public void renderSnapshotData(SocketDownData.LauncherSnapshotProto data) {
|
||||
final long start = System.nanoTime();
|
||||
if (clear(data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List< CloudRoadData > allDatumsList = new ArrayList<>();
|
||||
prepareData( data.getAllList(), allDatumsList );
|
||||
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > newMarkersCaches = new HashMap<>( allDatumsList.size() );
|
||||
List< CloudRoadData > newDiffSet = new ArrayList<>();
|
||||
List<SocketDownData.CloudRoadDataProto> allDatumsList = new ArrayList<>();
|
||||
prepareData(data.getAllListList(), allDatumsList);
|
||||
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( isUselessValue( cloudRoadData ) ) {
|
||||
Map<String, IMogoMarker> newMarkersCaches = new ConcurrentHashMap<>(allDatumsList.size());
|
||||
List<SocketDownData.CloudRoadDataProto> newDiffSet = new ArrayList<>();
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allDatumsList) {
|
||||
|
||||
if (isUselessValue(cloudRoadData)) {
|
||||
continue;
|
||||
}
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
IMogoMarker marker = mMarkersCaches.remove( uniqueKey );
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
updateCacheMarkerRes(marker, cloudRoadData);
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
} else {
|
||||
newDiffSet.add( cloudRoadData );
|
||||
newDiffSet.add(cloudRoadData);
|
||||
}
|
||||
}
|
||||
|
||||
removeUselessMarker();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
int cachedMarkerSize = mMarkersCaches.size();
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if ( newDiffSetSize > 0 ) {
|
||||
Iterator< Map.Entry< String, IMogoMarker > > entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
CloudRoadData cloudRoadData = newDiffSet.get( i );
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
Map.Entry< String, IMogoMarker > entry = entryIterator.next();
|
||||
entryIterator.remove();
|
||||
CloudRoadData old = mLastPositions.remove( entry.getKey() );
|
||||
IMogoMarker marker = entry.getValue();
|
||||
if ( marker == null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 更新资源内容
|
||||
if ( old == null || old.getType() != cloudRoadData.getType() ) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes( cloudRoadData.getType() );
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get( resIdVal );
|
||||
if ( !TextUtils.isEmpty( resName ) ) {
|
||||
if ( !TextUtils.equals( resName, marker.getMarkerResName() ) ) {
|
||||
marker.use3DResource( resName );
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource( resId );
|
||||
mMarkerCachesResMd5Values.put( resIdVal, resName );
|
||||
}
|
||||
}
|
||||
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
}
|
||||
|
||||
if (newDiffSetSize > 0) {
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for ( int i = size; i < newDiffSetSize; i++ ) {
|
||||
CloudRoadData cloudRoadData = newDiffSet.get( i );
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
IMogoMarker marker = drawSnapshotDataMarker( cloudRoadData );
|
||||
if ( marker == null ) {
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
SocketDownData.CloudRoadDataProto cloudRoadData = newDiffSet.get(i);
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
IMogoMarker marker = drawSnapshotDataMarker(cloudRoadData);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
}
|
||||
}
|
||||
if ( cachedMarkerSize - size > 0 ) {
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
mMarkersCaches.putAll(newMarkersCaches);
|
||||
// 移除超时 marker
|
||||
delayRemoveUselessMarker();
|
||||
removeUselessLastRecord();
|
||||
Log.d("云端数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker {@link IMogoMarker}
|
||||
* @param cloudRoadDataProto {@link SocketDownData.CloudRoadDataProto}
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, SocketDownData.CloudRoadDataProto cloudRoadDataProto) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(cloudRoadDataProto.getType());
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches );
|
||||
mMarkersCaches = newMarkersCaches;
|
||||
private void delayRemoveUselessMarker() {
|
||||
if (mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) {
|
||||
return;
|
||||
}
|
||||
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker result = iterator.next();
|
||||
SocketDownData.CloudRoadDataProto proto = ((SocketDownData.CloudRoadDataProto) result.getObject());
|
||||
if(proto == null){ // 后续有业务数据在操作,更新数据,不做处理
|
||||
continue;
|
||||
}
|
||||
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - proto.getSatelliteTime();
|
||||
Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid()
|
||||
+ " localTime : " + adasControllerApi.getSatelliteTime()
|
||||
+ " originTime : " + proto.getSatelliteTime()
|
||||
+ " internal : " + internal);
|
||||
if (internal > 5000) {
|
||||
iterator.remove();
|
||||
result.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime()) || adasControllerApi.getSatelliteTime().equals("0")) {
|
||||
return;
|
||||
}
|
||||
Iterator<SocketDownData.CloudRoadDataProto> iterator = mLastPositions.values().iterator();
|
||||
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
SocketDownData.CloudRoadDataProto result = iterator.next();
|
||||
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - result.getSatelliteTime();
|
||||
if (internal > 3000) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断类型、uuid 等
|
||||
*
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @param cloudRoadData {@link SocketDownData.CloudRoadDataProto}
|
||||
* @return isUselessValue
|
||||
*/
|
||||
private boolean isUselessValue( CloudRoadData cloudRoadData ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
private boolean isUselessValue(SocketDownData.CloudRoadDataProto cloudRoadData) {
|
||||
if (cloudRoadData == null) {
|
||||
return true;
|
||||
}
|
||||
if ( !isRenderType( cloudRoadData.getType() ) ) {
|
||||
if (nonRenderType(cloudRoadData.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @param cloudRoadData {@link SocketDownData.CloudRoadDataProto}
|
||||
* @param newSnapshotCaches 缓存数据
|
||||
*/
|
||||
private void renderSnapshotOneFrame( IMogoMarker marker, String uniqueKey, final CloudRoadData cloudRoadData, Map< String, IMogoMarker > newSnapshotCaches ) {
|
||||
private void renderSnapshotOneFrame(IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
|
||||
final long start = System.nanoTime();
|
||||
SocketDownData.CloudRoadDataProto lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.getWgslon();
|
||||
// lastLat = lastPosition.getWgslat();
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(cloudRoadData.getUuid(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat);
|
||||
// SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
// builder.setWgslon(matchLonLat[0]);
|
||||
// builder.setWgslat(matchLonLat[1]);
|
||||
// cloudRoadData = builder.build();
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
CloudRoadData lastPosition = mLastPositions.remove( uniqueKey );
|
||||
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if ( lastPosition != null ) {
|
||||
lastLon = lastPosition.getWgslon();
|
||||
lastLat = lastPosition.getWgslat();
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat( cloudRoadData.getUniqueKey(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat );
|
||||
cloudRoadData.setWgslon( matchLonLat[0] );
|
||||
cloudRoadData.setWgslat( matchLonLat[1] );
|
||||
|
||||
mLastPositions.put( uniqueKey, cloudRoadData );
|
||||
|
||||
newSnapshotCaches.put( uniqueKey, marker );
|
||||
if ( lastPosition != null ) {
|
||||
long interval = computeAnimDuration( lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime() );
|
||||
|
||||
final MogoLatLng point = new MogoLatLng( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
|
||||
SimpleHandlerThreadPool.getInstance().postRender( () -> marker.addDynamicAnchorPosition( point, ( float ) cloudRoadData.getHeading(), intervalRef ));
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) cloudRoadData.getHeading() ) );
|
||||
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
}
|
||||
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
|
||||
if ( shouldShowSpeed( cloudRoadData.getType() ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = cloudRoadData.getSpeed();
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
mLastPositions.put(uniqueKey, cloudRoadData);
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
|
||||
}
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||
final long intervalRef = interval - cost;
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getFromType(), 1));
|
||||
newSnapshotCaches.put(uniqueKey, marker);
|
||||
// if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
// Message msg = mRenderThreadHandler.obtainMessage();
|
||||
// msg.obj = new SpeedData(marker
|
||||
// , cloudRoadData.getSpeed()
|
||||
// , cloudRoadData.getUuid()
|
||||
// , cloudRoadData.getType()
|
||||
// , cloudRoadData.getHeading()
|
||||
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// msg.what = MSG_DISPLAY_SPEED;
|
||||
// msg.sendToTarget();
|
||||
// }
|
||||
Log.d("云端数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤数据
|
||||
* 过滤数据,对数据补点
|
||||
*
|
||||
* @param in 输入集合
|
||||
* @param out 输出集合
|
||||
*/
|
||||
private void prepareData( List< CloudRoadData > in, List< CloudRoadData > out ) {
|
||||
filterData( in );
|
||||
out.addAll( in );
|
||||
private void prepareData(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
|
||||
// foreCastPoint(in, out);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
private final static String FORECAST = "snapshotForecast";
|
||||
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示 mogo 车辆上报的数据
|
||||
* 基于云平台下发的数据点速度预测当前位置和距离自车距离
|
||||
*
|
||||
* @param data 道路数据集合
|
||||
* @param in 数据源
|
||||
*/
|
||||
private void filterData( List< CloudRoadData > data ) {
|
||||
if ( data == null || data.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
List< CloudRoadData > newList = new ArrayList<>();
|
||||
for ( CloudRoadData cloudRoadData : data ) {
|
||||
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
|
||||
continue;
|
||||
private void foreCastPoint(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
for (SocketDownData.CloudRoadDataProto proto : in) {
|
||||
SocketDownData.CloudRoadDataProto.Builder builder = proto.toBuilder();
|
||||
Log.d(FORECAST, "ready to foreCast current uuid : " + proto.getUuid());
|
||||
long internal = getCurSatelliteTime() - builder.getSatelliteTime();
|
||||
if (internal <= 0) {
|
||||
Log.d(FORECAST, "time internal less than 0 , uuid : " + proto.getUuid());
|
||||
out.add(proto);
|
||||
continue;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
// 预测点
|
||||
Log.d(FORECAST, "time internal : " + internal + " speed : " + proto.getSpeed());
|
||||
double foreCastDistance = proto.getSpeed() * internal / 1000;
|
||||
Log.d(FORECAST, "foreCastDistance : " + foreCastDistance);
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(proto.getWgslat(), proto.getWgslon());
|
||||
MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, proto.getHeading());
|
||||
|
||||
// 计算与自车距离
|
||||
float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1]
|
||||
, foreCastMogoLatLon.getLon(), foreCastMogoLatLon.getLat());
|
||||
|
||||
long foreCastInternal = System.currentTimeMillis() - startTime;
|
||||
Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成
|
||||
|
||||
builder.setWgslat(foreCastMogoLatLon.getLat());
|
||||
builder.setWgslon(foreCastMogoLatLon.getLon());
|
||||
builder.setSatelliteTime(getCurSatelliteTime() - foreCastInternal);
|
||||
builder.setDistance(distanceFromSelf);
|
||||
proto = builder.build();
|
||||
out.add(proto);
|
||||
}
|
||||
newList.add( cloudRoadData );
|
||||
}
|
||||
data.clear();
|
||||
data.addAll( newList );
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定点击事件
|
||||
*/
|
||||
public void bindClickListener( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
public void bindClickListener(IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
marker.setOnMarkerClickListener( this );
|
||||
marker.setOnMarkerClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,45 +391,46 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawSnapshotDataMarker( CloudRoadData data ) {
|
||||
if ( data == null ) {
|
||||
public IMogoMarker drawSnapshotDataMarker(SocketDownData.CloudRoadDataProto data) {
|
||||
long start = System.nanoTime();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.rotate( ( float ) data.getHeading() )
|
||||
.object( data )
|
||||
.gps( true )
|
||||
.controlAngle( true )
|
||||
.position( new MogoLatLng( data.getWgslat(), data.getWgslon() ) );
|
||||
.owner(TYPE_MARKER_CLOUD_DATA)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.rotate((float) data.getHeading())
|
||||
.object(data)
|
||||
.gps(true)
|
||||
.controlAngle(true)
|
||||
.position(new MogoLatLng(data.getWgslat(), data.getWgslon()));
|
||||
String resIdVal;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
int resId = getModelRes( data.getType() );
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
options.set3DMode(true);
|
||||
options.anchorColor(getModelRenderColor(data.getType(), data.getFromType(), 1));
|
||||
int resId = getModelRes(data.getType());
|
||||
resIdVal = resId + "";
|
||||
options.resName( mMarkerCachesResMd5Values.get( resIdVal ) );
|
||||
options.icon3DRes( resId );
|
||||
options.resName(mMarkerCachesResMd5Values.get(resIdVal));
|
||||
options.icon3DRes(resId);
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
View view = inflateView( data );
|
||||
options.icon( view );
|
||||
options.set3DMode(false);
|
||||
View view = inflateView(data);
|
||||
options.icon(view);
|
||||
resIdVal = view.getId() + "";
|
||||
}
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
cacheMarkerIconResMd5Val( resIdVal, marker );
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(TYPE_MARKER_CLOUD_DATA, options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
|
||||
if ( !TextUtils.isEmpty( data.getSn() ) ) {
|
||||
bindClickListener( marker );
|
||||
if (!TextUtils.isEmpty(data.getSn())) {
|
||||
bindClickListener(marker);
|
||||
}
|
||||
|
||||
Log.d("云端数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
public String get3DCacheId( String resIdVal ) {
|
||||
return mMarkerCachesResMd5Values.get( resIdVal );
|
||||
public String get3DCacheId(String resIdVal) {
|
||||
return mMarkerCachesResMd5Values.get(resIdVal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,12 +439,12 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return marker
|
||||
*/
|
||||
public View inflateView( CloudRoadData data ) {
|
||||
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
|
||||
ImageView iv = rootView.findViewById( R.id.module_commons_marker_car_model );
|
||||
int viewIdLike = get2DModel( data );
|
||||
iv.setImageResource( viewIdLike );
|
||||
rootView.setId( viewIdLike );
|
||||
public View inflateView(SocketDownData.CloudRoadDataProto data) {
|
||||
View rootView = LayoutInflater.from(AbsMogoApplication.getApp()).inflate(R.layout.module_commons_layout_car, null);
|
||||
ImageView iv = rootView.findViewById(R.id.module_commons_marker_car_model);
|
||||
int viewIdLike = get2DModel(data);
|
||||
iv.setImageResource(viewIdLike);
|
||||
rootView.setId(viewIdLike);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@@ -416,71 +454,71 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 道路数据
|
||||
* @return 2D贴图id
|
||||
*/
|
||||
private int get2DModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
private int get2DModel(SocketDownData.CloudRoadDataProto data) {
|
||||
switch (data.getFromType()) {
|
||||
case SocketDownDataHelper.FROM_ADAS:
|
||||
case SocketDownDataHelper.FROM_ROAD_UNIT:
|
||||
case SocketDownDataHelper.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.drawable.icon_map_marker_car_gray;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
if ( marker != null && !marker.isDestroyed() ) {
|
||||
if ( marker.getObject() instanceof CloudRoadData ) {
|
||||
showCarCallPanel( ( ( CloudRoadData ) marker.getObject() ) );
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
if (marker.getObject() instanceof SocketDownData.CloudRoadDataProto) {
|
||||
showCarCallPanel(((SocketDownData.CloudRoadDataProto) marker.getObject()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示用户信息米娜版
|
||||
* 展示用户信息面版
|
||||
*
|
||||
* @param data 道路数据
|
||||
*/
|
||||
private void showCarCallPanel( CloudRoadData data ) {
|
||||
private void showCarCallPanel(SocketDownData.CloudRoadDataProto data) {
|
||||
|
||||
MogoDriverInfo driverInfo = new MogoDriverInfo();
|
||||
driverInfo.setLat( data.getLat() );
|
||||
driverInfo.setLon( data.getLon() );
|
||||
driverInfo.setSn( data.getSn() );
|
||||
driverInfo.setLat(data.getLat());
|
||||
driverInfo.setLon(data.getLon());
|
||||
driverInfo.setSn(data.getSn());
|
||||
ICarsChattingProvider carChatting = CallChatApi.getInstance().getApiProvider();
|
||||
|
||||
if ( carChatting != null ) {
|
||||
if (carChatting != null) {
|
||||
try {
|
||||
carChatting.showUserWindow( TAG, driverInfo, mContext );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "showCarCallPanel" );
|
||||
carChatting.showUserWindow(TAG, driverInfo, mContext);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "showCarCallPanel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeIconResourceIfNecessary( CloudRoadData cloudRoadData, IMogoMarker marker ) {
|
||||
if ( isChangeCarModeStatus() ) {
|
||||
setChangeCarModeStatus( false );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
int resId = getModelRes( cloudRoadData.getType() );
|
||||
String resName = get3DCacheId( resId + "" );
|
||||
if ( TextUtils.isEmpty( resName ) ) {
|
||||
marker.use3DResource( resId );
|
||||
cacheMarkerIconResMd5Val( resId + "", marker );
|
||||
public void changeIconResourceIfNecessary(SocketDownData.CloudRoadDataProto cloudRoadData, IMogoMarker marker) {
|
||||
if (isChangeCarModeStatus()) {
|
||||
setChangeCarModeStatus(false);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
marker.getMogoMarkerOptions().set3DMode(true);
|
||||
int resId = getModelRes(cloudRoadData.getType());
|
||||
String resName = get3DCacheId(resId + "");
|
||||
if (TextUtils.isEmpty(resName)) {
|
||||
marker.use3DResource(resId);
|
||||
cacheMarkerIconResMd5Val(resId + "", marker);
|
||||
} else {
|
||||
marker.use3DResource( resName );
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
View view = inflateView( cloudRoadData );
|
||||
marker.getMogoMarkerOptions().set3DMode(false);
|
||||
View view = inflateView(cloudRoadData);
|
||||
int resId = view.getId();
|
||||
String resName = get3DCacheId( resId + "" );
|
||||
if ( TextUtils.isEmpty( resName ) ) {
|
||||
marker.setIcon( ViewUtils.fromView( view ) );
|
||||
cacheMarkerIconResMd5Val( resId + "", marker );
|
||||
String resName = get3DCacheId(resId + "");
|
||||
if (TextUtils.isEmpty(resName)) {
|
||||
marker.setIcon(ViewUtils.fromView(view));
|
||||
cacheMarkerIconResMd5Val(resId + "", marker);
|
||||
} else {
|
||||
marker.use2DResource( resName );
|
||||
marker.use2DResource(resName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.mogo.module.common.drawer.bean;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
/**
|
||||
* 速度显示对象
|
||||
*/
|
||||
public class SpeedData {
|
||||
|
||||
public IMogoMarker marker;
|
||||
public double speed;
|
||||
public String uuid;
|
||||
public int type;
|
||||
public double heading;
|
||||
public boolean isVrMode;
|
||||
|
||||
public SpeedData(IMogoMarker marker, double speed, String uuid, int type, double heading, boolean isVrMode) {
|
||||
this.marker = marker;
|
||||
this.speed = speed;
|
||||
this.uuid = uuid;
|
||||
this.type = type;
|
||||
this.heading = heading;
|
||||
this.isVrMode = isVrMode;
|
||||
}
|
||||
|
||||
public IMogoMarker getMarker() {
|
||||
return marker;
|
||||
}
|
||||
|
||||
public void setMarker(IMogoMarker marker) {
|
||||
this.marker = marker;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public boolean getIsVrMode() {
|
||||
return isVrMode;
|
||||
}
|
||||
|
||||
public void setIsVrMode(boolean isVrMode) {
|
||||
this.isVrMode = isVrMode;
|
||||
}
|
||||
}
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/daba.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/daba.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/tache.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/tache.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/tachexiaoche.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/tachexiaoche.n3d
Normal file
Binary file not shown.
BIN
modules/mogo-module-common/src/main/res/raw/zixingche.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/zixingche.n3d
Normal file
Binary file not shown.
@@ -6,18 +6,18 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.impl.AbsCameraScenario;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 路边摄像头直播控制 V2XPushLiveCarScenario
|
||||
*/
|
||||
public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implements IMogoTopViewStatusListener {
|
||||
public class CameraLiveManager extends AbsCameraScenario<SocketDownData.CloudRoadDataProto> implements IMogoTopViewStatusListener {
|
||||
private static final String TAG = "CameraLiveManager";
|
||||
private static CameraLiveManager mCameraLiveManager;
|
||||
private boolean isShowWindow;
|
||||
@@ -38,7 +38,7 @@ public class CameraLiveManager extends AbsCameraScenario<CloudRoadData> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable CloudRoadData cloudRoadData) {
|
||||
public void init(@Nullable SocketDownData.CloudRoadDataProto cloudRoadData) {
|
||||
Log.d(TAG, "CameraLiveManager init -----> isShowWindow = " + isShowWindow);
|
||||
if (isShowWindow) {
|
||||
close();
|
||||
|
||||
@@ -9,10 +9,10 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.live.impl.ICameraWindow;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.mogo.utils.logger.Logger;
|
||||
* 点击摄像头 marker
|
||||
* vr路边摄像头弹窗 V2XPushLiveCarWindow
|
||||
*/
|
||||
public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindow<CloudRoadData> {
|
||||
public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindow<SocketDownData.CloudRoadDataProto> {
|
||||
private static final String TAG = "PushCameraLiveWindow";
|
||||
private CameraLiveGSYVideoView mLiveGSYVideoView;
|
||||
private MogoImageView mIvReportHead;
|
||||
@@ -65,7 +65,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
* 展示直播Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(CloudRoadData entity) {
|
||||
public void show(SocketDownData.CloudRoadDataProto entity) {
|
||||
if (entity != null) {
|
||||
Logger.w(TAG, "更新直播信息 show entity = " + entity);
|
||||
if (!TextUtils.isEmpty(entity.getRtmpUrl())) {
|
||||
@@ -76,7 +76,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
mLiveGSYVideoView.startLive(entity.getRtmpUrl());
|
||||
}
|
||||
|
||||
countDownV2XEvent(entity);
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PushCameraLiveWindow extends RelativeLayout implements ICameraWindo
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent(CloudRoadData data) {
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
|
||||
@@ -2,15 +2,15 @@ package com.mogo.module.extensions.live.impl;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
|
||||
|
||||
public abstract class AbsCameraScenario<T> implements ICameraScenario {
|
||||
protected String TAG = "AbsCameraScenario";
|
||||
private ICameraWindow mV2XWindow;
|
||||
private CloudRoadData mCloudRoadData;
|
||||
private SocketDownData.CloudRoadDataProto mCloudRoadData;
|
||||
|
||||
public abstract void init(@Nullable CloudRoadData cloudRoadData);
|
||||
public abstract void init(@Nullable SocketDownData.CloudRoadDataProto cloudRoadData);
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
@@ -27,11 +27,11 @@ public abstract class AbsCameraScenario<T> implements ICameraScenario {
|
||||
this.mV2XWindow = mV2XWindow;
|
||||
}
|
||||
|
||||
public CloudRoadData getmCloudRoadData() {
|
||||
public SocketDownData.CloudRoadDataProto getmCloudRoadData() {
|
||||
return mCloudRoadData;
|
||||
}
|
||||
|
||||
public void setmCloudRoadData(CloudRoadData mCloudRoadData) {
|
||||
public void setmCloudRoadData(SocketDownData.CloudRoadDataProto mCloudRoadData) {
|
||||
this.mCloudRoadData = mCloudRoadData;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,11 @@ import android.content.IntentFilter;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.navi.VrModeNavInfoView;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.MogoADASWarnType;
|
||||
@@ -203,7 +202,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData obj) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
@@ -16,8 +17,6 @@ import com.mogo.module.extensions.live.CameraLiveManager;
|
||||
import com.mogo.module.extensions.live.CameraWindow3DAdapter;
|
||||
import com.mogo.module.extensions.live.PushDataType;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -30,7 +29,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
private static final String TAG = "CameraLiveNoticeHelper";
|
||||
private Context mContext;
|
||||
private static IMogoMarker mMogoMarker;
|
||||
private CloudRoadData mCloudRoadData;
|
||||
private SocketDownData.CloudRoadDataProto mCloudRoadData;
|
||||
private volatile boolean isVrMode;
|
||||
private volatile boolean isVrModeMarker;
|
||||
private volatile String mCurrentUuid;
|
||||
@@ -81,7 +80,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
*
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addVrCameraMarker(CloudRoadData roadData) {
|
||||
private void addVrCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
@@ -108,7 +107,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
*
|
||||
* @param roadData 道路数据
|
||||
*/
|
||||
private void addNormalCameraMarker(CloudRoadData roadData) {
|
||||
private void addNormalCameraMarker(SocketDownData.CloudRoadDataProto roadData) {
|
||||
Log.e(TAG, "addNormalCameraMarker --lat = " + roadData.getLat() + " --lon =" + roadData.getLon() + "--uuid = " + roadData.getUuid() + "---rtmpUrl =" + roadData.getRtmpUrl());
|
||||
if (!TextUtils.isEmpty(roadData.getRtmpUrl())) {
|
||||
removeCameraMarker();
|
||||
@@ -137,7 +136,7 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderMarker(MogoSnapshotSetData obj) {
|
||||
private void renderMarker(SocketDownData.LauncherSnapshotProto obj) {
|
||||
if (obj != null) {
|
||||
if (obj.getCamera() != null && !TextUtils.isEmpty(obj.getCamera().getRtmpUrl())) {
|
||||
mCloudRoadData = obj.getCamera();
|
||||
@@ -189,8 +188,8 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
//Logger.d(TAG, "onMsgReceived mogoSnapshotSetData : " + mogoSnapshotSetData);
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
renderMarker(mogoSnapshotSetData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,5 +14,13 @@
|
||||
<action android:name="com.nwd.action.ACTION_MCU_STATE_CHANGE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".dispatch.DispatchTestPanelBroadCastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.dispatch.test_panel_control" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.dispatch.DispatchAutoPilotManager;
|
||||
import com.mogo.module.service.location.MogoRTKLocation;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
@@ -101,9 +102,10 @@ public class MogoServiceProvider implements IMogoModuleProvider {
|
||||
MarkerServiceHandler.init( context );
|
||||
// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
// }
|
||||
MogoRTKLocation.getInstance().init();
|
||||
// MogoRTKLocation.getInstance().init(); //todo RTK LOCATION Close
|
||||
MogoServices.getInstance().preInit( context );
|
||||
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
|
||||
DispatchAutoPilotManager.getInstance().initSocket(context);
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
}, 5_000L );
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
@@ -47,6 +47,7 @@ import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
@@ -391,6 +392,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
MoGoAiCloudRealTime.startRealTime( mContext, DebugConfig.getSocketAppId() );
|
||||
}
|
||||
TimeDelayUploadManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
public void initLocationServiceProcess( Context context ) {
|
||||
@@ -960,6 +962,11 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) {
|
||||
|
||||
if(TimeDelayUploadManager.getInstance().isMock()){ //模拟数据时,不更新由工控机传输的自车位置
|
||||
return;
|
||||
}
|
||||
|
||||
if ( stateInfo != null && stateInfo.getValues() != null ) {
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
@@ -991,7 +998,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import static com.mogo.module.service.dispatch.model.DispatchServiceModel.DISPATCH_RESULT_AFFIRM;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.dispatch.bean.AutopilotRoute;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchData;
|
||||
import com.mogo.module.service.dispatch.bean.EndLatLon;
|
||||
import com.mogo.module.service.dispatch.bean.StartLatLon;
|
||||
import com.mogo.module.service.dispatch.model.DispatchResult;
|
||||
import com.mogo.module.service.dispatch.model.DispatchServiceModel;
|
||||
import com.mogo.module.service.dispatch.model.IDispatch;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//todo 后续拆解是否放到网约车模块,画线部分已与产品沟通,放入后续迭代需求
|
||||
//负责监听自动驾驶状态并进行状态上报,自动驾驶路线上报,接收调度指令展示指令弹窗
|
||||
public class DispatchAutoPilotManager implements IMogoOnMessageListener<DispatchAdasAutoPilotLocReceiverBean>
|
||||
, DispatchRemindDialog.IDispatchRemindClickListener
|
||||
, IMogoCarLocationChangedListener2 {
|
||||
|
||||
private static final String TAG = "DispatchAutoPilotManager";
|
||||
private static volatile DispatchAutoPilotManager instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Context mContext;
|
||||
private static final int MSG_SOCKET_TYPE = 501000;
|
||||
private static final int MSG_TYPE_SHOW_DIALOG = 0;
|
||||
|
||||
private DispatchRemindDialog dispatchRemindDialog;
|
||||
private MogoLocation mogoLocation;
|
||||
private DispatchAdasAutoPilotLocReceiverBean receiverBean;
|
||||
|
||||
private DispatchAutoPilotManager() {
|
||||
|
||||
}
|
||||
|
||||
public static DispatchAutoPilotManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new DispatchAutoPilotManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_TYPE_SHOW_DIALOG) {
|
||||
DispatchAdasAutoPilotLocReceiverBean msgData = (DispatchAdasAutoPilotLocReceiverBean) msg.obj;
|
||||
dispatchRemindDialog.showDialog(msgData);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void initSocket(Context context) {
|
||||
mContext = context;
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
dispatchRemindDialog = new DispatchRemindDialog(context);
|
||||
dispatchRemindDialog.addIDispatchRemindListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DispatchAdasAutoPilotLocReceiverBean> target() {
|
||||
return DispatchAdasAutoPilotLocReceiverBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getStartLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getStartLon() != 0.0) {
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
Message message = new Message();
|
||||
message.what = MSG_TYPE_SHOW_DIALOG;
|
||||
message.obj = adasAutoPilotLocReceiverBean;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void affirm() {
|
||||
DispatchServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Logger.d(TAG, "");
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.isSpeakVoice = false;
|
||||
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon());
|
||||
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon());
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
//坐标转换
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
mogoLocation = loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng mogoLatLng) {
|
||||
|
||||
}
|
||||
|
||||
public void test() {
|
||||
Logger.d(TAG, "test to trigger mock autopilot");
|
||||
DispatchAdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean = new DispatchAdasAutoPilotLocReceiverBean(
|
||||
"1", 26.825571122, 112.5762410415, "起点---5号跑道",
|
||||
26.825571122, 112.5762410415, "终点---鄂州机场",
|
||||
"" + System.currentTimeMillis(), "AR453航班", "实现调度", System.currentTimeMillis());
|
||||
this.receiverBean = adasAutoPilotLocReceiverBean;
|
||||
dispatchRemindDialog.showDialog(adasAutoPilotLocReceiverBean);
|
||||
}
|
||||
|
||||
public void testUploadAutopilotRoute() {
|
||||
List<AutopilotRoute.RouteModels> list = new ArrayList<>();
|
||||
AutopilotRoute.RouteModels routeModels = new AutopilotRoute.RouteModels();
|
||||
routeModels.setLat(12.12);
|
||||
routeModels.setLon(13.14);
|
||||
list.add(routeModels);
|
||||
DispatchServiceModel.getInstance().uploadAutopilotRoute(list);
|
||||
}
|
||||
|
||||
public void testDispatchResultUpload() {
|
||||
DispatchServiceModel.getInstance().dispatchResultUpload(DISPATCH_RESULT_AFFIRM, new IDispatch() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String msg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.dispatch.bean.DispatchAdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "DispatchRemindDialog";
|
||||
private IDispatchRemindClickListener mListener;
|
||||
|
||||
private final TextView tvStartLoc;
|
||||
private final TextView tvEndLoc;
|
||||
private final TextView tvTaskTime;
|
||||
private final TextView tvFlightInfo;
|
||||
private final TextView tvTaskContent;
|
||||
|
||||
public DispatchRemindDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.module_dialog_adas_dispatch_remind);
|
||||
setCanceledOnTouchOutside(false);
|
||||
tvStartLoc = findViewById(R.id.module_services_dispatch_dialog_start_content);
|
||||
tvEndLoc = findViewById(R.id.module_services_dispatch_dialog_end_content);
|
||||
tvTaskTime = findViewById(R.id.module_services_dispatch_dialog_task_time);
|
||||
tvFlightInfo = findViewById(R.id.module_services_dispatch_dialog_flight_time);
|
||||
tvTaskContent = findViewById(R.id.module_services_dispatch_dialog_task_content);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_services_dispatch_dialog_confirm);
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void showDialog(DispatchAdasAutoPilotLocReceiverBean dispatchContent) {
|
||||
show();
|
||||
tvStartLoc.setText(dispatchContent.getStartLocAddress());
|
||||
tvEndLoc.setText(dispatchContent.getEndLocAddress());
|
||||
tvTaskTime.setText(dispatchContent.getTaskTime());
|
||||
tvFlightInfo.setText(dispatchContent.getFlightInfo());
|
||||
tvTaskContent.setText(dispatchContent.getTaskInfo());
|
||||
}
|
||||
|
||||
private void dismissDialog() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void addIDispatchRemindListener(IDispatchRemindClickListener listener) {
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "addIDispatchRemindListener listener is null");
|
||||
return;
|
||||
}
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
public interface IDispatchRemindClickListener {
|
||||
|
||||
void affirm();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mogo.module.service.dispatch;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class DispatchTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "DispatchTestPanelBroadCastReceiver";
|
||||
|
||||
/**
|
||||
* Adas测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "textPanelOpenType:" + sceneType);
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发处理场景
|
||||
*
|
||||
* @param sceneType 场景类型
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
if (sceneType == 0) {//打开调度弹窗
|
||||
DispatchAutoPilotManager.getInstance().test();
|
||||
} else if(sceneType == 1){ //验证自动驾驶路线上报接口
|
||||
DispatchAutoPilotManager.getInstance().testUploadAutopilotRoute();
|
||||
} else if(sceneType == 2){ //验证自动驾驶调度上报接口
|
||||
DispatchAutoPilotManager.getInstance().testDispatchResultUpload();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class DispatchAdasAutoPilotLocReceiverBean {
|
||||
|
||||
private String poiId;
|
||||
|
||||
private double startLat;
|
||||
private double startLon;
|
||||
private String startLocAddress;
|
||||
|
||||
private double endLat;
|
||||
private double endLon;
|
||||
private String endLocAddress;
|
||||
|
||||
private String taskTime;
|
||||
private String flightInfo;
|
||||
private String taskInfo;
|
||||
private long systemTime;
|
||||
|
||||
public DispatchAdasAutoPilotLocReceiverBean(String poiId, double startLat, double startLon, String startLocAddress, double endLat, double endLon, String endLocAddress, String taskTime, String flightInfo, String taskInfo, long systemTime) {
|
||||
this.poiId = poiId;
|
||||
this.startLat = startLat;
|
||||
this.startLon = startLon;
|
||||
this.startLocAddress = startLocAddress;
|
||||
this.endLat = endLat;
|
||||
this.endLon = endLon;
|
||||
this.endLocAddress = endLocAddress;
|
||||
this.taskTime = taskTime;
|
||||
this.flightInfo = flightInfo;
|
||||
this.taskInfo = taskInfo;
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public String getPoiId() {
|
||||
return poiId;
|
||||
}
|
||||
|
||||
public void setPoiId(String poiId) {
|
||||
this.poiId = poiId;
|
||||
}
|
||||
|
||||
public double getStartLat() {
|
||||
return startLat;
|
||||
}
|
||||
|
||||
public void setStartLat(double startLat) {
|
||||
this.startLat = startLat;
|
||||
}
|
||||
|
||||
public double getStartLon() {
|
||||
return startLon;
|
||||
}
|
||||
|
||||
public void setStartLon(double startLon) {
|
||||
this.startLon = startLon;
|
||||
}
|
||||
|
||||
public String getStartLocAddress() {
|
||||
return startLocAddress;
|
||||
}
|
||||
|
||||
public void setStartLocAddress(String startLocAddress) {
|
||||
this.startLocAddress = startLocAddress;
|
||||
}
|
||||
|
||||
public double getEndLat() {
|
||||
return endLat;
|
||||
}
|
||||
|
||||
public void setEndLat(double endLat) {
|
||||
this.endLat = endLat;
|
||||
}
|
||||
|
||||
public double getEndLon() {
|
||||
return endLon;
|
||||
}
|
||||
|
||||
public void setEndLon(double endLon) {
|
||||
this.endLon = endLon;
|
||||
}
|
||||
|
||||
public String getEndLocAddress() {
|
||||
return endLocAddress;
|
||||
}
|
||||
|
||||
public void setEndLocAddress(String endLocAddress) {
|
||||
this.endLocAddress = endLocAddress;
|
||||
}
|
||||
|
||||
public String getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
public void setTaskTime(String taskTime) {
|
||||
this.taskTime = taskTime;
|
||||
}
|
||||
|
||||
public String getFlightInfo() {
|
||||
return flightInfo;
|
||||
}
|
||||
|
||||
public void setFlightInfo(String flightInfo) {
|
||||
this.flightInfo = flightInfo;
|
||||
}
|
||||
|
||||
public String getTaskInfo() {
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
public void setTaskInfo(String taskInfo) {
|
||||
this.taskInfo = taskInfo;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DispatchAdasAutoPilotLocReceiverBean{" +
|
||||
"poiId='" + poiId + '\'' +
|
||||
", startLat=" + startLat +
|
||||
", startLon=" + startLon +
|
||||
", startLocAddress='" + startLocAddress + '\'' +
|
||||
", endLat=" + endLat +
|
||||
", endLon=" + endLon +
|
||||
", endLocAddress='" + endLocAddress + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", flightInfo='" + flightInfo + '\'' +
|
||||
", taskInfo='" + taskInfo + '\'' +
|
||||
", systemTime=" + systemTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class EndLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public EndLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = 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 "EndLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class ReportDispatchResult {
|
||||
|
||||
private String sn;
|
||||
private int dispatchResult;
|
||||
|
||||
public ReportDispatchResult(String sn, int dispatchResult) {
|
||||
this.sn = sn;
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getDispatchResult() {
|
||||
return dispatchResult;
|
||||
}
|
||||
|
||||
public void setDispatchResult(int dispatchResult) {
|
||||
this.dispatchResult = dispatchResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReportDispatchResult{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", dispatchResult=" + dispatchResult +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
|
||||
/**
|
||||
* 上报自动驾驶规划的路径
|
||||
*/
|
||||
public class ReportedRoute {
|
||||
private String sn;
|
||||
private AutopilotStatus.ValuesBean bean;
|
||||
private String siteList;
|
||||
|
||||
public ReportedRoute(String sn, AutopilotStatus.ValuesBean bean) {
|
||||
this.sn = sn;
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
public ReportedRoute(String sn, String siteList) {
|
||||
this.sn = sn;
|
||||
this.siteList = siteList;
|
||||
}
|
||||
|
||||
public String getSiteList() {
|
||||
return siteList;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return "{\"sn\":\"" + sn + "\",\"state\":" + bean.getState() + ",\"speed\":" + bean.getSpeed() + ",\"reason\":\"" + bean.getReason() + "\",\"camera\":" + bean.getCamera() + ",\"radar\":" + bean.getRadar() + ",\"rtk\":" + bean.getRtk() + "}";
|
||||
}
|
||||
|
||||
public String getRoute() {
|
||||
return "{\"sn\":\"" + sn + "\",\"siteList\":" + siteList + "}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class StartLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public StartLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = 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 "StartLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
|
||||
|
||||
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.ReportDispatchResult;
|
||||
import com.mogo.module.service.dispatch.bean.ReportedRoute;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class DispatchServiceModel {
|
||||
|
||||
private static final String TAG = "AdasServiceModel";
|
||||
private static volatile DispatchServiceModel instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public static final int DISPATCH_RESULT_AFFIRM = 0;
|
||||
public static final int DISPATCH_RESULT_MANUAL_CANCEL = 1;
|
||||
public static final int DISPATCH_RESULT_TIMER_CANCEL = 2;
|
||||
|
||||
private final IDispatchAdasApiService mAdasApiService;
|
||||
|
||||
private DispatchServiceModel() {
|
||||
this.mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(IDispatchAdasApiService.class, DATA_SERVICE_HOST);
|
||||
}
|
||||
|
||||
public static DispatchServiceModel getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new DispatchServiceModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路线
|
||||
*
|
||||
* @param list 路线集合
|
||||
*/
|
||||
public void uploadAutopilotRoute(List<AutopilotRoute.RouteModels> list) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportedRoute reportedRoute = new ReportedRoute(sn, GsonUtil.jsonFromObject(list));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportedRoute));
|
||||
mAdasApiService.uploadAutopilotRoute(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "uploadAutopilotRoute success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "uploadAutopilotRoute error : " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报调度处理结果
|
||||
*
|
||||
* @param dispatchResultType int
|
||||
*/
|
||||
public void dispatchResultUpload(int dispatchResultType, IDispatch dispatch) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportDispatchResult reportDispatchResult = new ReportDispatchResult(sn, dispatchResultType);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", sn);
|
||||
map.put("data", GsonUtil.jsonFromObject(reportDispatchResult));
|
||||
mAdasApiService.uploadDispatchResult(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onNext(BaseData o) {
|
||||
super.onNext(o);
|
||||
Logger.d(TAG, "dispatchResultUpload success");
|
||||
dispatch.onSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "dispatchResultUpload error : " + e.getMessage());
|
||||
dispatch.onError(e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
public interface IDispatch {
|
||||
|
||||
void onSuccess();
|
||||
|
||||
void onError(String msg);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.module.service.dispatch.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface IDispatchAdasApiService {
|
||||
|
||||
/**
|
||||
* 上报自动驾驶路径 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiveCarPreSetPath")
|
||||
Observable<BaseData> uploadAutopilotRoute(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 上报自动驾驶调度处理结果 服务于业务调度
|
||||
*
|
||||
* @param parameters map
|
||||
* @return {@link BaseData}
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/autoDriver/receiverDestSiteResult")
|
||||
Observable<BaseData> uploadDispatchResult(@FieldMap Map<String, Object> parameters);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
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;
|
||||
@@ -73,7 +73,7 @@ class ADASStatusIntentHandler implements IntentHandler {
|
||||
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
|
||||
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownDataHelper;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -31,16 +33,14 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
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.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
@@ -77,9 +77,11 @@ public class MockIntentHandler implements IntentHandler {
|
||||
final int oper = intent.getIntExtra("oper", -1);
|
||||
switch (oper) {
|
||||
case 1:
|
||||
// 展示自车位置
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(intent.getBooleanExtra("status", true));
|
||||
break;
|
||||
case 2:
|
||||
// 发起求助
|
||||
boolean status = intent.getBooleanExtra("status", false);
|
||||
MarkerServiceHandler.getMogoStatusManager().setSeekHelping(TAG, status);
|
||||
break;
|
||||
@@ -339,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));
|
||||
@@ -403,7 +405,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.syncLocation2Map(null);
|
||||
break;
|
||||
case 40:
|
||||
|
||||
double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375},
|
||||
{40.20258331298828, 116.74071502685547},
|
||||
{40.202598571777344, 116.74067687988281},
|
||||
@@ -444,7 +445,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
{40.20254135131836, 116.74005889892578},
|
||||
{40.20252990722656, 116.74007415771484},
|
||||
{40.20254898071289, 116.74008178710938},
|
||||
|
||||
{40.20254135131836, 116.74005889892578},
|
||||
{40.20252227783203, 116.74006652832031},
|
||||
{40.20254898071289, 116.74002838134766},
|
||||
@@ -543,8 +543,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.openVrMode(false);
|
||||
break;
|
||||
case 46:// 模拟 自车周边数据
|
||||
String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class));
|
||||
// String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(GsonUtil.objectFromJson(json, MogoSnapshotSetData.class));
|
||||
break;
|
||||
case 47:// 模拟鹰眼模式下绘制车辆周边的数据
|
||||
mTimeTickHandler.sendEmptyMessageDelayed(1, 0L);
|
||||
@@ -603,8 +603,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
DebugConfig.setSelfCarSpeedYOffset(intent.getIntExtra("yOffset", 20));
|
||||
break;
|
||||
case 51:// 模拟路口车辆移动
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(100, 0L);
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed(101, 1000L);
|
||||
break;
|
||||
case 52:
|
||||
// 打开连调工控机、ADAS的控制面板
|
||||
@@ -616,7 +616,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
DebugConfig.setUseAdasRecognize(isUseAdasRecognize);
|
||||
break;
|
||||
case 54:
|
||||
mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
|
||||
// mTimeTickCarHandler.sendEmptyMessageDelayed(1, 0L);
|
||||
break;
|
||||
case 55:
|
||||
//开启模拟数据Mock,用于验证算法准确性
|
||||
@@ -647,18 +647,22 @@ public class MockIntentHandler implements IntentHandler {
|
||||
*/
|
||||
private void handleRoadSideMockDataIntent() throws Exception {
|
||||
if (roadSizeBr == null) {
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt")));
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt"))); //todo 需要重新模拟一个test数据
|
||||
}
|
||||
String carsLine = roadSizeBr.readLine();
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List<CloudRoadData> allList = GsonUtil.arrayFromJson(carsLine, CloudRoadData.class);
|
||||
for (CloudRoadData cloudRoadData : allList) {
|
||||
cloudRoadData.setWgslat(cloudRoadData.getLat());
|
||||
cloudRoadData.setWgslon(cloudRoadData.getLon());
|
||||
cloudRoadData.setFromType(CloudRoadData.FROM_ROAD_UNIT);
|
||||
SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
List<SocketDownData.CloudRoadDataProto> allList = GsonUtil.arrayFromJson(carsLine, SocketDownData.CloudRoadDataProto.class);
|
||||
if (allList == null || allList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
data.setAllList(allList);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data);
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allList) {
|
||||
cloudRoadData.toBuilder()
|
||||
.setWgslat(cloudRoadData.getLon())
|
||||
.setWgslon(cloudRoadData.getLon())
|
||||
.setFromType(SocketDownDataHelper.FROM_ROAD_UNIT);
|
||||
}
|
||||
data.addAllAllList(allList);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(101, 100L);
|
||||
}
|
||||
|
||||
@@ -848,9 +852,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
//改变rtk定位数据,触发自车移动
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
|
||||
Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
SnapshotLocationDataCenter.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;
|
||||
}
|
||||
|
||||
@@ -861,29 +865,30 @@ public class MockIntentHandler implements IntentHandler {
|
||||
* 模拟快照意图
|
||||
*/
|
||||
private boolean handleMockSnapshotIntent2() throws Exception {
|
||||
if (br4 == null) {
|
||||
br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt")));
|
||||
}
|
||||
String line = br4.readLine();
|
||||
if (line == null) {
|
||||
throw new Exception("end of file 2.");
|
||||
}
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List<CloudRoadData> allList = new ArrayList<>();
|
||||
CloudRoadData cloudRoadData = GsonUtil.objectFromJson(line, CloudRoadData.class);
|
||||
if (cloudRoadData == null) {
|
||||
return false;
|
||||
}
|
||||
cloudRoadData.setWgslon(cloudRoadData.getLon());
|
||||
cloudRoadData.setWgslat(cloudRoadData.getLat());
|
||||
cloudRoadData.setUuid("1_21");
|
||||
allList.add(cloudRoadData);
|
||||
data.setAllList(allList);
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data);
|
||||
Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
// if (br4 == null) {
|
||||
// br4 = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("snapshot.txt"))); todo 需要重新模拟一个test数据
|
||||
// }
|
||||
// String line = br4.readLine();
|
||||
// if (line == null) {
|
||||
// throw new Exception("end of file 2.");
|
||||
// }
|
||||
// SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
// List<SocketDownData.CloudRoadDataProto> allList = new ArrayList<>();
|
||||
// SocketDownData.CloudRoadDataProto cloudRoadData = GsonUtil.objectFromJson(line, SocketDownData.CloudRoadDataProto.class);
|
||||
// if (cloudRoadData == null) {
|
||||
// return false;
|
||||
// }
|
||||
// SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
// builder.setWgslat(cloudRoadData.getLon());
|
||||
// builder.setWgslon(cloudRoadData.getLat());
|
||||
// builder.setUuid("1_21");
|
||||
// allList.add(cloudRoadData);
|
||||
// data.addAllAllList(allList);
|
||||
//
|
||||
// final long start = System.currentTimeMillis();
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
// Log.i("mock-timer-snapshot", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
//// mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -897,8 +902,8 @@ public class MockIntentHandler implements IntentHandler {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if (readers == null) {
|
||||
readers = new BufferedReader[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
readers = new BufferedReader[200];
|
||||
for (int i = 0; i < 200; i++) {
|
||||
readers[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adas" + i + ".txt")));
|
||||
}
|
||||
}
|
||||
@@ -912,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;
|
||||
}
|
||||
@@ -942,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.service.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
@@ -9,8 +10,8 @@ import android.os.Bundle;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class MogoRTKLocation {
|
||||
@@ -29,6 +30,7 @@ public class MogoRTKLocation {
|
||||
private MogoRTKLocation() {
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
public void init() {
|
||||
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
String provider = locationManager.getBestProvider(getCriteria(), true);
|
||||
@@ -74,7 +76,7 @@ public class MogoRTKLocation {
|
||||
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.getTileId(location.getLongitude(), location.getLatitude())));
|
||||
SnapshotLocationController.getInstance().syncLocationInfo(cloudLocationInfo);
|
||||
SnapshotLocationDataCenter.getInstance().syncLocationInfo(cloudLocationInfo);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "location == null");
|
||||
@@ -102,7 +104,7 @@ public class MogoRTKLocation {
|
||||
if (locationManager != null && locationListener != null) {
|
||||
locationManager.removeUpdates(locationListener);
|
||||
} else {
|
||||
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
|
||||
Logger.d(TAG, "stop failed , listener: " + locationListener + " is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -39,10 +40,9 @@ import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.polyline.LimberCollisionPolyline;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -147,7 +147,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
Message msg = mSnapshotHandler.obtainMessage();
|
||||
msg.obj = mogoSnapshotSetData;
|
||||
@@ -207,8 +207,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.obj instanceof MogoSnapshotSetData) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(((MogoSnapshotSetData) msg.obj));
|
||||
if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj));
|
||||
} else if (msg.obj == null) {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(null);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,16 @@
|
||||
package com.mogo.module.service.spi;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.entity.SocketReceiveDataProto3;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service(value = IRealTimeProvider.class)
|
||||
public class SPIRealTimeUpload implements IRealTimeProvider {
|
||||
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
return MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CloudLocationInfo> getLocationMsg() {
|
||||
return SnapshotLocationController.getInstance().getSendLocationData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocationAccuracy() {
|
||||
return SnapshotLocationController.getInstance().getDataAccuracy();
|
||||
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -69,16 +71,17 @@ public class EnvStatusManager {
|
||||
|
||||
private void renderStatus() {
|
||||
String[] sStatusName = {
|
||||
"定位",
|
||||
"近景",
|
||||
"下发",
|
||||
"AUTO",
|
||||
"长链",
|
||||
"工控机定位",
|
||||
"ADAS近景感知",
|
||||
"云端远景感知",
|
||||
"自动驾驶状态",
|
||||
"socket长链",
|
||||
"经度",
|
||||
"纬度",
|
||||
"网络状态",
|
||||
"App版本",
|
||||
"Map版本"
|
||||
"Map版本",
|
||||
"SN"
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < sStatusName.length; i++) {
|
||||
@@ -92,7 +95,12 @@ public class EnvStatusManager {
|
||||
} else if (i == 8) {
|
||||
stringBuilder.append(getVersionName(mContext, "com.mogo.launcher.f")).append("\n");
|
||||
} else if (i == 9) {
|
||||
stringBuilder.append(AppUtils.getCustomMapSDKVersion(mContext)).append("\n");
|
||||
String mapVersion = AppUtils.getCustomMapSDKVersion(mContext);
|
||||
if (!TextUtils.isEmpty(mapVersion)) {
|
||||
stringBuilder.append(mapVersion).append("\n");
|
||||
}
|
||||
} else if(i == 10){
|
||||
stringBuilder.append(MoGoAiCloudClientConfig.getInstance().getSn()).append("\n");
|
||||
} else {
|
||||
stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n");
|
||||
}
|
||||
@@ -108,10 +116,6 @@ public class EnvStatusManager {
|
||||
mStatusTv.setTextColor(Color.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
//添加网络状态
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@@ -4,22 +4,23 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.network.TimeDelayApiService;
|
||||
import com.mogo.module.service.network.bean.MockSocketReceiverData;
|
||||
import com.mogo.module.service.network.bean.MockSocketSendData;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -53,6 +54,7 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
private long mRecordSatelliteTime; //todo 后续多点模拟用
|
||||
|
||||
private TimeDelayApiService timeDelayApiService;
|
||||
private IMogoADASController adasControllerApi;
|
||||
|
||||
private TimeDelayUploadManager() {
|
||||
|
||||
@@ -69,11 +71,16 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
return timeDelayUploadManager;
|
||||
}
|
||||
|
||||
public boolean isMock() {
|
||||
return isMockData;
|
||||
}
|
||||
|
||||
public void init(Context mContext) {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(this);
|
||||
adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
}
|
||||
|
||||
private final Handler mockHandler = new Handler(WorkThreadHandler.newInstance("mock-algorithm-work-thread").getLooper()) {
|
||||
@@ -93,7 +100,7 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo);
|
||||
mockHandler.sendEmptyMessageDelayed(MOCK_MSG, 50);
|
||||
}
|
||||
}
|
||||
@@ -137,10 +144,11 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
//接收实时数据监听回调,用于给服务端上报时延
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
if (isMockData) {
|
||||
Logger.d(TAG,"收到下发数据 mogoSnapshotSetData : " + mogoSnapshotSetData.toString());
|
||||
//接口数据上报
|
||||
CloudRoadData result = mogoSnapshotSetData.getAllList()
|
||||
SocketDownData.CloudRoadDataProto result = mogoSnapshotSetData.getAllListList()
|
||||
.stream()
|
||||
.filter(cloudRoadData -> cloudRoadData.getUuid().contains("serialNumber_"))
|
||||
.findAny()
|
||||
@@ -149,12 +157,19 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
Logger.d(TAG, "未找到与之匹配数据");
|
||||
return;
|
||||
}
|
||||
MockSocketSendData mockSocketSendData = new MockSocketSendData(System.currentTimeMillis(), result.getUuid(), result.getSatelliteTime());
|
||||
Logger.d(TAG,"找到匹配数据 result : " + result.toString());
|
||||
long satelliteTime;
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) {
|
||||
satelliteTime = System.currentTimeMillis();
|
||||
} else {
|
||||
satelliteTime = Long.parseLong(adasControllerApi.getSatelliteTime());
|
||||
}
|
||||
MockSocketSendData mockSocketSendData = new MockSocketSendData(satelliteTime, result.getUuid(), result.getSatelliteTime());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sn", Utils.getSn());
|
||||
map.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
map.put("data", GsonUtil.jsonFromObject(mockSocketSendData));
|
||||
Logger.d(TAG, "mockSocketSendData : " + GsonUtil.jsonFromObject(mockSocketSendData));
|
||||
Logger.d(TAG, "data uuid : " + result.getUuid() + " duration : " + (System.currentTimeMillis() - result.getSatelliteTime()));
|
||||
Logger.d(TAG, "data uuid : " + result.getUuid() + " duration : " + (satelliteTime - result.getSatelliteTime()));
|
||||
timeDelayApiService.uploadDelayData(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -171,4 +186,5 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.service.utils;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
|
||||
/**
|
||||
* 定位数据类型转换工具
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.os.SystemClock;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/module_services_dispatch_bg" />
|
||||
<corners android:radius="@dimen/module_services_dispatch_dialog_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/module_services_dispatch_affirm_bg" />
|
||||
<corners android:radius="@dimen/module_services_dispatch_dialog_affirm_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/module_services_dispatch_dialog_width"
|
||||
android:layout_height="@dimen/module_services_dispatch_dialog_height"
|
||||
android:background="@drawable/bg_adas_dispatch">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_title_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_title"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_startloc_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_start_loc"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_next_level_title_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_start_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_startloc_content_margin_top"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_endloc_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_end_loc"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_next_level_title_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_end_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_endloc_content_margin_top"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_task_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_task_info"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_next_level_title_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_task_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_first_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_task_content_margin_top"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_task_content_size" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_last_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_startloc_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_task_time"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_next_level_title_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_task_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_last_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_startloc_content_margin_top"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_last_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_endloc_margin_top"
|
||||
android:text="@string/module_services_dispatch_dialog_flight_info"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_next_level_title_size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_dispatch_dialog_flight_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_services_dispatch_dialog_last_column_margin_left"
|
||||
android:layout_marginTop="@dimen/module_services_dispatch_dialog_endloc_content_margin_top"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/module_services_dispatch_dialog_confirm"
|
||||
android:layout_width="@dimen/module_services_dispatch_dialog_affirm_width"
|
||||
android:layout_height="@dimen/module_services_dispatch_dialog_affirm_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/module_services_dispatch_dialog_margin_bottom"
|
||||
android:background="@drawable/bg_adas_dispatch_affirm"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_services_dispatch_dialog_affirm"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_services_dispatch_dialog_title_size"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_services_dispatch_dialog_width">1263px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_height">1173px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_corner">32px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_next_level_title_size">38px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_title_size">48px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_content_size">42px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_startloc_margin_top">219px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_startloc_content_margin_top">288px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_endloc_margin_top">415px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_endloc_content_margin_top">484px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_margin_top">621px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_content_margin_top">690px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_first_column_margin_left">100px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_last_column_margin_left">852px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_margin_bottom">80px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_width">700px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_height">140px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_corner">70px</dimen>
|
||||
</resources>
|
||||
@@ -9,4 +9,6 @@
|
||||
<color name="module_services_id_panel_item_avatar_border_color">#3081A4DC</color>
|
||||
<color name="module_services_empty_tip_textColor">#B2FFFFFF</color>
|
||||
<color name="module_services_error_textColor">#FFFFFF</color>
|
||||
<color name="module_services_dispatch_bg">#E63B4577</color>
|
||||
<color name="module_services_dispatch_affirm_bg">#3E7BFE</color>
|
||||
</resources>
|
||||
@@ -59,5 +59,24 @@
|
||||
<dimen name="module_services_panel_item_nickname_marginTop">3px</dimen>
|
||||
<dimen name="module_services_panel_item_distance_tag_marginBottom">3px</dimen>
|
||||
<dimen name="module_services_panel_item_start">24px</dimen>
|
||||
¬
|
||||
|
||||
<dimen name="module_services_dispatch_dialog_width">1263px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_height">1173px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_corner">32px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_next_level_title_size">38px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_title_size">48px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_content_size">42px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_title_margin_top">55px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_startloc_margin_top">219px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_startloc_content_margin_top">288px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_endloc_margin_top">415px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_endloc_content_margin_top">484px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_margin_top">621px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_task_content_margin_top">690px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_first_column_margin_left">100px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_last_column_margin_left">852px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_margin_bottom">80px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_width">700px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_height">140px</dimen>
|
||||
<dimen name="module_services_dispatch_dialog_affirm_corner">70px</dimen>
|
||||
</resources>
|
||||
@@ -12,4 +12,11 @@
|
||||
<string name="module_services_online_car_panel_empty_tmpl">很抱歉,目的地%d公里内未找到车友</string>
|
||||
<string name="module_services_online_car_panel_title">目的地车友</string>
|
||||
<string name="module_services_error_text">加载失败,请点击重试</string>
|
||||
<string name="module_services_dispatch_dialog_title">您有新的工作任务</string>
|
||||
<string name="module_services_dispatch_dialog_start_loc">开始地点:</string>
|
||||
<string name="module_services_dispatch_dialog_end_loc">结束地点:</string>
|
||||
<string name="module_services_dispatch_dialog_task_time">任务时间:</string>
|
||||
<string name="module_services_dispatch_dialog_task_info">任务内容:</string>
|
||||
<string name="module_services_dispatch_dialog_flight_info">航班信息:</string>
|
||||
<string name="module_services_dispatch_dialog_affirm">接受任务</string>
|
||||
</resources>
|
||||
|
||||
@@ -4,9 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
/**
|
||||
* 绘制可变宽度和渐变的线
|
||||
|
||||
@@ -7,14 +7,11 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -6,10 +6,6 @@ import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XWaringManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* 单车预警,车辆盲区预警,弱势交通参与者预警
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.service.adas;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -180,14 +180,21 @@ public interface IMogoADASController extends IProvider {
|
||||
*/
|
||||
double getLastSpeed();
|
||||
|
||||
/**
|
||||
* 获取由工控机传回的GPS星历时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSatelliteTime();
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
void cancelAutopilot();
|
||||
|
||||
void mockAdasLoc( String json );
|
||||
void mockAdasLoc(String json);
|
||||
|
||||
void mockAdasRecognized( List< ADASRecognizedResult > recognizedResults );
|
||||
void mockAdasRecognized(List<ADASRecognizedResult> recognizedResults);
|
||||
|
||||
void mockAdasRecognized( String json );
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.mogo.service.adas.entity;
|
||||
|
||||
/*
|
||||
* adas 识别物体参数
|
||||
*/
|
||||
public class ADASRecognizedResult {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
public String color;
|
||||
|
||||
/**
|
||||
* 车ID
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
public long systemTime;
|
||||
|
||||
/**
|
||||
* 定位卫星时间
|
||||
*/
|
||||
public long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
public double alt;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
|
||||
/**
|
||||
* 莫顿码
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* 实际距离
|
||||
* 使用distanceX和distanceY计算
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
/**
|
||||
* 数据来源精度
|
||||
* 0:普通定位
|
||||
* 1:高精定位
|
||||
*/
|
||||
public int dataAccuracy;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
public String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
public String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
public int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
public double rateLimiting;
|
||||
|
||||
/**
|
||||
* 瓦片id
|
||||
*/
|
||||
public String tileId;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
public double roadWidth;
|
||||
|
||||
/**
|
||||
* 1 绿, 2 黄, 3 红
|
||||
*/
|
||||
public int drawlevel;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.mogo.service.connection;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -50,5 +51,5 @@ public interface IMogoSocketManager extends IProvider {
|
||||
* @param body 消息体
|
||||
* @param listener 回执监听
|
||||
*/
|
||||
void sendMsg( MsgBody body, IMogoMsgAckListener listener );
|
||||
void sendMsg(MsgBody body, IMogoMsgAckListener listener );
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.service.connection;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MsgBody {
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private int mMsgType;
|
||||
|
||||
// /**
|
||||
// * 服务端分发,业务线
|
||||
// */
|
||||
// private int mProductLine = MogoCommon.Product.mogoBussiness_VALUE;
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private int mHeaderType = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
||||
|
||||
/**
|
||||
* 是否回执
|
||||
*/
|
||||
private boolean mAck = false;
|
||||
|
||||
/**
|
||||
* 消息ID
|
||||
*/
|
||||
private final long mMsgId = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private byte[] mContent;
|
||||
|
||||
public MsgBody msgType( int msgType ) {
|
||||
this.mMsgType = msgType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody ack( boolean ack ) {
|
||||
this.mAck = ack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody content( byte[] object ) {
|
||||
this.mContent = object;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return mMsgType;
|
||||
}
|
||||
|
||||
public boolean isAck() {
|
||||
return mAck;
|
||||
}
|
||||
|
||||
public long getMsgId() {
|
||||
return mMsgId;
|
||||
}
|
||||
|
||||
public byte[] getContent() {
|
||||
return mContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package com.mogo.service.locationinfo;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*/
|
||||
public class CloudLocationInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private double lat;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private double lon;
|
||||
|
||||
/**
|
||||
* 车头方向
|
||||
*/
|
||||
private double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
private long systemTime;
|
||||
|
||||
/**
|
||||
* 卫星时间
|
||||
*/
|
||||
private long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private double alt;
|
||||
|
||||
/**
|
||||
* 车速
|
||||
*/
|
||||
private double speed;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
* 0:普通车辆、家用车
|
||||
*/
|
||||
private int vehicleType = 0;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
private String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
private String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
private int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
private double rateLimiting;
|
||||
|
||||
/**
|
||||
* 瓦片id
|
||||
*/
|
||||
private String tileId;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
private double roadWidth;
|
||||
|
||||
public CloudLocationInfo() {
|
||||
}
|
||||
|
||||
public CloudLocationInfo(CloudLocationInfo info) {
|
||||
this.lat = info.getLat();
|
||||
this.lon = info.getLon();
|
||||
this.heading = info.getHeading();
|
||||
this.systemTime = System.currentTimeMillis();
|
||||
this.satelliteTime = System.currentTimeMillis();
|
||||
this.alt = info.alt;
|
||||
this.speed = info.speed;
|
||||
this.vehicleType = info.vehicleType;
|
||||
this.roadId = info.roadId;
|
||||
this.laneId = info.laneId;
|
||||
this.laneNum = info.laneNum;
|
||||
this.rateLimiting = info.rateLimiting;
|
||||
this.tileId = info.tileId;
|
||||
this.roadWidth = info.roadWidth;
|
||||
}
|
||||
|
||||
protected CloudLocationInfo(Parcel in) {
|
||||
lat = in.readDouble();
|
||||
lon = in.readDouble();
|
||||
heading = in.readDouble();
|
||||
systemTime = in.readLong();
|
||||
satelliteTime = in.readLong();
|
||||
alt = in.readDouble();
|
||||
speed = in.readDouble();
|
||||
vehicleType = in.readInt();
|
||||
roadId = in.readString();
|
||||
laneId = in.readString();
|
||||
laneNum = in.readInt();
|
||||
rateLimiting = in.readDouble();
|
||||
tileId = in.readString();
|
||||
roadWidth = in.readDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeDouble(lat);
|
||||
dest.writeDouble(lon);
|
||||
dest.writeDouble(heading);
|
||||
dest.writeLong(systemTime);
|
||||
dest.writeLong(satelliteTime);
|
||||
dest.writeDouble(alt);
|
||||
dest.writeDouble(speed);
|
||||
dest.writeInt(vehicleType);
|
||||
dest.writeString(roadId);
|
||||
dest.writeString(laneId);
|
||||
dest.writeInt(laneNum);
|
||||
dest.writeDouble(rateLimiting);
|
||||
dest.writeString(tileId);
|
||||
dest.writeDouble(roadWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<CloudLocationInfo> CREATOR = new Creator<CloudLocationInfo>() {
|
||||
@Override
|
||||
public CloudLocationInfo createFromParcel(Parcel in) {
|
||||
return new CloudLocationInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudLocationInfo[] newArray(int size) {
|
||||
return new CloudLocationInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(double alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(int vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public String getRoadId() {
|
||||
return roadId;
|
||||
}
|
||||
|
||||
public void setRoadId(String roadId) {
|
||||
this.roadId = roadId;
|
||||
}
|
||||
|
||||
public String getLaneId() {
|
||||
return laneId;
|
||||
}
|
||||
|
||||
public void setLaneId(String laneId) {
|
||||
this.laneId = laneId;
|
||||
}
|
||||
|
||||
public int getLaneNum() {
|
||||
return laneNum;
|
||||
}
|
||||
|
||||
public void setLaneNum(int laneNum) {
|
||||
this.laneNum = laneNum;
|
||||
}
|
||||
|
||||
public double getRateLimiting() {
|
||||
return rateLimiting;
|
||||
}
|
||||
|
||||
public void setRateLimiting(double rateLimiting) {
|
||||
this.rateLimiting = rateLimiting;
|
||||
}
|
||||
|
||||
public String getTileId() {
|
||||
return tileId;
|
||||
}
|
||||
|
||||
public void setTileId(String tileId) {
|
||||
this.tileId = tileId;
|
||||
}
|
||||
|
||||
public double getRoadWidth() {
|
||||
return roadWidth;
|
||||
}
|
||||
|
||||
public void setRoadWidth(double roadWidth) {
|
||||
this.roadWidth = roadWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CloudLocationInfo{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", heading=" + heading +
|
||||
", systemTime=" + systemTime +
|
||||
", satelliteTime=" + satelliteTime +
|
||||
", alt=" + alt +
|
||||
", speed=" + speed +
|
||||
", vehicleType=" + vehicleType +
|
||||
", roadId='" + roadId + '\'' +
|
||||
", laneId='" + laneId + '\'' +
|
||||
", laneNum=" + laneNum +
|
||||
", rateLimiting=" + rateLimiting +
|
||||
", tileId=" + tileId +
|
||||
", roadWidth=" + roadWidth +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String print() {
|
||||
return "CloudLocation{ lon: " + lon + " lat: " + lat + " heading: " + heading + " speed: "
|
||||
+ speed + " vehicleType: " + vehicleType + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CloudLocationInfo that = (CloudLocationInfo) o;
|
||||
return Double.compare(that.lat, lat) == 0 &&
|
||||
Double.compare(that.lon, lon) == 0;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(lat, lon);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package com.mogo.service.impl.adas;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.utils.MortonCode;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
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.WarnMessageInfo;
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
@@ -25,6 +24,7 @@ import com.mogo.service.adas.IMogoAdasRecognizedDataCallback;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.ADASCarStateInfo;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.service.adas.entity.CarModelListResponse;
|
||||
@@ -148,8 +148,10 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
mLastLon = stateInfo.getValues().getLon();
|
||||
mLastLat = stateInfo.getValues().getLat();
|
||||
if ( mMogoAdasCarDataCallback != null ) {
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback( stateInfo );
|
||||
mSpeed = stateInfo.getValues().getGnss_speed();
|
||||
satelliteTime = stateInfo.getValues().getSystemTime();
|
||||
if (mMogoAdasCarDataCallback != null) {
|
||||
mMogoAdasCarDataCallback.onAdasCarDataCallback(stateInfo);
|
||||
}
|
||||
Logger.i( "ADAS-LOC-timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
@@ -457,12 +459,18 @@ public class MogoADASController implements IMogoADASController {
|
||||
private double mLastLon;
|
||||
private double mLastLat;
|
||||
private double mSpeed;
|
||||
private String satelliteTime;
|
||||
|
||||
@Override
|
||||
public double getLastSpeed() {
|
||||
return mSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public double getLastLat() {
|
||||
return mLastLat;
|
||||
}
|
||||
@@ -831,7 +839,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mockAdasRecognized( List< ADASRecognizedResult > recognizedResults ) {
|
||||
public void mockAdasRecognized( List<ADASRecognizedResult> recognizedResults ) {
|
||||
if ( !mMogoAdasRecognizedDataCallbacks.isEmpty() ) {
|
||||
for ( IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks ) {
|
||||
if ( callback == null ) {
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.mogo.service.impl.connection;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -53,7 +53,7 @@ public class MogoSocketManager implements IMogoSocketManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg( MsgBody body, IMogoMsgAckListener listener ) {
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.sendMsg( body, listener );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user