Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -141,12 +141,12 @@ public class V2XConst {
|
||||
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警
|
||||
* */
|
||||
*V2X 车路云前方预警-识别物
|
||||
* */
|
||||
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警
|
||||
*V2X 车路云前方预警-线
|
||||
* */
|
||||
public static final String V2X_FRONT_STOP_LINE = "V2X_FRONT_STOP_LINE";
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,7 @@ public class V2XWaringManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 测试数据
|
||||
* 测试数据
|
||||
*/
|
||||
private void testData() {
|
||||
|
||||
@@ -86,7 +86,6 @@ public class V2XWaringManager {
|
||||
// 加载数据源
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(warningEntity);
|
||||
Logger.d(V2XConst.LOG_NAME_WARN, "testData -----> ");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 当前车辆与道路事件的连接线
|
||||
* 绘制行人和二轮车连线
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER)
|
||||
public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager {
|
||||
@@ -40,23 +40,25 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getType() != null) {
|
||||
if (info.getType().equals("1")) { //预警 TODO
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
} else {
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
} else {
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
// if (info.getType() != null) {
|
||||
// if (info.getType().equals("1")) { //预警 TODO
|
||||
// colors.add(0xFFFFA31A);
|
||||
// colors.add(0xFFFFA31A);
|
||||
// } else {
|
||||
// colors.add(0xFFE32F46);
|
||||
// colors.add(0xFFE32F46);
|
||||
// }
|
||||
// } else {
|
||||
// colors.add(0xFFE32F46);
|
||||
// colors.add(0xFFE32F46);
|
||||
// }
|
||||
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
// Logger.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth);
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
// options.width(info.getWidth()).useGradient(true).colorValues(colors);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth());
|
||||
options.width(info.getWidth()).useGradient(true).transparency(0.1f).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
// 目标车辆位置
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -29,24 +30,36 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
||||
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
|
||||
private V2XWarningEntity mCloundWarningInfo;
|
||||
private static String TAG = "MoGoV2XCloundDataManager";
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
|
||||
|
||||
mCloundWarningInfo = cloundWarningInfo;
|
||||
|
||||
//绘制识别物与交汇点连线,并且更新连线数据 TODO VR模式无法获取道路宽度
|
||||
drawOtherObjectLine(cloundWarningInfo);
|
||||
Logger.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
drawOtherObjectLine(cloundWarningInfo);
|
||||
}, 0);
|
||||
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
|
||||
//延迟3秒清理线
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
}, 8000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制行人和二轮车连线,并且更新数据
|
||||
* 绘制行人和二轮车连线,并且更新数据 TODO 需要实时给行人当前位置
|
||||
*/
|
||||
private void drawOtherObjectLine(V2XWarningEntity info) {
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
|
||||
@@ -56,7 +69,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
|
||||
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
|
||||
} else {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "polyLine == null");
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "polyLine == null");
|
||||
DrawLineInfo lineInfo = new DrawLineInfo();
|
||||
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
|
||||
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
|
||||
@@ -64,21 +77,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
lineInfo.setEndLocation(endLatlng);
|
||||
lineInfo.setHeading(info.heading);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getLon(),
|
||||
info.getLat(), (float) info.heading, true, true);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "roadWidth = " + roadWidth);
|
||||
float pixel = V2XServiceManager.getMapUIController().getScalePerPixel();
|
||||
float width = roadWidth / pixel;
|
||||
lineInfo.setWidth(width);
|
||||
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getLon(),
|
||||
// info.getLat(), (float) info.heading, true, true);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth());
|
||||
}
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
||||
}
|
||||
|
||||
//延迟3秒清理线
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
}, 6000 );
|
||||
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
@@ -91,11 +97,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位 移动完成需要 3s消失
|
||||
* 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候
|
||||
*/
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude());
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude());
|
||||
//当行人经纬度交点 经纬度不为空,开始画线,否则清理
|
||||
//自车只需要关注移动
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
@@ -105,21 +111,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon())));
|
||||
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "mogoPolyline == null");
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth());
|
||||
DrawLineInfo info = new DrawLineInfo(); // 对象
|
||||
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon());
|
||||
info.setHeading(latLng.getBearing());
|
||||
info.setStartLocation(startLatlng);
|
||||
info.setEndLocation(endLatlng);
|
||||
info.setWidth(60); //TODO
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
}
|
||||
|
||||
//延迟3秒清理线
|
||||
//延迟3秒清理线 TODO 何时 清理
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
}, 3000 );
|
||||
}, 13000 );
|
||||
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null");
|
||||
|
||||
@@ -38,29 +38,30 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager --------> ");
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getType() != null) {
|
||||
if (info.getType().equals("1")) { //预警 TODO
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
} else {
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "drawWarnPolyline info.getType() == null ");
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
// if (info.getType() != null) {
|
||||
// if (info.getType().equals("1")) { //预警 TODO
|
||||
// colors.add(0xFFFFA31A);
|
||||
// colors.add(0xFFFFA31A);
|
||||
// } else {
|
||||
// colors.add(0xFFE32F46);
|
||||
// colors.add(0xFFE32F46);
|
||||
// }
|
||||
// } else {
|
||||
// Log.e(V2XConst.LOG_NAME_WARN, "drawWarnPolyline info.getType() == null ");
|
||||
// colors.add(0xFFE32F46);
|
||||
// colors.add(0xFFE32F46);
|
||||
// }
|
||||
|
||||
// Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth());
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
options.width(info.getWidth()).useGradient(true).transparency(0.9f).colorValues(colors);
|
||||
// options.width(info.getWidth()).useGradient(true).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.mogo.module.v2x.scenario.scene.livecar;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
@@ -100,6 +103,8 @@ public class V2XVoiceCallLiveBiz {
|
||||
* 查看前方车辆直播,同方向角 200米范围
|
||||
*/
|
||||
public void getFrontCarLive() {
|
||||
LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(),
|
||||
MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId());
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity = buildCallLiveParams(null, null);
|
||||
mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario();
|
||||
mV2XVoiceCallLiveScenario.setV2XWindow(new V2XVoiceCallLiveCarWindow());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.scene.livecar;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -64,7 +64,11 @@ public class V2XVoiceCallLiveScenario extends AbsV2XScenario<V2XPushMessageEntit
|
||||
R.dimen.module_v2x_event_window_width_vr : R.dimen.module_v2x_event_window_width);
|
||||
int height = (int) V2XUtils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
|
||||
R.dimen.module_v2x_event_see_live_window_height_vr : R.dimen.module_v2x_event_see_live_window_height);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(width, height);
|
||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(width, height);
|
||||
layoutParams.topMargin = (int) V2XUtils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
|
||||
R.dimen.module_v2x_event_window_top_margin_vr : R.dimen.module_v2x_event_window_top_margin);
|
||||
layoutParams.rightMargin = (int) V2XUtils.getApp().getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
|
||||
R.dimen.module_v2x_event_window_right_margin_vr : R.dimen.module_v2x_event_window_right_margin);
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -28,6 +29,7 @@ import java.util.List;
|
||||
* @since: 2021/3/30
|
||||
*/
|
||||
public class V2XWarningMarker implements IV2XMarker {
|
||||
private static final String TAG = "V2XWarningMarker";
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
private MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
private Context mContext = V2XServiceManager.getContext();
|
||||
@@ -65,13 +67,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
clearPOI();
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
//自车位置
|
||||
MogoLatLng car = mMarkerEntity.getCarLocation();
|
||||
if (car == null) {
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
car = new MogoLatLng(lat, lon);
|
||||
car = new MogoLatLng(39.977709,116.417703);
|
||||
}
|
||||
MogoLatLng car = V2XServiceManager.getNavi().getCarLocation();
|
||||
if (car != null) {
|
||||
//根据到停止线的距离和方向角获取经纬度
|
||||
MogoLatLng
|
||||
@@ -79,6 +75,8 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) {
|
||||
drawLine(car, stopLineLo);
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "自车位置没有拿到");
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
@@ -105,7 +103,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
fillPoints.add(y);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.widget.TextView;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack;
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
|
||||
Reference in New Issue
Block a user