opt mogo obu

This commit is contained in:
lixiaopeng
2021-07-05 18:45:18 +08:00
parent 9f73b96b52
commit e6657f3941
4 changed files with 77 additions and 46 deletions

View File

@@ -172,7 +172,7 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
// mebulaobu : 'com.zhidao.support.nebulaobu:nebulaobu:1.0.0.3',
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.2',
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.5',
// 左侧面板
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",

View File

@@ -820,14 +820,6 @@ public class AMapViewWrapper implements IMogoMapView,
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
//
// UiThreadHandler.postDelayed(() -> {
// if (!isShowWarn) {
// mSelfMarker.marker3DIcon(R.raw.qfpz);
// isShowWarn = true;
// }
// }, 6_000L);
}
showSelfSpeed(location.getSpeed());
}

View File

@@ -5,6 +5,7 @@ import android.graphics.Rect;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import com.mogo.cloud.socket.entity.SocketDownData;
import com.mogo.commons.AbsMogoApplication;
@@ -13,6 +14,7 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.api.CallChatApi;
@@ -30,11 +32,13 @@ import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.utils.CloudPoiManager;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.module.service.ServiceConst;
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.socket.IMogoCloudOnMsgListener;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
@@ -53,6 +57,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -163,11 +168,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
// msg.what = MSG_ADAS;
// msg.sendToTarget();
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList);
Logger.e("liyz", "addAdasRecognizedDataCallback ------> ");
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,
// for ( ADASRecognizedResult result : resultList) {
// if (result.drawlevel == 3) { //找出可能碰撞的车
// Logger.d("liyz", "result.drawlevel == 3 ------> ");
// if (result.drawlevel == 3 || result.drawlevel == 1) { //找出可能碰撞的车
// Logger.d("liyz", "result.drawlevel == 3 || ==1 ------> ");
//// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个)然后预设20米的长度
//// 绘制碰撞的他车指引线,需要实时给数据更新 TODO
// drawLimberCollisionPolyline(result);
@@ -180,31 +185,31 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
// /**
// * 实时绘制连线
// *
// * @param result
// */
// private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
// if (result != null) {
// IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
// MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
// MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
// Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
// + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
// if (polyLine != null) {
// Log.d(TAG, "drawStopLine polyLine != null");
// polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
// } else {
// List<MogoLatLng> latLngs = new ArrayList<>();
// latLngs.add(startLatLng);
// latLngs.add(endLatlng);
// LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
// }
// } else {
// LimberCollisionPolyline.getInstance().clearLine();
// }
// }
/**
* 实时绘制连线
*
* @param result
*/
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
if (result != null) {
IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
+ "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
if (polyLine != null) {
Log.d(TAG, "drawStopLine polyLine != null");
polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
} else {
List<MogoLatLng> latLngs = new ArrayList<>();
latLngs.add(startLatLng);
latLngs.add(endLatlng);
LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
}
} else {
LimberCollisionPolyline.getInstance().clearLine();
}
}
// private final static int MSG_SNAPSHOT = 1;
// private final static int MSG_ADAS = 2;

View File

@@ -119,9 +119,8 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
MogoObuManager.getInstance().registerListener(mogoObuListener);
//TODO 测试
// MogoObuManager.getInstance().test(icw_data);
// UiThreadHandler.postDelayed( () -> {
// MogoObuManager.getInstance().test(icw_data);
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(3, MogoReceiver.ACTION_V2X_FRONT_WARNING);
// handleSdkObu(1);
//
@@ -201,26 +200,61 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
Logger.e("liyz", "onCvxV2vThreatIndInfo ------> " + info.toString());
//预警类型 threat_level 3
if (info != null) {
if (info.getThreat_info() != null && info.getControl() != null &&
if (info.getThreat_info() != null /*&& info.getControl() != null*/ &&
info.getThreat_info().getThreat_level() == 3) { //看看2的情况
//预警方位
int direction = V2XUtils.getDirection((float) info.getExt_info().getAzimuth());
Log.d("liyz", "direction = " + direction + "---azimuth = " + (float) info.getExt_info().getAzimuth());
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
int direction = info.getExt_info().getTarget_classification();
Logger.d("liyz", "direction = " + direction + "----" + getMessage(direction));
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(getMessage(direction), MogoReceiver.ACTION_V2X_FRONT_WARNING);
//处理预警类型
int appId = info.getThreat_info().getApp_id();
handleSdkObu(getEventType(appId));
}
//预警数据的组装,车辆实时移动和变色 TODO 这里需要obu提供他车列表
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(getResultList(info));
//预警数据的组装,车辆实时移动和变色 TODO 这里需要obu提供他车列表 暂时不做
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(getResultList(info));
} else {
Log.e("liyz", "info == null ");
Logger.e("liyz", "info == null ");
}
}
};
private int getMessage(int targetClassification) {
switch (targetClassification) {
case ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE:
case ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_RIGHT:
case ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_RIGHT:
return 1;
case ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_IN_LANE:
case ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_RIGHT:
case ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_RIGHT:
return 2;
case ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE:
case ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_LEFT:
case ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_LEFT:
return 3;
case ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_RIGHT:
case ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_RIGHT:
case ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_RIGHT:
return 4;
default:
case ObuConstants.TARGET_CLASSIFICATION.TC_UNCLASSIFIED:
return 1;
}
}
private int getEventType(int appid) {
if (appid == ObuConstants.USE_CASE_ID.EBW) {
return ObuConstant.TYPE_URGENCY_COLLISION_WARNING;