This commit is contained in:
zhongchao
2021-04-28 19:56:00 +08:00
62 changed files with 48818 additions and 15757 deletions

View File

@@ -64,7 +64,7 @@ public class V2XSocketManager {
}
register401007();
register401009();
register401019();
register401020();
// TODO 这里是前瞻需求,量产版本需要注释
register401003();
@@ -230,7 +230,7 @@ public class V2XSocketManager {
* * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799
* * 最优路线推荐
*/
public void register401019() {
public void register401020() {
mV2XMessageListener_401020 = new V2XMessageListener_401020();
// 道路事件,在线车辆绘制
V2XServiceManager

View File

@@ -54,7 +54,7 @@ public class V2XStatusManager {
if (mLocation == null) {
mLocation = new MogoLocation();
}
Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
//Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
return mLocation;
}

View File

@@ -4,37 +4,14 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.drawer.marker.AheadCollisionView;
import com.mogo.module.common.drawer.marker.AheadCollisionWindow3DAdapter;
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.common.view.MarkerBaseFloor;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.listener.V2XWarnMessageListener;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
/**
* desc : V2X报警事件管理这里进行报警事件的分发处理包括了adas数据
@@ -83,7 +60,7 @@ public class V2XWaringManager {
private void testData(String adasResult) {
try {
int id = R.raw.scenario_warning_event_data;
int id = R.raw.scenario_warning_event_data_right;
switch (adasResult) {
case "left":
id = R.raw.scenario_warning_event_data_left;

View File

@@ -70,6 +70,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
//测试数据
MogoLatLng s = new MogoLatLng(26.88394048,112.5678959);
MogoLatLng t = new MogoLatLng(26.88393912,112.5678793);
Double b = Trigonometric.getAngle(s.lon,s.lat,t.lon,t.lat);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
@@ -100,7 +106,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
//添加停止线marker
handleStopLine();
//自车画线
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
UiThreadHandler.postDelayed(() -> {
@@ -119,7 +125,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//车辆静止的时候
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
@@ -261,13 +267,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void onCarLocationChanged2(Location latLng) {
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
//当行人经纬度交点 开始画线,否则清理
if (mCloundWarningInfo != null) {
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
}
drawSlefCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
}
drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
// }
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
}
@@ -278,7 +284,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
/**
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
*/
private void drawSlefCarLine(double lon, double lat, float bearing) {
private void drawSelfCarLine(double lon, double lat, float bearing) {
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
@@ -291,9 +297,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
isFirstLocation = true;
}
//自车位置
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
//自车位置
startLatlng = new MogoLatLng(lat, lon);
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));

View File

@@ -263,7 +263,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
crossing.getLat(),
(int) currentLocation.getBearing()
);
Logger.d("V2X_OBU_VIP", "监测是否需要进行vip弹框提醒\ndistance: " + distance + "\neventAngle: " + eventAngle + "\ntarget: " + crossing + "\ncurrent: " + currentLatLng);
//Logger.d("V2X_OBU_VIP", "监测是否需要进行vip弹框提醒\ndistance: " + distance + "\neventAngle: " + eventAngle + "\ntarget: " + crossing + "\ncurrent: " + currentLatLng);
if (distance <= DEFAULT_VIP_CROSSING_DISTANCE && 0 <= eventAngle && eventAngle <= 20) {
//距离小于DEFAULT_VIP_CROSSING_DISTANCE且夹角在0~20说明在前方则触发vip通行
defaultTarget = crossing;

View File

@@ -59,6 +59,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.v2x_road_front_warning_vr, this);
typeImage = findViewById(R.id.warning_type_image);
warningTextView = findViewById(R.id.warning_content_text);
distance = findViewById(R.id.warning_distance);
}

View File

@@ -1,15 +1,12 @@
package com.mogo.module.v2x.utils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.utils.network.utils.GsonUtil;
@@ -165,7 +162,7 @@ public class TestOnLineCarUtils {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.scenario_warning_event_data);
.openRawResource(R.raw.scenario_warning_event_data_right);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];